android_kernel_oneplus_msm8998/fs/proc
Willy Tarreau adc143b97d proc: do not access cmdline nor environ from file-backed areas
commit 7f7ccc2ccc2e70c6054685f5e3522efa81556830 upstream.

proc_pid_cmdline_read() and environ_read() directly access the target
process' VM to retrieve the command line and environment. If this
process remaps these areas onto a file via mmap(), the requesting
process may experience various issues such as extra delays if the
underlying device is slow to respond.

Let's simply refuse to access file-backed areas in these functions.
For this we add a new FOLL_ANON gup flag that is passed to all calls
to access_remote_vm(). The code already takes care of such failures
(including unmapped areas). Accesses via /proc/pid/mem were not
changed though.

This was assigned CVE-2018-1120.

Note for stable backports: the patch may apply to kernels prior to 4.11
but silently miss one location; it must be checked that no call to
access_remote_vm() keeps zero as the last argument.

Reported-by: Qualys Security Advisory <qsa@qualys.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[bwh: Backported to 4.4:
 - Update the extra call to access_remote_vm() from proc_pid_cmdline_read()
 - Adjust context]
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 21:55:17 +01:00
..
array.c proc: Use underscores for SSBD in 'status' 2018-07-25 10:18:28 +02:00
base.c proc: do not access cmdline nor environ from file-backed areas 2018-12-17 21:55:17 +01:00
cmdline.c
consoles.c
cpuinfo.c
devices.c
fd.c
fd.h
generic.c proc: Fix unbalanced hard link numbers 2017-05-25 14:30:10 +02:00
inode.c
internal.h
interrupts.c
Kconfig
kcore.c
kmsg.c
loadavg.c
Makefile
meminfo.c proc: meminfo: estimate available memory more conservatively 2018-05-26 08:48:54 +02:00
namespaces.c
nommu.c
page.c
proc_net.c
proc_sysctl.c fs/proc/proc_sysctl.c: fix potential page fault while unregistering sysctl table 2018-05-30 07:49:07 +02:00
proc_tty.c tty fix oops when rmmod 8250 2017-12-20 10:05:00 +01:00
root.c
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