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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200820151659.b7q7hspe5zsf46eg@treble>
Date:   Thu, 20 Aug 2020 10:16:59 -0500
From:   Josh Poimboeuf <jpoimboe@...hat.com>
To:     peterz@...radead.org
Cc:     Brian Gerst <brgerst@...il.com>,
        the arch/x86 maintainers <x86@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Kyle Huey <me@...ehuey.com>,
        Alexandre Chartre <alexandre.chartre@...cle.com>,
        Robert O'Callahan <rocallahan@...il.com>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        Frederic Weisbecker <frederic@...nel.org>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Sean Christopherson <sean.j.christopherson@...el.com>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Petr Mladek <pmladek@...e.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Joel Fernandes <joel@...lfernandes.org>,
        Boris Ostrovsky <boris.ostrovsky@...cle.com>,
        Juergen Gross <jgross@...e.com>,
        Andy Lutomirski <luto@...nel.org>
Subject: Re: [RFC][PATCH 4/7] x86/debug: Move historical SYSENTER junk into
 exc_debug_kernel()

On Thu, Aug 20, 2020 at 05:08:41PM +0200, peterz@...radead.org wrote:
> On Thu, Aug 20, 2020 at 10:45:12AM -0400, Brian Gerst wrote:
> > On Thu, Aug 20, 2020 at 6:53 AM Peter Zijlstra <peterz@...radead.org> wrote:
> > >
> > >
> > > Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> > > ---
> > >  arch/x86/kernel/traps.c |   24 ++++++++++++------------
> > >  1 file changed, 12 insertions(+), 12 deletions(-)
> > >
> > > --- a/arch/x86/kernel/traps.c
> > > +++ b/arch/x86/kernel/traps.c
> > > @@ -820,18 +820,6 @@ static void handle_debug(struct pt_regs
> > >                 goto out;
> > >         }
> > >
> > > -       if (WARN_ON_ONCE((dr6 & DR_STEP) && !user_mode(regs))) {
> > > -               /*
> > > -                * Historical junk that used to handle SYSENTER single-stepping.
> > > -                * This should be unreachable now.  If we survive for a while
> > > -                * without anyone hitting this warning, we'll turn this into
> > > -                * an oops.
> > > -                */
> > > -               tsk->thread.debugreg6 &= ~DR_STEP;
> > > -               set_tsk_thread_flag(tsk, TIF_SINGLESTEP);
> > > -               regs->flags &= ~X86_EFLAGS_TF;
> > > -       }
> > > -
> > >         si_code = get_si_code(tsk->thread.debugreg6);
> > >         if (tsk->thread.debugreg6 & (DR_STEP | DR_TRAP_BITS) || user_icebp)
> > >                 send_sigtrap(regs, 0, si_code);
> > > @@ -874,6 +862,18 @@ static __always_inline void exc_debug_ke
> > >         if (kprobe_debug_handler(regs))
> > >                 goto out;
> > >
> > > +       if (WARN_ON_ONCE(dr6 & DR_STEP)) {
> > > +               /*
> > > +                * Historical junk that used to handle SYSENTER single-stepping.
> > > +                * This should be unreachable now.  If we survive for a while
> > > +                * without anyone hitting this warning, we'll turn this into
> > > +                * an oops.
> > > +                */
> > > +               dr6 &= ~DR_STEP;
> > > +               set_thread_flag(TIF_SINGLESTEP);
> > > +               regs->flags &= ~X86_EFLAGS_TF;
> > > +       }
> > > +
> > >         handle_debug(regs, dr6, false);
> > >
> > >  out:
> > 
> > Can this be removed or changed to a BUG()?  The warning has been there
> > since 2016 and nobody has apparently complained about it.
> 
> Something like:
> 
> 	/*
> 	 * The kernel doesn't do TF outside of Kprobes, so if we get
> 	 * here, something's fishy.
> 	 */
> 	BUG_ON(dr6 & DR_STEP);
> 
> ?

What about kernel debuggers like kgdb and qemu gdb?

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ