android_kernel_oneplus_msm8998/fs/proc
Janis Danisevskis b8c71ce9e0 procfs: fix pthread cross-thread naming if !PR_DUMPABLE
commit 1b3044e39a89cb1d4d5313da477e8dfea2b5232d upstream.

The PR_DUMPABLE flag causes the pid related paths of the proc file
system to be owned by ROOT.

The implementation of pthread_set/getname_np however needs access to
/proc/<pid>/task/<tid>/comm.  If PR_DUMPABLE is false this
implementation is locked out.

This patch installs a special permission function for the file "comm"
that grants read and write access to all threads of the same group
regardless of the ownership of the inode.  For all other threads the
function falls back to the generic inode permission check.

[akpm@linux-foundation.org: fix spello in comment]
Signed-off-by: Janis Danisevskis <jdanis@google.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Minfei Huang <mnfhuang@gmail.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Calvin Owens <calvinowens@fb.com>
Cc: Jann Horn <jann@thejh.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-26 08:48:55 +02:00
..
array.c ptrace: use fsuid, fsgid, effective creds for fs access checks 2016-02-25 12:01:16 -08:00
base.c procfs: fix pthread cross-thread naming if !PR_DUMPABLE 2018-05-26 08:48:55 +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 proc: meminfo: estimate available memory more conservatively 2018-05-26 08:48:54 +02: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 VFS: normal filesystems (and lustre): d_inode() annotations 2015-04-15 15:06:57 -04:00
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 don't pass nameidata to ->follow_link() 2015-05-10 22:20:15 -04:00
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 don't pass nameidata to ->follow_link() 2015-05-10 22:20:15 -04:00
uptime.c
version.c
vmcore.c