Title: [8835] trunk/kernel/ptrace.c: ptrace: PTRACE_GETFDPIC: fix the unsafe usage of child->mm
- Revision
- 8835
- Author
- vapier
- Date
- 2010-05-24 00:40:13 -0400 (Mon, 24 May 2010)
Log Message
ptrace: PTRACE_GETFDPIC: fix the unsafe usage of child->mm
From: Oleg Nesterov <[email protected]>
Now that Mike Frysinger unified the FDPIC ptrace code, we can fix
the unsafe usage of child->mm in ptrace_request(PTRACE_GETFDPIC).
We have the reference to task_struct, and ptrace_check_attach()
verified the tracee is stopped. But nothing can protect from
SIGKILL after that, we must not assume child->mm != NULL.
Modified Paths
Diff
Modified: trunk/kernel/ptrace.c (8834 => 8835)
--- trunk/kernel/ptrace.c 2010-05-24 04:39:31 UTC (rev 8834)
+++ trunk/kernel/ptrace.c 2010-05-24 04:40:13 UTC (rev 8835)
@@ -598,18 +598,24 @@
#ifdef CONFIG_BINFMT_ELF_FDPIC
case PTRACE_GETFDPIC: {
+ struct mm_struct *mm = get_task_mm(child);
unsigned long tmp = 0;
+ ret = -ESRCH;
+ if (!mm)
+ break;
+
switch (addr) {
case PTRACE_GETFDPIC_EXEC:
- tmp = child->mm->context.exec_fdpic_loadmap;
+ tmp = mm->context.exec_fdpic_loadmap;
break;
case PTRACE_GETFDPIC_INTERP:
- tmp = child->mm->context.interp_fdpic_loadmap;
+ tmp = mm->context.interp_fdpic_loadmap;
break;
default:
break;
}
+ mmput(mm);
ret = put_user(tmp, (unsigned long __user *) data);
break;
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits