]> git.proxmox.com Git - mirror_lxc.git/commit
conf: create separate peer group for container's root
authorChristian Brauner <brauner@kernel.org>
Thu, 24 Nov 2022 08:30:19 +0000 (09:30 +0100)
committerChristian Brauner (Microsoft) <christian.brauner@ubuntu.com>
Thu, 24 Nov 2022 16:26:27 +0000 (17:26 +0100)
commit81d94a4eec65fecc244e2d2def457e1b510d8777
tree0007a7e2295c95bea87609d56a26f3c382de8475
parentd493695e30102d2d9c884724aa0f94f18572f0dc
conf: create separate peer group for container's root

Finally, we turn the rootfs into a shared mount. Note, that this
doesn't reestablish mount propagation with the hosts mount
namespace. Instead we'll create a new peer group.

We're doing this because most workloads do rely on the rootfs being
a shared mount. For example, systemd daemon like sytemd-udevd run in
their own mount namespace. Their mount namespace has been made a
dependent mount (MS_SLAVE) with the host rootfs as it's dominating
mount. This means new mounts on the host propagate into the
respective services.

This is broken if we leave the container's rootfs a dependent mount.
In which case both the container's rootfs and the service's rootfs
will be dependent mounts with the host's rootfs as their dominating
mount. So if you were to mount over the rootfs from the host it
would not just propagate into the container's mount namespace it
would also propagate into the service. That's nonsense semantics for
nearly all relevant use-cases. Instead, establish the container's
rootfs as a separate peer group mirroring the behavior on the host.

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
src/lxc/conf.c