mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Remove sub-mounts under /dev when starting an LXC container
Since we are mounting a new /dev in the container, we must remove any sub-mounts like /dev/shm, /dev/mqueue, etc, otherwise they'll be recorded in /proc/mounts, but not be accessible to applications.
This commit is contained in:
parent
0ac3baee2c
commit
5bb83236c9
@ -1416,10 +1416,11 @@ static int lxcContainerSetupPivotRoot(virDomainDefPtr vmDef,
|
|||||||
if (lxcContainerPivotRoot(root) < 0)
|
if (lxcContainerPivotRoot(root) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* Gets rid of any existing stuff under /proc, since we need new
|
/* Gets rid of any existing stuff under /proc, /sys & /tmp
|
||||||
* namespace aware versions of those. We must do /proc second
|
* We need new namespace aware versions of those. We must
|
||||||
* otherwise we won't find /proc/mounts :-) */
|
* do /proc last otherwise we won't find /proc/mounts :-) */
|
||||||
if (lxcContainerUnmountSubtree("/sys", false) < 0 ||
|
if (lxcContainerUnmountSubtree("/sys", false) < 0 ||
|
||||||
|
lxcContainerUnmountSubtree("/dev", false) < 0 ||
|
||||||
lxcContainerUnmountSubtree("/proc", false) < 0)
|
lxcContainerUnmountSubtree("/proc", false) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user