lkml.org 
[lkml]   [2016]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE()
From
Date
On Wed, 2016-05-18 at 07:04 -0700, Davidlohr Bueso wrote:
> On Tue, 17 May 2016, Waiman Long wrote:
>
> >Without using WRITE_ONCE(), the compiler can potentially break a
> >write into multiple smaller ones (store tearing). So a read from the
> >same data by another task concurrently may return a partial result.
> >This can result in a kernel crash if the data is a memory address
> >that is being dereferenced.
> >
> >This patch changes all write to rwsem->owner to use WRITE_ONCE()
> >to make sure that store tearing will not happen. READ_ONCE() may
> >not be needed for rwsem->owner as long as the value is only used for
> >comparison and not dereferencing.
> >
> >Signed-off-by: Waiman Long <Waiman.Long@hpe.com>
>
> Yes, ->owner can obviously be handled locklessly during optimistic
> spinning.
>
> Acked-by: Davidlohr Bueso <dave@stgolabs.net>

Acked-by: Jason Low <jason.low2@hpe.com>

\
 
 \ /
  Last update: 2016-05-18 19:41    [W:0.466 / U:0.704 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site