Skip to content

Commit 2e0ad55

Browse files
Alexey Dobriyantorvalds
authored andcommitted
proc: revalidate kernel thread inodes to root:root
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 <[email protected]> Cc: "Eric W. Biederman" <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 1e63066 commit 2e0ad55

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/proc/base.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,6 +1693,12 @@ void task_dump_owner(struct task_struct *task, umode_t mode,
16931693
kuid_t uid;
16941694
kgid_t gid;
16951695

1696+
if (unlikely(task->flags & PF_KTHREAD)) {
1697+
*ruid = GLOBAL_ROOT_UID;
1698+
*rgid = GLOBAL_ROOT_GID;
1699+
return;
1700+
}
1701+
16961702
/* Default to the tasks effective ownership */
16971703
rcu_read_lock();
16981704
cred = __task_cred(task);

0 commit comments

Comments
 (0)