Commit d1a92d2d authored by Chen Ridong's avatar Chen Ridong Committed by Tejun Heo

cgroup: update some statememt about delegation

The comment in cgroup_file_write is missing some interfaces, such as
'cgroup.threads'. All delegatable files are listed in
'/sys/kernel/cgroup/delegate', so update the comment in cgroup_file_write.
Besides, add a statement that files outside the namespace shouldn't be
visible from inside the delegated namespace.

tj: Reflowed text for consistency.
Signed-off-by: default avatarChen Ridong <chenridong@huawei.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 9b103943
...@@ -533,10 +533,12 @@ cgroup namespace on namespace creation. ...@@ -533,10 +533,12 @@ cgroup namespace on namespace creation.
Because the resource control interface files in a given directory Because the resource control interface files in a given directory
control the distribution of the parent's resources, the delegatee control the distribution of the parent's resources, the delegatee
shouldn't be allowed to write to them. For the first method, this is 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 achieved by not granting access to these files. For the second, files
kernel rejects writes to all files other than "cgroup.procs" and outside the namespace should be hidden from the delegatee by the means
"cgroup.subtree_control" on a namespace root from inside the of at least mount namespacing, and the kernel rejects writes to all
namespace. files on a namespace root from inside the cgroup namespace, except for
those files listed in "/sys/kernel/cgroup/delegate" (including
"cgroup.procs", "cgroup.threads", "cgroup.subtree_control", etc.).
The end results are equivalent for both delegation types. Once The end results are equivalent for both delegation types. Once
delegated, the user can build sub-hierarchy under the directory, delegated, the user can build sub-hierarchy under the directory,
......
...@@ -4124,7 +4124,7 @@ static ssize_t cgroup_file_write(struct kernfs_open_file *of, char *buf, ...@@ -4124,7 +4124,7 @@ static ssize_t cgroup_file_write(struct kernfs_open_file *of, char *buf,
* If namespaces are delegation boundaries, disallow writes to * If namespaces are delegation boundaries, disallow writes to
* files in an non-init namespace root from inside the namespace * files in an non-init namespace root from inside the namespace
* except for the files explicitly marked delegatable - * except for the files explicitly marked delegatable -
* cgroup.procs and cgroup.subtree_control. * eg. cgroup.procs, cgroup.threads and cgroup.subtree_control.
*/ */
if ((cgrp->root->flags & CGRP_ROOT_NS_DELEGATE) && if ((cgrp->root->flags & CGRP_ROOT_NS_DELEGATE) &&
!(cft->flags & CFTYPE_NS_DELEGATABLE) && !(cft->flags & CFTYPE_NS_DELEGATABLE) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment