]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit - kernel/sys.c
rlimit: Properly call security_task_setrlimit
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 12 Apr 2017 22:22:14 +0000 (17:22 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Fri, 21 Apr 2017 21:08:19 +0000 (16:08 -0500)
commitcad4ea546b1a8a700d269e41ac5db182057d7a32
treeb11a5259d2b25b2f30c942bce0dd9900a1c7cff1
parentd27158c0cf080c85753f34e7a20a91c3ba20a0b9
rlimit: Properly call security_task_setrlimit

Modify do_prlimit to call security_task_setrlimit passing the task
whose rlimit we are changing not the tsk->group_leader.

In general this should not matter as the lsms implementing
security_task_setrlimit apparmor and selinux both examine the
task->cred to see what should be allowed on the destination task.

That task->cred is shared between tasks created with CLONE_THREAD
unless thread keyrings are in play, in which case both apparmor and
selinux create duplicate security contexts.

So the only time when it will matter which thread is passed to
security_task_setrlimit is if one of the threads of a process performs
an operation that changes only it's credentials.  At which point if a
thread has done that we don't want to hide that information from the
lsms.

So fix the call of security_task_setrlimit.  With the removal
of tsk->group_leader this makes the code slightly faster,
more comprehensible and maintainable.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
kernel/sys.c