提交 794b576c 编写于 作者: J Julio Faracco 提交者: Michal Privoznik

util: fix mount issue by moving NULL value to "none" in syscall.

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: NJulio Faracco <jcfaracco@gmail.com>
上级 0ec6343a
...@@ -3825,7 +3825,7 @@ virFileMoveMount(const char *src, ...@@ -3825,7 +3825,7 @@ virFileMoveMount(const char *src,
{ {
const unsigned long mount_flags = MS_MOVE; 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, virReportSystemError(errno,
_("Unable to move %s mount to %s"), _("Unable to move %s mount to %s"),
src, dst); src, dst);
......
...@@ -1181,7 +1181,7 @@ virProcessSetupPrivateMountNS(void) ...@@ -1181,7 +1181,7 @@ virProcessSetupPrivateMountNS(void)
goto cleanup; goto cleanup;
} }
if (mount("", "/", NULL, MS_SLAVE|MS_REC, NULL) < 0) { if (mount("", "/", "none", MS_SLAVE|MS_REC, NULL) < 0) {
virReportSystemError(errno, "%s", virReportSystemError(errno, "%s",
_("Failed to switch root mount into slave mode")); _("Failed to switch root mount into slave mode"));
goto cleanup; goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册