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] [day] [month] [year] [list]
Date:   Sun, 8 Mar 2020 23:01:12 +0530
From:   Rohit Sarkar <rohitsarkar5398@...il.com>
To:     Jonathan Cameron <jic23@...nel.org>
Cc:     linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
        alexandru.ardelean@...log.com, dragos.bogdan@...log.com
Subject: Re: [PATCH v4] iio: adc: max1363: replace uses of mlock

On Sun, Mar 08, 2020 at 04:14:26PM +0000, Jonathan Cameron wrote:
> On Sun, 8 Mar 2020 02:32:56 +0530
> Rohit Sarkar <rohitsarkar5398@...il.com> wrote:
> 
> > On Sat, Mar 07, 2020 at 02:19:46PM +0000, Jonathan Cameron wrote:
> > > On Sat, 7 Mar 2020 13:34:51 +0530
> > > Rohit Sarkar <rohitsarkar5398@...il.com> wrote:
> > >   
> > > > Replace usage indio_dev's mlock with either local lock or
> > > > iio_device_claim_direct_mode.
> > > > 
> > > > Signed-off-by: Rohit Sarkar <rohitsarkar5398@...il.com>  
> > > 
> > > There is a subtlety in here (which is why this one never
> > > got cleaned up before).  We need to protect against:
> > > 
> > > 1) Driver state being accessed from multiple places concurrently.
> > >    That will use your new lock.
> > > 2) Doing actions that cannot occur if in buffered mode.  The
> > >    claim_direct_mode stuff is for that.  
> > I did consider using both, the local driver lock and the claim_direct in
> > some places, however I noticed that the claim_direct_mode internally uses
> > the mlock, hence I didnt think it was necessary to set the local lock as
> > well, as according to my understanding once a process acquires the mlock
> > no other process can run the critical section before the initial process
> > releases the mlock. Thus the driver state also remains consistent.
> 
> Any state changes in the driver done under the local lock can still happen.
> There is also a question of 'obviousness'.  The driver code should not
> 'care' what the internals of claim_direct_mode is doing.
> That can be expected to protect against moving out of direct mode, but
> not anything about 'how'.
> 
> Hence, take them both.

That does make sense, when I thought about it again I realised doing
this is essentially what was wrong with the code in the first place.
Thanks for the pointers. Will send out an update.
Thanks,
Rohit

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ