Skip to content

Commit 07fa7a0

Browse files
committed
powerpc, hw_breakpoints: Fix racy access to ptrace breakpoints
While the tracer accesses ptrace breakpoints, the child task may concurrently exit due to a SIGKILL and thus release its breakpoints at the same time. We can then dereference some freed pointers. To fix this, hold a reference on the child breakpoints before manipulating them. Reported-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Acked-by: Prasad <prasad@linux.vnet.ibm.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Will Deacon <will.deacon@arm.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: v2.6.33.. <stable@kernel.org> Link: http://lkml.kernel.org/r/1302284067-7860-4-git-send-email-fweisbec@gmail.com
1 parent 87dc669 commit 07fa7a0

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎arch/powerpc/kernel/ptrace.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,10 @@ long arch_ptrace(struct task_struct *child, long request,
15911591
}
15921592

15931593
case PTRACE_SET_DEBUGREG:
1594+
if (ptrace_get_breakpoints(child) < 0)
1595+
return -ESRCH;
15941596
ret = ptrace_set_debugreg(child, addr, data);
1597+
ptrace_put_breakpoints(child);
15951598
break;
15961599

15971600
#ifdef CONFIG_PPC64

0 commit comments

Comments
 (0)