mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-24 12:22:20 +00:00
qemu_namespace: Fix detection of nested mount points
When deciding whether to bind mount a path in domain's namespace, we look at the QEMU mount table (/proc/$pid/mounts) and try to match prefix of given path with one of mount points. Well, we do that in a bit clumsy way. For instance, if there's "/dev/hugepages" already mounted inside the namespace and we are deciding whether to bind mount "/dev/hugepages1G/..." we decide to skip over the path and NOT bind mount it. This is because plain STRPREFIX() is used and yes, the former is prefix of the latter. What we need to check also is whether the next character after the prefix is slash. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
379c0ce4bf
commit
4a91324b61
@ -1264,9 +1264,11 @@ qemuNamespacePrepareOneItem(qemuNamespaceMknodData *data,
|
|||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
for (n = devMountsPath; n && *n; n++) {
|
for (n = devMountsPath; n && *n; n++) {
|
||||||
|
const char *p;
|
||||||
|
|
||||||
if (STREQ(*n, "/dev"))
|
if (STREQ(*n, "/dev"))
|
||||||
continue;
|
continue;
|
||||||
if (STRPREFIX(item.file, *n)) {
|
if ((p = STRSKIP(item.file, *n)) && *p == '/') {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user