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, 17 Jan 2014 13:01:49 -0500 (EST)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Oleg Nesterov <oleg@...hat.com>
cc:	Peter Zijlstra <peterz@...radead.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	<linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Steven Rostedt <rostedt@...dmis.org>,
	Paul McKenney <paulmck@...ux.vnet.ibm.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: check && lockdep_no_validate (Was: lockdep: Introduce wait-type
 checks)

On Fri, 17 Jan 2014, Oleg Nesterov wrote:

> On 01/16, Alan Stern wrote:
> >
> > On Thu, 16 Jan 2014, Peter Zijlstra wrote:
> >
> > > On Thu, Jan 16, 2014 at 06:43:48PM +0100, Oleg Nesterov wrote:
> >
> > > > Perhaps we should change the meaning of lockdep_set_novalidate_class?
> > > > (perhaps with rename). What do you think about the patch below?
> > > >
> > > > With this patch __lockdep_no_validate__ means "automatically nested",
> > >
> > > Yes, I suppose that might work, it would allow some validation.
> >
> > I haven't seen the patch, but I'm not so sure it will work.  Suppose we
> > have two devices, D1 and D2, and some other mutex, M.  Then the locking
> > pattern:
> >
> > 	lock(D1);
> > 	lock(M);
> > 	unlock(M);
> > 	unlock(D1);
> >
> > generally should not conflict with:
> >
> > 	lock(M);
> > 	lock(D2);
> > 	unlock(D2);
> > 	unlock(M);
> 
> Yes, sure. This change assumes that the only problem in drivers/base is
> dev->parent->mutex / dev->mutex dependency. If the locking is even more
> "broken" (wrt lockdep), we can't replace lockdep_set_novalidate_class()
> with lockdep_set_auto_nested().

I suspect it is even more "broken".  But I can't point to specific 
examples.

> And, otoh, with this change lockdep can miss the real problems too, for
> example:
> 
> 	func1(dev)
> 	{
> 		device_lock(dev->parent);
> 		mutex_lock(MUTEX);
> 		device_lock(dev);
> 		...
> 	}
> 
> 	func2(dev)
> 	{
> 		device_lock(dev);
> 		mutex_lock(MUTEX);
> 		...
> 	}
> 
> lockdep will only notice dev -> MUTEX dependency.
> 
> I booted the kernel (under kvm) with this change and there is nothing
> in dmesg, but of course this is not the real testing.
> 
> So do you think that dev->mutex should not be validated at all ?

My guess is that if your change is deployed widely, there will be 
reports of violations.  That's only a guess.

Still, you could go ahead and try it, just to see what happens.

> Just in case... Of course, if we actually add auto_nested we should not
> use a single class unless dev->mutex will be the only user.

That's a good point.  I don't know of any other classes using 
LOCKDEP_NO_VALIDATE, but there may be one or two.

Also, take a look at commit 356c05d58af0.  It's a similar situation 
(not exactly the same).

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ