linux/arch/cris
Eric W. Biederman aa3fbddbb8 ptrace: Don't allow accessing an undumpable mm
commit 84d77d3f06 upstream.

It is the reasonable expectation that if an executable file is not
readable there will be no way for a user without special privileges to
read the file.  This is enforced in ptrace_attach but if ptrace
is already attached before exec there is no enforcement for read-only
executables.

As the only way to read such an mm is through access_process_vm
spin a variant called ptrace_access_vm that will fail if the
target process is not being ptraced by the current process, or
the current process did not have sufficient privileges when ptracing
began to read the target processes mm.

In the ptrace implementations replace access_process_vm by
ptrace_access_vm.  There remain several ptrace sites that still use
access_process_vm as they are reading the target executables
instructions (for kernel consumption) or register stacks.  As such it
does not appear necessary to add a permission check to those calls.

This bug has always existed in Linux.

Fixes: v1.0
Reported-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
[bwh: Backported to 3.16:
 - Pass around only a write flag, not gup_flags
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2018-01-01 20:52:11 +00:00
..
arch-v10 cris: update comments for generic idle conversion 2014-06-06 16:08:18 -07:00
arch-v32 ptrace: Don't allow accessing an undumpable mm 2018-01-01 20:52:11 +00:00
boot cris: Only build flash rescue image if CONFIG_ETRAX_AXISFLASHMAP is selected 2017-03-16 02:26:18 +00:00
configs kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT 2011-01-20 17:02:05 -08:00
include cris: buggered copy_from_user/copy_to_user/clear_user 2016-11-20 01:17:27 +00:00
kernel cris: cpuinfo_op should depend on CONFIG_PROC_FS 2014-04-07 16:36:09 -07:00
mm vm: add VM_FAULT_SIGSEGV handling support 2015-02-04 10:58:27 +00:00
Kconfig Kconfig: rename HAS_IOPORT to HAS_IOPORT_MAP 2014-04-07 16:36:11 -07:00
Kconfig.debug Kconfig: remove a few puzzling comments 2011-10-31 10:58:48 +01:00
Makefile UAPI: Partition the header include path sets and add uapi/ header directories 2012-10-02 18:01:26 +01:00