aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/cgroup-v2.txt
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2017-01-20 11:29:54 -0500
committerTejun Heo <tj@kernel.org>2017-02-02 13:47:56 -0500
commit576dd464505fc53d501bb94569db76f220104d28 (patch)
treed0338eb91d9d968c33559eda8111f4483ade6eb4 /Documentation/cgroup-v2.txt
parent968ebff1efde6948564308836ecf1ef57de4e106 (diff)
cgroup: drop the matching uid requirement on migration for cgroup v2
Along with the write access to the cgroup.procs or tasks file, cgroup has required the writer's euid, unless root, to match [s]uid of the target process or task. On cgroup v1, this is necessary because there's nothing preventing a delegatee from pulling in tasks or processes from all over the system. If a user has a cgroup subdirectory delegated to it, the user would have write access to the cgroup.procs or tasks file. If there are no further checks than file write access check, the user would be able to pull processes from all over the system into its subhierarchy which is clearly not the intended behavior. The matching [s]uid requirement partially prevents this problem by allowing a delegatee to pull in the processes that belongs to it. This isn't a sufficient protection however, because a user would still be able to jump processes across two disjoint sub-hierarchies that has been delegated to them. cgroup v2 resolves the issue by requiring the writer to have access to the common ancestor of the cgroup.procs file of the source and target cgroups. This confines each delegatee to their own sub-hierarchy proper and bases all permission decisions on the cgroup filesystem rather than having to pull in explicit uid matching. cgroup v2 has still been applying the matching [s]uid requirement just for historical reasons. On cgroup2, the requirement doesn't serve any purpose while unnecessarily complicating the permission model. Let's drop it. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'Documentation/cgroup-v2.txt')
-rw-r--r--Documentation/cgroup-v2.txt12
1 files changed, 5 insertions, 7 deletions
diff --git a/Documentation/cgroup-v2.txt b/Documentation/cgroup-v2.txt
index 227ce4883720..1d101423ca92 100644
--- a/Documentation/cgroup-v2.txt
+++ b/Documentation/cgroup-v2.txt
@@ -332,14 +332,12 @@ a process with a non-root euid to migrate a target process into a
332cgroup by writing its PID to the "cgroup.procs" file, the following 332cgroup by writing its PID to the "cgroup.procs" file, the following
333conditions must be met. 333conditions must be met.
334 334
335- The writer's euid must match either uid or suid of the target process.
336
337- The writer must have write access to the "cgroup.procs" file. 335- The writer must have write access to the "cgroup.procs" file.
338 336
339- The writer must have write access to the "cgroup.procs" file of the 337- The writer must have write access to the "cgroup.procs" file of the
340 common ancestor of the source and destination cgroups. 338 common ancestor of the source and destination cgroups.
341 339
342The above three constraints ensure that while a delegatee may migrate 340The above two constraints ensure that while a delegatee may migrate
343processes around freely in the delegated sub-hierarchy it can't pull 341processes around freely in the delegated sub-hierarchy it can't pull
344in from or push out to outside the sub-hierarchy. 342in from or push out to outside the sub-hierarchy.
345 343
@@ -354,10 +352,10 @@ all processes under C0 and C1 belong to U0.
354 352
355Let's also say U0 wants to write the PID of a process which is 353Let's also say U0 wants to write the PID of a process which is
356currently in C10 into "C00/cgroup.procs". U0 has write access to the 354currently in C10 into "C00/cgroup.procs". U0 has write access to the
357file and uid match on the process; however, the common ancestor of the 355file; however, the common ancestor of the source cgroup C10 and the
358source cgroup C10 and the destination cgroup C00 is above the points 356destination cgroup C00 is above the points of delegation and U0 would
359of delegation and U0 would not have write access to its "cgroup.procs" 357not have write access to its "cgroup.procs" files and thus the write
360files and thus the write will be denied with -EACCES. 358will be denied with -EACCES.
361 359
362 360
3632-6. Guidelines 3612-6. Guidelines