]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: fix mount issue by moving NULL value to "none" in syscall.
authorJulio Faracco <jcfaracco@gmail.com>
Tue, 26 Jun 2018 03:18:21 +0000 (00:18 -0300)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 26 Jun 2018 06:05:57 +0000 (08:05 +0200)
After running libvirt daemon with valgrind tools, some errors are
appearing when you try to start a domain. One example:

==18012== Syscall param mount(type) points to unaddressable byte(s)
==18012==    at 0x6FEE3CA: mount (syscall-template.S:78)
==18012==    by 0x531344D: virFileMoveMount (virfile.c:3828)
==18012==    by 0x27FE7675: qemuDomainBuildNamespace (qemu_domain.c:11501)
==18012==    by 0x2800C44E: qemuProcessHook (qemu_process.c:2870)
==18012==    by 0x52F7E1D: virExec (vircommand.c:726)
==18012==    by 0x52F7E1D: virCommandRunAsync (vircommand.c:2477)
==18012==    by 0x52F4EDD: virCommandRun (vircommand.c:2309)
==18012==    by 0x2800A731: qemuProcessLaunch (qemu_process.c:6235)
==18012==    by 0x2800D6B4: qemuProcessStart (qemu_process.c:6569)
==18012==    by 0x28074876: qemuDomainObjStart (qemu_driver.c:7314)
==18012==    by 0x280522EB: qemuDomainCreateWithFlags (qemu_driver.c:7367)
==18012==    by 0x55484BF: virDomainCreate (libvirt-domain.c:6531)
==18012==    by 0x12CDBD: remoteDispatchDomainCreate (remote_daemon_dispatch_stubs.h:4350)
==18012==    by 0x12CDBD: remoteDispatchDomainCreateHelper (remote_daemon_dispatch_stubs.h:4326)
==18012==  Address 0x0 is not stack'd, malloc'd or (recently) free'd

Some documentation recommends to use "none" when you don't have a
filesystem type to use. Specially, for bind and move actions.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
src/util/virfile.c
src/util/virprocess.c

index 9296ccbe2a4ff2117cbe0505e112d1de3b2b08d4..378d03ecf0ab8c03365ede8b7a4af3b523835956 100644 (file)
@@ -3825,7 +3825,7 @@ virFileMoveMount(const char *src,
 {
     const unsigned long mount_flags = MS_MOVE;
 
-    if (mount(src, dst, NULL, mount_flags, NULL) < 0) {
+    if (mount(src, dst, "none", mount_flags, NULL) < 0) {
         virReportSystemError(errno,
                              _("Unable to move %s mount to %s"),
                              src, dst);
index 1fbbbb3a279ff1847509069eaf818bc5ccad7633..f92b0dce3774332ac08d821ed531e3bae93879ab 100644 (file)
@@ -1181,7 +1181,7 @@ virProcessSetupPrivateMountNS(void)
         goto cleanup;
     }
 
-    if (mount("", "/", NULL, MS_SLAVE|MS_REC, NULL) < 0) {
+    if (mount("", "/", "none", MS_SLAVE|MS_REC, NULL) < 0) {
         virReportSystemError(errno, "%s",
                              _("Failed to switch root mount into slave mode"));
         goto cleanup;