From fd625b3fc5d72918e7b0559a8c738677f78c14d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Fri, 3 Apr 2020 14:12:12 +0200 Subject: [PATCH] qemu: Don't crash if virtiofsd path is non existent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead, report an error and exit gracefully, as shown below: ``` dahmer fidencio # podman run -ti --runtime=/usr/bin/kata-runtime fedora sh Error: virtiofsd path (/usr/libexec/virtiofsd) does not exist: OCI runtime error ``` Fixes: #2582 Signed-off-by: Fabiano FidĂȘncio --- virtcontainers/qemu.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/virtcontainers/qemu.go b/virtcontainers/qemu.go index 694db22cf1..035ae00ab6 100644 --- a/virtcontainers/qemu.go +++ b/virtcontainers/qemu.go @@ -638,6 +638,10 @@ func (q *qemu) setupVirtiofsd() (err error) { var listener *net.UnixListener var fd *os.File + if _, err = os.Stat(q.config.VirtioFSDaemon); os.IsNotExist(err) { + return fmt.Errorf("virtiofsd path (%s) does not exist", q.config.VirtioFSDaemon) + } + sockPath, err := q.vhostFSSocketPath(q.id) if err != nil { return err