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: <519E2985.8000704@metafoo.de>
Date:	Thu, 23 May 2013 16:36:53 +0200
From:	Lars-Peter Clausen <lars@...afoo.de>
To:	Mark Brown <broonie@...nel.org>
CC:	Davide Ciminaghi <ciminaghi@...dd.com>,
	Stephen Warren <swarren@...dotorg.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] regmap: Make regmap-mmio usable from different contexts

On 05/23/2013 04:31 PM, Mark Brown wrote:
> On Thu, May 23, 2013 at 04:20:27PM +0200, Lars-Peter Clausen wrote:
>> On 05/23/2013 04:05 PM, Mark Brown wrote:
> 
>>> This seems really invasive, why not just have the lock that gets passed
>>> in point to a struct which has both the lock and the flags?  As far as
>>> the core is concerned the lock is just whatever data is required to do
>>> the locking, the fact that it's actually two values is an implementation
>>> detail of this locking implementation.
> 
>> I think that won't work. spin_lock_irqsave() will write to the flags
>> parameter before it has successfully taken the look. So if a process running
>> on another CPU tries to acquire the the lock while it is already held we'll
>> end up overwriting the flags. E.g:
> 
> So you'd have to allocate a struct on the stack with a pointer and the
> flags in it and initialise the pointer.  Not awesome but not the end of
> the world.

I'm not sure I understand what you mean. This needs to be done for each
caller of a lock()/unlock() pair. We can't allocate the flags on the stack
inside the lock() function since the stack will be gone once the function exits.

- Lars
--
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