]> git.baikalelectronics.ru Git - kernel.git/commit
rculist: Use WRITE_ONCE() when deleting from reader-visible list
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Fri, 18 Sep 2015 15:45:22 +0000 (08:45 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 6 Oct 2015 18:16:42 +0000 (11:16 -0700)
commitec5dc442e52902616d27cb907b9471874d9ea6ba
treeca06a26b0a485a63cf42417a12dea443a0df103c
parent4e3e3c2f4b7a252f5876154339e9e7fd21f9cf14
rculist: Use WRITE_ONCE() when deleting from reader-visible list

The various RCU list-deletion macros (list_del_rcu(),
hlist_del_init_rcu(), hlist_del_rcu(), hlist_bl_del_init_rcu(),
hlist_bl_del_rcu(), hlist_nulls_del_init_rcu(), and hlist_nulls_del_rcu())
do plain stores into the ->next pointer of the preceding list elemment.
Unfortunately, the compiler is within its rights to (for example) use
byte-at-a-time writes to update the pointer, which would fatally confuse
concurrent readers.  This patch therefore adds the needed WRITE_ONCE()
macros.

KernelThreadSanitizer (KTSAN) reported the __hlist_del() issue, which
is a problem when __hlist_del() is invoked by hlist_del_rcu().

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
include/linux/list.h
include/linux/list_bl.h
include/linux/list_nulls.h