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] [day] [month] [year] [list]
Date:   Mon, 20 Jan 2020 16:00:58 -0800
From:   "Paul E. McKenney" <paulmck@...nel.org>
To:     Joel Fernandes <joel@...lfernandes.org>
Cc:     Amol Grover <frextrite@...il.com>,
        Josh Triplett <josh@...htriplett.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
        Lai Jiangshan <jiangshanlai@...il.com>, rcu@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        linux-kernel-mentees@...ts.linuxfoundation.org,
        Madhuparna Bhowmik <madhuparnabhowmik04@...il.com>
Subject: Re: [PATCH] rculist: Add brackets around cond argument in
 __list_check_rcu macro

On Sat, Jan 18, 2020 at 09:14:25PM -0500, Joel Fernandes wrote:
> On Sat, Jan 18, 2020 at 10:24:18PM +0530, Amol Grover wrote:
> > Passing a complex lockdep condition to __list_check_rcu results
> > in false positive lockdep splat due to incorrect expression
> > evaluation.
> > 
> > For example, a lockdep check condition `cond1 || cond2` is
> > evaluated as `!cond1 || cond2 && !rcu_read_lock_any_held()`
> > which, according to operator precedence, evaluates to
> > `!cond1 || (cond2 && !rcu_read_lock_any_held())`.
> > This would result in a lockdep splat when cond1 is false
> > and cond2 is true which is logically incorrect.
> > 
> > Signed-off-by: Amol Grover <frextrite@...il.com>
> 
> Good catch!
> 
> Acked-by: Joel Fernandes (Google) <joel@...lfernandes.org>

Queued for v5.7, thank you both!

							Thanx, Paul

> thanks,
> 
>  - Joel
> 
> 
> > ---
> >  include/linux/rculist.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/linux/rculist.h b/include/linux/rculist.h
> > index 4158b7212936..dce491f0b354 100644
> > --- a/include/linux/rculist.h
> > +++ b/include/linux/rculist.h
> > @@ -50,9 +50,9 @@ static inline void INIT_LIST_HEAD_RCU(struct list_head *list)
> >  #define __list_check_rcu(dummy, cond, extra...)				\
> >  	({								\
> >  	check_arg_count_one(extra);					\
> > -	RCU_LOCKDEP_WARN(!cond && !rcu_read_lock_any_held(),		\
> > +	RCU_LOCKDEP_WARN(!(cond) && !rcu_read_lock_any_held(),		\
> >  			 "RCU-list traversed in non-reader section!");	\
> > -	 })
> > +	})
> >  #else
> >  #define __list_check_rcu(dummy, cond, extra...)				\
> >  	({ check_arg_count_one(extra); })
> > -- 
> > 2.24.1
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ