Fix/cgroup2 bind mount shared cgroupns#5267
Conversation
9a08cc5 to
922bd42
Compare
5c685ee to
0b7a122
Compare
0b7a122 to
9653c5c
Compare
1360929 to
491bf97
Compare
|
Hi @kolyshkin would you like to move forward with this PR? |
491bf97 to
c8ed922
Compare
kolyshkin
left a comment
There was a problem hiding this comment.
Forgot to submit pending review comments, my bad.
Overall it's almost ready.
3786615 to
3d9d5a7
Compare
|
@lifubang @kolyshkin I have moved the checkpoint-related commit into a new PR: #5318, and fixed the other review suggestions. |
3d9d5a7 to
0a1029c
Compare
b76157e to
6c3174f
Compare
When cgroup namespaces is host, mounting a new cgroup2 fs instance for /sys/fs/cgroup can affect the host-visible cgroupfs mount state, including options such as nsdelegate. Avoid that by preferring a bind mount of the existing cgroup v2 hierarchy when cgroupns is host. Keep the existing cgroup2 mount-first logic for private cgroup namespaces, including the EPERM/EBUSY fallback to a bind mount and the rootless ENOENT masking behavior. Signed-off-by: sean <xujihui1985@gmail.com>
6c3174f to
4e14d47
Compare
in host cgroupns, mount cgroupfs should not mutate the global superblock mount options, the test is to check when create container with host cgroupns, it should not mutate the global superblock options of host cgroupfs Signed-off-by: sean <xujihui1985@gmail.com>
4e14d47 to
e8edba3
Compare
|
@lifubang @kolyshkin I think I have fixed all the issue listed above, anything I can improve here? |
kolyshkin
left a comment
There was a problem hiding this comment.
This is a bit out of scope for this PR, but I think we should test that the host mounts are not changed after tests (or after each test) as, in general, runc should not change host side mounts (with some exceptions).
@kolyshkin yes, the second commit is suppose to do this check e8edba3 so do you think we should run this check for each test? |
When cgroup namespaces is host, mounting a new cgroup2 fs instance for /sys/fs/cgroup can affect the host-visible cgroupfs mount state, including options such as nsdelegate.
Avoid that by preferring a bind mount of the existing cgroup v2 hierarchy when cgroupns is host. Keep the existing cgroup2 mount-first logic for private cgroup namespaces, including the EPERM/EBUSY fallback to a bind mount and the rootless ENOENT masking behavior.
this PR fix issue #5258