mirror of
https://github.com/systemd/systemd.git
synced 2026-11-07 22:07:14 +00:00
When nested mounts appear under a sysext hierarchy like this: mkdir -p /opt/trigger/ mount -t tmpfs tmpfs /opt/trigger mkdir -p /opt/trigger/inner mount -t tmpfs tmpfs /opt/trigger/inner Then systemd-sysext merge will lose the inner mount because it uses a regular bind mount with propagation and then unmounts the source, unmounting all children with it which propagates (as found out in https://github.com/flatcar/Flatcar/issues/2111). To solve this, clone the sub mount with MS_PRIVATE to decouple sub mounts from the original mount. Then attach the cloned mount instead of doing regular bind mounts. For old kernels we still attach the cloned mount but we fallback to cloning without MS_PRIVATE. This change also affects mount_private_apivfs which is used for private /proc, /sys, and cgroupfs but I think it makes sense there, too, instead of only doing mount_setattr for sysext alone because, e.g., a container and the host should not be leaking mount actions into each other for these mounts. (cherry picked from commitf6a7a9ec3d) (cherry picked from commita047e14bc8)