diff options
Diffstat (limited to 'arch/x86/kernel/kprobes.c')
| -rw-r--r-- | arch/x86/kernel/kprobes.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c index b43bbaebe2c0..f2f56c0967b6 100644 --- a/arch/x86/kernel/kprobes.c +++ b/arch/x86/kernel/kprobes.c | |||
| @@ -422,14 +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 | if (test_thread_flag(TIF_DEBUGCTLMSR)) | 425 | if (test_thread_flag(TIF_BLOCKSTEP)) { |
| 426 | update_debugctlmsr(0); | 426 | unsigned long debugctl = get_debugctlmsr(); |
| 427 | |||
| 428 | debugctl &= ~DEBUGCTLMSR_BTF; | ||
| 429 | update_debugctlmsr(debugctl); | ||
| 430 | } | ||
| 427 | } | 431 | } |
| 428 | 432 | ||
| 429 | static void __kprobes restore_btf(void) | 433 | static void __kprobes restore_btf(void) |
| 430 | { | 434 | { |
| 431 | if (test_thread_flag(TIF_DEBUGCTLMSR)) | 435 | if (test_thread_flag(TIF_BLOCKSTEP)) { |
| 432 | update_debugctlmsr(current->thread.debugctlmsr); | 436 | unsigned long debugctl = get_debugctlmsr(); |
| 437 | |||
| 438 | debugctl |= DEBUGCTLMSR_BTF; | ||
| 439 | update_debugctlmsr(debugctl); | ||
| 440 | } | ||
| 433 | } | 441 | } |
| 434 | 442 | ||
| 435 | void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, | 443 | void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, |
