summaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2016-11-22 13:06:50 -0500
committerEric W. Biederman <ebiederm@xmission.com>2016-11-22 13:57:38 -0500
commit84d77d3f06e7e8dea057d10e8ec77ad71f721be3 (patch)
tree6efbcfc0877019c2afbdf11596362c8198ebdd0d /arch/blackfin/kernel
parent64b875f7ac8a5d60a4e191479299e931ee949b67 (diff)
ptrace: Don't allow accessing an undumpable mm
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 Cc: stable@vger.kernel.org Reported-by: Andy Lutomirski <luto@amacapital.net> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'arch/blackfin/kernel')
-rw-r--r--arch/blackfin/kernel/ptrace.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c
index 8d79286ee4e8..360d99645163 100644
--- a/arch/blackfin/kernel/ptrace.c
+++ b/arch/blackfin/kernel/ptrace.c
@@ -270,7 +270,7 @@ long arch_ptrace(struct task_struct *child, long request,
270 switch (bfin_mem_access_type(addr, to_copy)) { 270 switch (bfin_mem_access_type(addr, to_copy)) {
271 case BFIN_MEM_ACCESS_CORE: 271 case BFIN_MEM_ACCESS_CORE:
272 case BFIN_MEM_ACCESS_CORE_ONLY: 272 case BFIN_MEM_ACCESS_CORE_ONLY:
273 copied = access_process_vm(child, addr, &tmp, 273 copied = ptrace_access_vm(child, addr, &tmp,
274 to_copy, FOLL_FORCE); 274 to_copy, FOLL_FORCE);
275 if (copied) 275 if (copied)
276 break; 276 break;
@@ -323,7 +323,7 @@ long arch_ptrace(struct task_struct *child, long request,
323 switch (bfin_mem_access_type(addr, to_copy)) { 323 switch (bfin_mem_access_type(addr, to_copy)) {
324 case BFIN_MEM_ACCESS_CORE: 324 case BFIN_MEM_ACCESS_CORE:
325 case BFIN_MEM_ACCESS_CORE_ONLY: 325 case BFIN_MEM_ACCESS_CORE_ONLY:
326 copied = access_process_vm(child, addr, &data, 326 copied = ptrace_access_vm(child, addr, &data,
327 to_copy, 327 to_copy,
328 FOLL_FORCE | FOLL_WRITE); 328 FOLL_FORCE | FOLL_WRITE);
329 break; 329 break;