]> git.baikalelectronics.ru Git - kernel.git/commit
cgroup: newly created dirs and files should be owned by the creator
authorTejun Heo <tj@kernel.org>
Mon, 7 Apr 2014 20:44:47 +0000 (16:44 -0400)
committerTejun Heo <tj@kernel.org>
Mon, 7 Apr 2014 20:44:47 +0000 (16:44 -0400)
commite58a6478a7e322b84bf0be42b1ddfc54d594898e
tree853fb807131438d7fb497d9fbc8e09d0c8efe4a8
parent988723cf61a4aec808e53af289fc1cdfd96b6b7a
cgroup: newly created dirs and files should be owned by the creator

While converting cgroup to kernfs, 9ce9b4d718ef ("cgroup: convert to
kernfs") accidentally dropped the logic which makes newly created
cgroup dirs and files owned by the current uid / gid.  This broke
cases where cgroup subtree management is delegated to !root as the sub
manager wouldn't be able to create more than single level of hierarchy
or put tasks into child cgroups it created.

Among other things, this breaks user session management in systemd and
one of the symptoms was 90s hang during shutdown.  User session
systemd running as the user creates a sub-service to initiate shutdown
and tries to put kill(1) into it but fails because cgroup.procs is
owned by root.  This leads to 90s hang during shutdown.

Implement cgroup_kn_set_ugid() which sets a kn's uid and gid to those
of the caller and use it from file and dir creation paths.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/cgroup.c