]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: virtiofs: check whether the supplied binary exists
authorJán Tomko <jtomko@redhat.com>
Thu, 27 Jan 2022 18:18:24 +0000 (19:18 +0100)
committerJán Tomko <jtomko@redhat.com>
Thu, 3 Feb 2022 13:15:04 +0000 (14:15 +0100)
Report an error upfront if the binary does not exist
or is not executable.

https://bugzilla.redhat.com/show_bug.cgi?id=1999372

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/qemu/qemu_virtiofs.c

index 1b853a5a597562604ce8230452a7ff59e7107fa9..7e3324b017ceeade3c68fe130c5b4280a243a147 100644 (file)
@@ -184,6 +184,13 @@ qemuVirtioFSStart(virQEMUDriver *driver,
     VIR_AUTOCLOSE logfd = -1;
     int rc;
 
+    if (!virFileIsExecutable(fs->binary)) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("virtiofsd binary '%s' is not executable"),
+                       fs->binary);
+        return -1;
+    }
+
     if (!virFileExists(fs->src->path)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("the virtiofs export directory '%s' does not exist"),