]> xenbits.xensource.com Git - libvirt.git/commitdiff
virt-aa-helper: don't deny writes to readonly mounts
authorCédric Bosdonnat <cbosdonnat@suse.com>
Tue, 17 Nov 2015 09:11:30 +0000 (10:11 +0100)
committerCédric Bosdonnat <cbosdonnat@suse.com>
Thu, 14 Jan 2016 14:42:05 +0000 (15:42 +0100)
There is no need to deny writes on a readonly mount: write still
won't be accepted, even if the user remounts the folder as RW in
the guest as qemu sets the 9p mount as ro.

This deny rule was leading to problems for example with readonly /:
The qemu process had to write to a bunch of files in / like logs,
sockets, etc. This deny rule was also preventing auditing of these
denials, making it harder to debug.

src/security/virt-aa-helper.c

index 5de56e582aca4c9b8202f3a734977b0926fdbd33..a2d7226d7640d881fff6eb03740461ae96589940 100644 (file)
@@ -1127,7 +1127,10 @@ get_files(vahControl * ctl)
                 ctl->def->fss[i]->src) {
             virDomainFSDefPtr fs = ctl->def->fss[i];
 
-            if (vah_add_path(&buf, fs->src, fs->readonly ? "r" : "rw", true) != 0)
+            /* We don't need to add deny rw rules for readonly mounts,
+             * this can only lead to troubles when mounting / readonly.
+             */
+            if (vah_add_path(&buf, fs->src, "rw", true) != 0)
                 goto cleanup;
         }
     }