mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-07 11:28:32 +00:00
proc: revalidate kernel thread inodes to root:root
[ Upstream commit 2e0ad552f5
]
task_dump_owner() has the following code:
mm = task->mm;
if (mm) {
if (get_dumpable(mm) != SUID_DUMP_USER) {
uid = ...
}
}
Check for ->mm is buggy -- kernel thread might be borrowing mm
and inode will go to some random uid:gid pair.
Link: http://lkml.kernel.org/r/20180412220109.GA20978@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a206007623
commit
d497efd805
1 changed files with 6 additions and 0 deletions
|
@ -1694,6 +1694,12 @@ void task_dump_owner(struct task_struct *task, mode_t mode,
|
|||
kuid_t uid;
|
||||
kgid_t gid;
|
||||
|
||||
if (unlikely(task->flags & PF_KTHREAD)) {
|
||||
*ruid = GLOBAL_ROOT_UID;
|
||||
*rgid = GLOBAL_ROOT_GID;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Default to the tasks effective ownership */
|
||||
rcu_read_lock();
|
||||
cred = __task_cred(task);
|
||||
|
|
Loading…
Reference in a new issue