lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 11 Jul 2019 20:28:02 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Andy Lutomirski <luto@...nel.org>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Borislav Petkov <bp@...en8.de>, Ingo Molnar <mingo@...nel.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        "H. Peter Anvin" <hpa@...or.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Juergen Gross <jgross@...e.com>,
        LKML <linux-kernel@...r.kernel.org>,
        He Zhe <zhe.he@...driver.com>,
        Joel Fernandes <joel@...lfernandes.org>, devel@...ukata.com
Subject: Re: [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@...radead.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@...dmis.org>
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ