]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
hw-breakpoints: Modify breakpoints without unregistering them
authorFrederic Weisbecker <fweisbec@gmail.com>
Wed, 9 Dec 2009 08:25:48 +0000 (09:25 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 9 Dec 2009 08:48:20 +0000 (09:48 +0100)
commit44234adcdce38f83c56e05f808ce656175b4beeb
treecaff2ca7bbf4bf7c0b12652caf739bcc6db5f4d3
parentc937fe20cb6d9e24c6ad5f9f0c64d64c78411057
hw-breakpoints: Modify breakpoints without unregistering them

Currently, when ptrace needs to modify a breakpoint, like disabling
it, changing its address, type or len, it calls
modify_user_hw_breakpoint(). This latter will perform the heavy and
racy task of unregistering the old breakpoint and registering a new
one.

This is racy as someone else might steal the reserved breakpoint
slot under us, which is undesired as the breakpoint is only
supposed to be modified, sometimes in the middle of a debugging
workflow. We don't want our slot to be stolen in the middle.

So instead of unregistering/registering the breakpoint, just
disable it while we modify its breakpoint fields and re-enable it
after if necessary.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Prasad <prasad@linux.vnet.ibm.com>
LKML-Reference: <1260347148-5519-1-git-send-regression-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/ptrace.c
include/linux/hw_breakpoint.h
include/linux/perf_event.h
kernel/hw_breakpoint.c
kernel/perf_event.c