[PATCH -next 1/2] cgroup: update comment about delegation

Chen Ridong posted 2 patches 1 year, 6 months ago
[PATCH -next 1/2] cgroup: update comment about delegation
Posted by Chen Ridong 1 year, 6 months ago
There are three interfaces that delegatee was not allowed to write.
However, cgroup.threads was missed at some place, just add it.

Signed-off-by: Chen Ridong <chenridong@huawei.com>
---
 Documentation/admin-guide/cgroup-v2.rst | 6 +++---
 kernel/cgroup/cgroup.c                  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst
index f2d1ec7d6aba..513fd142293c 100644
--- a/Documentation/admin-guide/cgroup-v2.rst
+++ b/Documentation/admin-guide/cgroup-v2.rst
@@ -534,9 +534,9 @@ Because the resource control interface files in a given directory
 control the distribution of the parent's resources, the delegatee
 shouldn't be allowed to write to them.  For the first method, this is
 achieved by not granting access to these files.  For the second, the
-kernel rejects writes to all files other than "cgroup.procs" and
-"cgroup.subtree_control" on a namespace root from inside the
-namespace.
+kernel rejects writes to all files other than "cgroup.procs",
+"cgroup.threads" and "cgroup.subtree_control" on a namespace
+root from inside the namespace.
 
 The end results are equivalent for both delegation types.  Once
 delegated, the user can build sub-hierarchy under the directory,
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index a3fa645f8433..8dbe00000fd4 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -4131,7 +4131,7 @@ static ssize_t cgroup_file_write(struct kernfs_open_file *of, char *buf,
 	 * If namespaces are delegation boundaries, disallow writes to
 	 * files in an non-init namespace root from inside the namespace
 	 * except for the files explicitly marked delegatable -
-	 * cgroup.procs and cgroup.subtree_control.
+	 * cgroup.procs, cgroup.threads and cgroup.subtree_control.
 	 */
 	if ((cgrp->root->flags & CGRP_ROOT_NS_DELEGATE) &&
 	    !(cft->flags & CFTYPE_NS_DELEGATABLE) &&
-- 
2.34.1
Re: [PATCH -next 1/2] cgroup: update comment about delegation
Posted by Michal Koutný 1 year, 6 months ago
On Mon, Aug 12, 2024 at 07:37:45AM GMT, Chen Ridong <chenridong@huawei.com> wrote:
> There are three interfaces that delegatee was not allowed to write.

Actually, the right way is to query
/sys/kernel/cgroup/delegate

> However, cgroup.threads was missed at some place, just add it.

When you're at it, could you change the docs to refer to the generic
definition of set set of delegatable files where it makes sense.

Thanks,
Michal