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]
Message-ID: <1544199824.185366.304.camel@acm.org>
Date:   Fri, 07 Dec 2018 08:23:44 -0800
From:   Bart Van Assche <bvanassche@....org>
To:     Waiman Long <longman@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>
Cc:     mingo@...hat.com, tj@...nel.org, johannes.berg@...el.com,
        linux-kernel@...r.kernel.org,
        Johannes Berg <johannes@...solutions.net>
Subject: Re: [PATCH v3 16/24] locking/lockdep: Retain the class key and name
 while freeing a lock class

On Fri, 2018-12-07 at 09:50 -0500, Waiman Long wrote:
> On 12/07/2018 05:21 AM, Peter Zijlstra wrote:
> > On Thu, Dec 06, 2018 at 05:11:40PM -0800, Bart Van Assche wrote:
> > > The next patch in this series uses the class name in code that
> > > detects calls to lock_acquire() while a class key is being freed. Hence
> > > retain the class name for lock classes that are being freed.
> > 
> > From readin the discussion with v2; you meant to say: 'uses the class
> > name pointer', right? You're not actually ever going to dereference it,
> > since that would be a UaF.
> > 
> > > Cc: Peter Zijlstra <peterz@...radead.org>
> > > Cc: Waiman Long <longman@...hat.com>
> > > Cc: Johannes Berg <johannes@...solutions.net>
> > > Signed-off-by: Bart Van Assche <bvanassche@....org>
> > > ---
> > >  kernel/locking/lockdep.c | 4 +---
> > >  1 file changed, 1 insertion(+), 3 deletions(-)
> > > 
> > > diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> > > index ecd92969674c..92bdb187987f 100644
> > > --- a/kernel/locking/lockdep.c
> > > +++ b/kernel/locking/lockdep.c
> > > @@ -4147,10 +4147,8 @@ static void zap_class(struct lock_class *class)
> > >  	 * Unhash the class and remove it from the all_lock_classes list:
> > >  	 */
> > >  	hlist_del_rcu(&class->hash_entry);
> > > +	class->hash_entry.pprev = NULL;
> > >  	list_del(&class->lock_entry);
> > > -
> > > -	RCU_INIT_POINTER(class->key, NULL);
> > > -	RCU_INIT_POINTER(class->name, NULL);
> > >  }
> > >  
> > >  static inline int within(const void *addr, void *start, unsigned long size)
> > > -- 
> > > 2.20.0.rc2.403.gdbc3b29805-goog
> > > 
> 
> I still prefer keeping the clearing statements. Leaving key behind
> should be OK as it is just a long value to be compared against. The
> variable name is a different story as it is a pointer that will
> reference bytes that it points to unless you save the name in a safe
> storage area and change the pointer to point there.

I will drop this patch and update later patches accordingly.

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ