1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-04-01 20:05:19 +00:00
Michal Privoznik 46b03819ae qemu_namespace: Fix a corner case in qemuDomainGetPreservedMounts()
When setting up namespace for QEMU we look at mount points under
/dev (like /dev/pts, /dev/mqueue/, etc.) because we want to
preserve those (which is done by moving them to a temp location,
unshare(), and then moving them back). We have a convenience
helper - qemuDomainGetPreservedMounts() - that processes the
mount table and (optionally) moves the other filesystems too.
This helper is also used when attempting to create a path in NS,
because the path, while starting with "/dev/" prefix, may
actually lead to one of those filesystems that we preserved.

And here comes the corner case: while we require the parent mount
table to be in shared mode (equivalent of `mount --make-rshared /'),
these mount events propagate iff the target path exist inside the
slave mount table (= QEMU's private namespace). And since we
create only a subset of /dev nodes, well, that assumption is not
always the case.

For instance, assume that a domain is already running, no
hugepages were configured for it nor any hugetlbfs is mounted.
Now, when a hugetlbfs is mounted into '/dev/hugepages', this is
propagated into the QEMU's namespace, but since the target dir
does not exist in the private /dev, the FS is not mounted in the
namespace.

Fortunately, this difference between namespaces is visible when
comparing /proc/mounts and /proc/$PID/mounts (where PID is the
QEMU's PID). Therefore, if possible we should look at the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-09-23 16:32:51 +02:00
..
2022-06-16 06:43:57 +02:00
2022-06-16 06:43:57 +02:00
2022-06-16 06:43:57 +02:00
2022-06-16 06:43:57 +02:00
2022-06-16 06:43:57 +02:00
2022-06-16 06:43:57 +02:00
2022-06-16 06:43:57 +02:00
2022-06-16 06:43:57 +02:00
2022-06-16 06:43:57 +02:00
2022-06-16 06:43:57 +02:00
2022-06-16 06:43:57 +02:00
2022-06-16 06:43:57 +02:00
2022-06-16 06:43:57 +02:00
2022-06-16 06:43:57 +02:00
2022-06-16 06:43:57 +02:00
2022-06-16 06:43:57 +02:00
2022-06-16 06:43:57 +02:00