+ proc-revalidate-kernel-thread-inodes-to-root-root.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: proc: revalidate kernel thread inodes to root:root
has been added to the -mm tree.  Its filename is
     proc-revalidate-kernel-thread-inodes-to-root-root.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/proc-revalidate-kernel-thread-inodes-to-root-root.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/proc-revalidate-kernel-thread-inodes-to-root-root.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Alexey Dobriyan <adobriyan@xxxxxxxxx>
Subject: 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 <adobriyan@xxxxxxxxx>
Cc: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 fs/proc/base.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff -puN fs/proc/base.c~proc-revalidate-kernel-thread-inodes-to-root-root fs/proc/base.c
--- a/fs/proc/base.c~proc-revalidate-kernel-thread-inodes-to-root-root
+++ a/fs/proc/base.c
@@ -1693,6 +1693,12 @@ void task_dump_owner(struct task_struct
 	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);
_

Patches currently in -mm which might be from adobriyan@xxxxxxxxx are

proc-revalidate-misc-dentries.patch
proc-revalidate-kernel-thread-inodes-to-root-root.patch
proc-fix-proc-loadavg-regression.patch
coredump-fix-spam-with-zero-vma-process.patch
seq_file-delete-small-value-optimization.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux