diff options
| author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-03-25 09:51:51 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2010-03-26 06:33:57 -0400 |
| commit | ea8e61b7bbc4a2faef77db34eb2db2a2c2372ff6 (patch) | |
| tree | df2998225dc10245ce3d392576a724ab788e456c /arch/x86/kernel/kprobes.c | |
| parent | faa4602e47690fb11221e00f9b9697c8dc0d4b19 (diff) | |
x86, ptrace: Fix block-step
Implement ptrace-block-step using TIF_BLOCKSTEP which will set
DEBUGCTLMSR_BTF when set for a task while preserving any other
DEBUGCTLMSR bits.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20100325135414.017536066@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/kprobes.c')
| -rw-r--r-- | arch/x86/kernel/kprobes.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c index 7a880ad3a208..f2f56c0967b6 100644 --- a/arch/x86/kernel/kprobes.c +++ b/arch/x86/kernel/kprobes.c | |||
| @@ -422,12 +422,22 @@ static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs, | |||
| 422 | 422 | ||
| 423 | static void __kprobes clear_btf(void) | 423 | static void __kprobes clear_btf(void) |
| 424 | { | 424 | { |
| 425 | /* XXX */ | 425 | if (test_thread_flag(TIF_BLOCKSTEP)) { |
| 426 | unsigned long debugctl = get_debugctlmsr(); | ||
| 427 | |||
| 428 | debugctl &= ~DEBUGCTLMSR_BTF; | ||
| 429 | update_debugctlmsr(debugctl); | ||
| 430 | } | ||
| 426 | } | 431 | } |
| 427 | 432 | ||
| 428 | static void __kprobes restore_btf(void) | 433 | static void __kprobes restore_btf(void) |
| 429 | { | 434 | { |
| 430 | /* XXX */ | 435 | if (test_thread_flag(TIF_BLOCKSTEP)) { |
| 436 | unsigned long debugctl = get_debugctlmsr(); | ||
| 437 | |||
| 438 | debugctl |= DEBUGCTLMSR_BTF; | ||
| 439 | update_debugctlmsr(debugctl); | ||
| 440 | } | ||
| 431 | } | 441 | } |
| 432 | 442 | ||
| 433 | void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, | 443 | void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, |
