diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-03-25 14:51:51 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-26 11:33:57 +0100 |
commit | ea8e61b7bbc4a2faef77db34eb2db2a2c2372ff6 (patch) | |
tree | df2998225dc10245ce3d392576a724ab788e456c /arch/x86/kernel/kprobes.c | |
parent | faa4602e47690fb11221e00f9b9697c8dc0d4b19 (diff) | |
download | blackbird-op-linux-ea8e61b7bbc4a2faef77db34eb2db2a2c2372ff6.tar.gz blackbird-op-linux-ea8e61b7bbc4a2faef77db34eb2db2a2c2372ff6.zip |
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, static void __kprobes clear_btf(void) { - /* XXX */ + if (test_thread_flag(TIF_BLOCKSTEP)) { + unsigned long debugctl = get_debugctlmsr(); + + debugctl &= ~DEBUGCTLMSR_BTF; + update_debugctlmsr(debugctl); + } } static void __kprobes restore_btf(void) { - /* XXX */ + if (test_thread_flag(TIF_BLOCKSTEP)) { + unsigned long debugctl = get_debugctlmsr(); + + debugctl |= DEBUGCTLMSR_BTF; + update_debugctlmsr(debugctl); + } } void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, |