Skip to content

Commit ae5cb6a

Browse files
paulmckrcuAvenger-285714
authored andcommitted
rcutorture: Fix rcu_torture_fwd_cb_cr() data race
[ Upstream commit 6040072f4774a575fa67b912efe7722874be337b ] On powerpc systems, spinlock acquisition does not order prior stores against later loads. This means that this statement: rfcp->rfc_next = NULL; Can be reordered to follow this statement: WRITE_ONCE(*rfcpp, rfcp); Which is then a data race with rcu_torture_fwd_prog_cr(), specifically, this statement: rfcpn = READ_ONCE(rfcp->rfc_next) KCSAN located this data race, which represents a real failure on powerpc. Signed-off-by: Paul E. McKenney <[email protected]> Acked-by: Marco Elver <[email protected]> Cc: Andrey Konovalov <[email protected]> Cc: <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent a10b49e commit ae5cb6a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/rcu/rcutorture.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2592,7 +2592,7 @@ static void rcu_torture_fwd_cb_cr(struct rcu_head *rhp)
25922592
spin_lock_irqsave(&rfp->rcu_fwd_lock, flags);
25932593
rfcpp = rfp->rcu_fwd_cb_tail;
25942594
rfp->rcu_fwd_cb_tail = &rfcp->rfc_next;
2595-
WRITE_ONCE(*rfcpp, rfcp);
2595+
smp_store_release(rfcpp, rfcp);
25962596
WRITE_ONCE(rfp->n_launders_cb, rfp->n_launders_cb + 1);
25972597
i = ((jiffies - rfp->rcu_fwd_startat) / (HZ / FWD_CBS_HIST_DIV));
25982598
if (i >= ARRAY_SIZE(rfp->n_launders_hist))

0 commit comments

Comments
 (0)