OpenCloudOS-Kernel/kernel/cgroup
Tejun Heo 3467822a34 cgroup: Use open-time credentials for process migraton perm checks
commit 1756d7994a upstream

cgroup process migration permission checks are performed at write time as
whether a given operation is allowed or not is dependent on the content of
the write - the PID. This currently uses current's credentials which is a
potential security weakness as it may allow scenarios where a less
privileged process tricks a more privileged one into writing into a fd that
it created.

This patch makes both cgroup2 and cgroup1 process migration interfaces to
use the credentials saved at the time of open (file->f_cred) instead of
current's.

Reported-by: "Eric W. Biederman" <ebiederm@xmission.com>
Suggested-by: Linus Torvalds <torvalds@linuxfoundation.org>
Fixes: 187fe84067 ("cgroup: require write perm on common ancestor when moving processes on the default hierarchy")
Reviewed-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Singed-off-by: Alex Shi <alexsshi@tencent.com>

Conflicts:
	kernel/cgroup/cgroup.c
2024-06-11 20:41:13 +08:00
..
Makefile ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
cgroup-internal.h ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
cgroup-v1.c cgroup: Use open-time credentials for process migraton perm checks 2024-06-11 20:41:13 +08:00
cgroup.c cgroup: Use open-time credentials for process migraton perm checks 2024-06-11 20:41:13 +08:00
cpuset.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
debug.c kernel: cgroup: fix misuse of %x 2019-05-06 08:47:48 -07:00
freezer.c tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00
legacy_freezer.c cgroup: rename freezer.c into legacy_freezer.c 2019-04-19 11:26:48 -07:00
mbuf.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
namespace.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pids.c tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00
rdma.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 451 2019-06-19 17:09:08 +02:00
rstat.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
sli.c ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00