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]
Date:	Thu, 11 Jun 2015 13:37:10 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Ingo Molnar <mingo@...nel.org>
Cc:	umgwanakikbuti@...il.com, mingo@...e.hu, ktkhai@...allels.com,
	rostedt@...dmis.org, tglx@...utronix.de, juri.lelli@...il.com,
	pang.xunlei@...aro.org, oleg@...hat.com,
	wanpeng.li@...ux.intel.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 13/14] lockdep: Implement lock pinning

On Fri, Jun 05, 2015 at 11:55:52AM +0200, Ingo Molnar wrote:
> 
> * Peter Zijlstra <peterz@...radead.org> wrote:
> 
> > RFC: a possible alternative API would be something like:
> > 
> >   int cookie = lockdep_pin_lock(&foo);
> >   ...
> >   lockdep_unpin_lock(&foo, cookie);
> 
> Yeah, this would be even nicer.
> 
> > Where we pick a random number for the pin_count; this makes it
> > impossible to sneak a lock break in without also passing the right
> > cookie along.
> > 
> > I've not done this because it ends up generating code for !LOCKDEP,
> > esp. if you need to pass the cookie around for some reason.
> 
> The cookie could be a zero-size structure, which can be 'passed around' 
> syntactically but creates no overhead in the code.
> 
> But I'd expect cookie-passing to be a sign of badness in most cases: the lock 
> should generally be unpinned at the same level of abstraction...

I have tried to make this work, but so far I've failed at making the
!LOCKDEP case generate 'similar' code.

Esp, things like:

	rq = task_rq_lock(p, flags);

	...

	task_rq_unlock(rq, p, flags);

Need to somehow pass the cookie, and all pure stack based approaches
I've tried ended up being ugly and generating weird code.

So I'll keep the non-cookie approach for now.
--
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