Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1403014

Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE()

From Davidlohr Bueso <dave@stgolabs.net>
Newsgroups linux.kernel
Subject Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE()
Date 2016-05-18 16:10 +0200
Message-ID <rAakG-39y-23@gated-at.bofh.it> (permalink)
References <rzYtc-3J2-3@gated-at.bofh.it> <rzYtc-3J2-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 2/5] locking/rwsem: Protect all writes to owner by WRITE_ONCE() Waiman Long <Waiman.Long@hpe.com> - 2016-05-18 03:30 +0200
  Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by  WRITE_ONCE() Davidlohr Bueso <dave@stgolabs.net> - 2016-05-18 16:10 +0200
    Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by  WRITE_ONCE() Jason Low <jason.low2@hpe.com> - 2016-05-18 19:30 +0200
    Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by  WRITE_ONCE Jason Low <jason.low2@hpe.com> - 2016-05-18 19:30 +0200
      Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by  WRITE_ONCE Jason Low <jason.low2@hpe.com> - 2016-05-18 22:00 +0200
        Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by  WRITE_ONCE Jason Low <jason.low2@hpe.com> - 2016-05-20 00:40 +0200
        Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by  WRITE_ONCE Peter Hurley <peter@hurleysoftware.com> - 2016-05-21 18:10 +0200
          Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by  WRITE_ONCE Peter Zijlstra <peterz@infradead.org> - 2016-05-22 12:50 +0200
          Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by  WRITE_ONCE Jason Low <jason.low2@hpe.com> - 2016-05-23 20:50 +0200
            Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by  WRITE_ONCE Davidlohr Bueso <dave@stgolabs.net> - 2016-05-23 21:50 +0200
              Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by  WRITE_ONCE "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-05-23 22:20 +0200
                Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by  WRITE_ONCE Davidlohr Bueso <dave@stgolabs.net> - 2016-05-23 23:10 +0200
            Re: [PATCH v4 2/5] locking/rwsem: Protect all writes to owner by  WRITE_ONCE Waiman Long <waiman.long@hpe.com> - 2016-05-25 03:30 +0200

csiph-web