Blob Blame History Raw
From b20c8945af5a5ce248c2acd895be2812965fd6bd Mon Sep 17 00:00:00 2001
From: "Daniel P. Berrange" <berrange@redhat.com>
Date: Tue, 1 Oct 2013 13:54:10 +0100
Subject: [PATCH] Force 9p version to version=9p2000.u

With 9p version=9p2000.L, we tickle two bugs in QEMU's code.

One breaks most calls with ENODEV on FS_IOC_GETVERSION ioctls.

The other breaks xattr checks due to inverted errno.

In addition with 9p2000.L we see extra permission checks
on dirs, which prevents the guest from over-mounting dirs
like /root that are restricted on the user running QEMU.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit f4087aa0e993f59772d3bda53038888af7f43b5e)
---
 libvirt-sandbox/libvirt-sandbox-builder-machine.c | 2 +-
 libvirt-sandbox/libvirt-sandbox-init-qemu.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libvirt-sandbox/libvirt-sandbox-builder-machine.c b/libvirt-sandbox/libvirt-sandbox-builder-machine.c
index fd945c7..db5ceaa 100644
--- a/libvirt-sandbox/libvirt-sandbox-builder-machine.c
+++ b/libvirt-sandbox/libvirt-sandbox-builder-machine.c
@@ -274,7 +274,7 @@ static gboolean gvir_sandbox_builder_machine_write_mount_cfg(GVirSandboxConfig *
         if (GVIR_SANDBOX_IS_CONFIG_MOUNT_HOST_BIND(mconfig)) {
             source = g_strdup_printf("sandbox:mount%zu", nHostBind++);
             fstype = "9p";
-            options = g_strdup("trans=virtio");
+            options = g_strdup("trans=virtio,version=9p2000.u");
         } else if (GVIR_SANDBOX_IS_CONFIG_MOUNT_HOST_IMAGE(mconfig)) {
             source = g_strdup_printf("vd%c", (char)('a' + nHostImage++));
             fstype = "ext3";
diff --git a/libvirt-sandbox/libvirt-sandbox-init-qemu.c b/libvirt-sandbox/libvirt-sandbox-init-qemu.c
index b7e4c6f..f72148a 100644
--- a/libvirt-sandbox/libvirt-sandbox-init-qemu.c
+++ b/libvirt-sandbox/libvirt-sandbox-init-qemu.c
@@ -165,7 +165,7 @@ mount_9pfs(const char *src, const char *dst, int mode, int readonly)
     if (readonly)
         flags |= MS_RDONLY;
 
-    if (mount(src, dst, "9p", flags, "trans=virtio") < 0) {
+    if (mount(src, dst, "9p", flags, "trans=virtio,version=9p2000.u") < 0) {
         fprintf(stderr, "libvirt-sandbox-init-qemu: %s: cannot mount %s on %s (9p): %s\n",
                 __func__, src, dst, strerror(errno));
         exit_poweroff();