Skip to content

cgroups/cgfsng: do not change host-wide cgroup2 superblock options#703

Merged
stgraber merged 2 commits into
lxc:mainfrom
mihalicyn:fix/cgroup_v2_mount_options
Feb 20, 2026
Merged

cgroups/cgfsng: do not change host-wide cgroup2 superblock options#703
stgraber merged 2 commits into
lxc:mainfrom
mihalicyn:fix/cgroup_v2_mount_options

Conversation

@mihalicyn

@mihalicyn mihalicyn commented Feb 20, 2026

Copy link
Copy Markdown
Member

Reworked version of #692

Signed-off-by: Xu Jihui <xujihui1985@gmail.com>
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io>
Currently, when LXCFS daemon starts it creates an isolated mount
namespace and mounts its own cgroup2 mount. The problem is that
cgroup2 implementation in the kernel has a catch. cgroup2-fs
superblock-level mount options can be changed if privileged
user in init_cgroup_ns mounts a new cgroup2 mount and specifies
superblock options different from ones specified earlier.

See:
https://github.com/torvalds/linux/blob/18f7fcd5e69a04df57b563360b88be72471d6b62/kernel/cgroup/cgroup.c#L2047

Fixes: lxc#681
Reported-by: Emir Buljubašić <emirbuljubasic329@gmail.com>
Signed-off-by: Xu Jihui <xujihui1985@gmail.com>
[ alex: significant modifications and refactoring ]
Co-authored-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io>
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io>
@mihalicyn mihalicyn force-pushed the fix/cgroup_v2_mount_options branch 2 times, most recently from 4ca06be to b7efa05 Compare February 20, 2026 13:44
@mihalicyn

Copy link
Copy Markdown
Member Author

Tests / Upgrade test (gcc, fuse3, ubuntu-24.04, main) (pull_request) failure is unrelated. We can ignore it here. I'll address this in a separate PR.

@mihalicyn mihalicyn requested a review from stgraber February 20, 2026 13:46
@stgraber stgraber merged commit ada20e1 into lxc:main Feb 20, 2026
38 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants