android_kernel_oneplus_msm8998/fs/proc
Andy Lutomirski 96450e0ffd fs/proc: Stop trying to report thread stacks
commit b18cb64ead400c01bf1580eeba330ace51f8087d upstream.

This reverts more of:

  b76437579d ("procfs: mark thread stack correctly in proc/<pid>/maps")

... which was partially reverted by:

  65376df58217 ("proc: revert /proc/<pid>/maps [stack:TID] annotation")

Originally, /proc/PID/task/TID/maps was the same as /proc/TID/maps.

In current kernels, /proc/PID/maps (or /proc/TID/maps even for
threads) shows "[stack]" for VMAs in the mm's stack address range.

In contrast, /proc/PID/task/TID/maps uses KSTK_ESP to guess the
target thread's stack's VMA.  This is racy, probably returns garbage
and, on arches with CONFIG_TASK_INFO_IN_THREAD=y, is also crash-prone:
KSTK_ESP is not safe to use on tasks that aren't known to be running
ordinary process-context kernel code.

This patch removes the difference and just shows "[stack]" for VMAs
in the mm's stack range.  This is IMO much more sensible -- the
actual "stack" address really is treated specially by the VM code,
and the current thread stack isn't even well-defined for programs
that frequently switch stacks on their own.

Reported-by: Jann Horn <jann@thejh.net>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linux API <linux-api@vger.kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tycho Andersen <tycho.andersen@canonical.com>
Link: http://lkml.kernel.org/r/3e678474ec14e0a0ec34c611016753eea2e1b8ba.1475257877.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-08 11:52:00 +02:00
..
array.c ptrace: use fsuid, fsgid, effective creds for fs access checks 2016-02-25 12:01:16 -08:00
base.c proc: add a schedule point in proc_pid_readdir() 2017-06-17 06:39:38 +02:00
cmdline.c
consoles.c
cpuinfo.c
devices.c
fd.c proc: actually make proc_fd_permission() thread-friendly 2015-11-06 17:50:42 -08:00
fd.h
generic.c proc: Fix unbalanced hard link numbers 2017-05-25 14:30:10 +02:00
inode.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2015-07-03 15:20:57 -07:00
internal.h proc: Allow creating permanently empty directories that serve as mount points 2015-07-01 10:36:41 -05:00
interrupts.c
Kconfig fs, proc: add help for CONFIG_PROC_CHILDREN 2015-07-17 16:39:52 -07:00
kcore.c x86/fpu, sched: Introduce CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT and use it on x86 2015-07-18 03:42:51 +02:00
kmsg.c
loadavg.c
Makefile
meminfo.c mm: get rid of 'vmalloc_info' from /proc/meminfo 2015-11-01 17:09:15 -08:00
namespaces.c ptrace: use fsuid, fsgid, effective creds for fs access checks 2016-02-25 12:01:16 -08:00
nommu.c vfs: add seq_file_path() helper 2015-06-23 18:01:07 -04:00
page.c proc: add cond_resched to /proc/kpage* read/write loop 2015-09-10 13:29:01 -07:00
proc_net.c
proc_sysctl.c sysctl: Drop reference added by grab_header in proc_sys_readdir 2017-01-19 20:17:21 +01:00
proc_tty.c tty fix oops when rmmod 8250 2017-12-20 10:05:00 +01:00
root.c proc: prevent stacking filesystems on top 2016-06-24 10:18:20 -07:00
self.c
softirqs.c
stat.c
task_mmu.c fs/proc: Stop trying to report thread stacks 2018-04-08 11:52:00 +02:00
task_nommu.c fs/proc: Stop trying to report thread stacks 2018-04-08 11:52:00 +02:00
thread_self.c
uptime.c
version.c
vmcore.c