Skip to content

Commit d497efd

Browse files
Alexey Dobriyangregkh
authored andcommitted
proc: revalidate kernel thread inodes to root:root
[ Upstream commit 2e0ad55 ] 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>
1 parent a206007 commit d497efd

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎fs/proc/base.c‎

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

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

0 commit comments

Comments
 (0)