Skip to content

Conversation

@xujihui1985
Copy link

the cgroup2 mount in __cg_mount_direct() previously ignored the superblock options applied on the existing cgroup2 mountpoint. This caused the newly created cgroup2 mount to miss important options such as nsdelegate, memory_localevents, and memory_recursiveprot, which may affect controller behavior and result in inconsistent semantics across mount points.

This patch introduces extract_cgroup2_super_opts() to locate the first relevant cgroup2 superblock option in the existing mount options string, and get_mount_opts() to retrieve the mount options for a given target and filesystem type from /proc/self/mounts. These helpers allow the new mount to inherit the same superblock configuration as the system's primary cgroup2 mount.

he cgroup2 mount in __cg_mount_direct() previously ignored the
superblock options applied on the existing cgroup2 mountpoint. This
caused the newly created cgroup2 mount to miss important options such as
nsdelegate, memory_localevents, and memory_recursiveprot, which may
affect controller behavior and result in inconsistent semantics across
mount points.

This patch introduces extract_cgroup2_super_opts() to locate the first
relevant cgroup2 superblock option in the existing mount options string,
and get_mount_opts() to retrieve the mount options for a given target
and filesystem type from /proc/self/mounts. These helpers allow the new
mount to inherit the same superblock configuration as the system's
primary cgroup2 mount.

Signed-off-by: xujihui1985 <[email protected]>
@stgraber stgraber requested a review from mihalicyn November 18, 2025 05:14
@stgraber
Copy link
Member

@mihalicyn can you take a look please?

@xujihui1985
Copy link
Author

xujihui1985 commented Nov 19, 2025

Hi @stgraber and @mihalicyn,
I was wondering if we could simply bind-mount the cgroupfs into the cgroup controller path. instread of mount again and pick the mount options from cgroupfs, since mount options like nsdelegate and memory_recursiveprot are global under the initial cgroup namespace, even in the separate mountns, so if we mount with a different options, that actually change the options on the root cgroupfs

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.

2 participants