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]
Date:   Fri, 12 May 2017 16:05:32 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc:     linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...nel.org>,
        Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
        Masami Hiramatsu <mhiramat@...nel.org>
Subject: Re: [RFC][PATCH 1/5] tracing: Make sure RCU is watching before
 calling a stack trace

On Fri, 12 May 2017 11:50:03 -0700
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com> wrote:

> On Fri, May 12, 2017 at 02:36:19PM -0400, Steven Rostedt wrote:
> > On Fri, 12 May 2017 11:25:35 -0700
> > "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com> wrote:
> >   
> > > On Fri, May 12, 2017 at 01:15:45PM -0400, Steven Rostedt wrote:  
> > > > From: "Steven Rostedt (VMware)" <rostedt@...dmis.org>
> > > > 
> > > > As stack tracing now requires "rcu watching", force RCU to be watching when
> > > > recording a stack trace.
> > > > 
> > > > Signed-off-by: Steven Rostedt (VMware) <rostedt@...dmis.org>    
> > > 
> > > Assuming that you never get to __trace_stack() if in an NMI handler,
> > > this looks good to me!
> > > 
> > > In contrast, if if __trace_stack() ever is called from an NMI handler,
> > > invoking rcu_irq_enter() can be fatal.  
> > 
> > Then someone may die.
> > 
> > OK, what's the case of running this in nmi? How does perf do it?  
> 
> I have no idea.  If it cannot happen, then it cannot happen and all
> is well, RCU is happy, and I am happy.  ;-)
> 
> > Do we just skip the check if it is in an nmi?
> > 
> > 	if (!in_nmi()) {
> > 		if (unlikely(rcu_irq_enter_disabled()))
> > 			return;
> > 		rcu_irq_enter();
> > 	}
> > 
> > 	__ftrace_trace_stack();
> > 
> > 	if (!in_nmi())
> > 		rcu_irq_exit();
> > 
> > ?  
> 
> If it -can- happen, bail out of the function without doing the

Why?

> __ftrace_trace_stack()?  Or does that just cause other problems further
> down the road?  Or BUG_ON(in_nmi())?

Why?

> 
> But again if it cannot happen, no problem and no need for extra code.
> 

We can't call stack trace from nmi anymore? It calls rcu_read_lock()
which is why we need to make sure rcu is watching, otherwise lockdep
complains.

-- Steve

Powered by blists - more mailing lists