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, 07 Dec 2018 08:27:32 -0800
From:   Bart Van Assche <bvanassche@....org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     mingo@...hat.com, tj@...nel.org, longman@...hat.com,
        johannes.berg@...el.com, linux-kernel@...r.kernel.org,
        Johannes Berg <johannes@...solutions.net>
Subject: Re: [PATCH v3 17/24] locking/lockdep: Free lock classes that are no
 longer in use

On Fri, 2018-12-07 at 13:14 +0100, Peter Zijlstra wrote:
> On Thu, Dec 06, 2018 at 05:11:41PM -0800, Bart Van Assche wrote:
> > +	if (WARN_ON_ONCE(!hlock_class(prev)->hash_entry.pprev) ||
> > +	    WARN_ONCE(!hlock_class(next)->hash_entry.pprev,
> > +		      KERN_INFO "Detected use-after-free of lock class %s\n",
> > +		      hlock_class(next)->name)) {
> > +		return 2;
> > +	}
> 
> Ah, this is that UaF on ->name, but it only happens when there's already
> been a UaF, so that's fine I suppose. Still a note on that earlier
> Changelog would've been nice I suppose.

How about reporting the class pointer only as is done elsewhere in the
lockdep code?

> > +/* Must be called with the graph lock held. */
> > +static void remove_class_from_lock_chain(struct lock_chain *chain,
> > +					 struct lock_class *class)
> > +{
> > +	u64 chain_key;
> > +	int i;
> > +
> > +#ifdef CONFIG_PROVE_LOCKING
> > +	for (i = chain->base; i < chain->base + chain->depth; i++) {
> > +		if (chain_hlocks[i] != class - lock_classes)
> > +			continue;
> > +		if (--chain->depth > 0)
> 
>  {
> > +			memmove(&chain_hlocks[i], &chain_hlocks[i + 1],
> > +				(chain->base + chain->depth - i) *
> > +				sizeof(chain_hlocks[0]));
> 
>  }
> 
> Also, I suppose a comment here that notes we 'leak' chain_hlock[]
> entries would be appropriate here.

OK, I will add such a comment.

> If Waiman cares, it is possible to reclaim then by extending the above
> memmove() to cover the _entire_ tail of the array and then going around
> and fixing up all the chain->base 'pointers' that are in the moved part.

Since that change is outside the scope of what I want to realize I will leave
this to Waiman.

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ