lkml.org 
[lkml]   [2019]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 6/6] x86/entry/64: Remove TRACE_IRQS_*_DEBUG
On Thu, Jul 11, 2019 at 07:45:56AM -0700, Andy Lutomirski wrote:
> On Thu, Jul 11, 2019 at 4:51 AM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > Since INT3/#BP no longer runs on an IST, this workaround is no longer
> > required.
> >
> > Tested by running lockdep+ftrace as described in the initial commit:
> >
> > 5963e317b1e9 ("ftrace/x86: Do not change stacks in DEBUG when calling lockdep")
> >
> > Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
>
> I would definitely like to see this happen, but there are all kinds of
> possibly nasties here. Ideally we'd like get rid of IST for #DB, but
> we can't due to the MOV SS mess. There are a few relevant cases we
> care about:
>
> #DB from user mode -> anything that hits in C code: irrelevant --
> we've exited the IST stack already.
>
> #DB from user mode -> NMI/MCE in the asm -> #DB: The NMI code tries to
> get this right. The MCE code does not.
>
> #DB from kernel mode -> NMI/MCE -> #DB: same as above.
>
> MOV SS -> #DB from entry -> #DB again: ugh. We get some protection
> from shift_ist.
>
> IMO we would ideally just clear DR7 in sensitive contexts. Or extend
> the debug_stack_set_zero(), etc hack.
>
> All that being said, the actual _DEBUG macros shouldn't matter here, I
> think. But I'd like to sleep on it. So not-yet-acked-by me.

How about something lovely like:

#DB from kernel space; in say lockdep.
the #DB entry calls back into lockdep through trace_irq
which then hits the same #DB

and we get recursive #DB.

Now, I don't think we can actually make that happen, because most/all
the relevant functions have NOKPROBE_SYMBOL() on. Even the idtentry
generates _ASM_NOKPROBE().

Still, it might make sense to have #DB itself clear/restore DR7 if it
doesn't already.

Also, the comment on do_debug() seems wrong; we can set watchpoints on
kernel text just fine these days.

\
 
 \ /
  Last update: 2019-07-11 20:28    [W:0.037 / U:48.224 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site