lkml.org 
[lkml]   [2020]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/3] x86/debug: Fix BTF handling
On Tue, Oct 27, 2020 at 10:15:05AM +0100, Peter Zijlstra wrote:

> @@ -873,6 +866,20 @@ static __always_inline void exc_debug_ke
> */
> WARN_ON_ONCE(user_mode(regs));
>
> + if (test_thread_flag(TIF_BLOCKSTEP)) {
> + /*
> + * The SDM says "The processor clears the BTF flag when it
> + * generates a debug exception." but PTRACE_BLOCKSTEP requested
> + * it for userspace, but we just took a kernel #DB, so re-set
> + * BTF.
> + */
> + unsigned long debugctl;
> +
> + rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctl);
> + debugctl |= DEBUGCTLMSR_BTF;
> + wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctl);
> + }
> +
> /*
> * Catch SYSENTER with TF set and clear DR_STEP. If this hit a
> * watchpoint at the same time then that will still be handled.

Masami, how does BTF interact with !optimized kprobes that single-step?

The best answer I can come up with is 'poorly' :/

\
 
 \ /
  Last update: 2020-10-27 20:43    [W:2.012 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site