diff options
author | Paul E. McKenney <paulmck@kernel.org> | 2021-12-13 20:05:07 +0100 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2022-02-02 02:19:02 +0100 |
commit | a47f9f131dfe4f765e385fa90e13032eadb00bac (patch) | |
tree | 4a57aa85fa7206f3a7b9aa9cb1c6734b4ec33d39 /kernel/rcu | |
parent | rcu-tasks: Fix computation of CPU-to-list shift counts (diff) | |
download | linux-a47f9f131dfe4f765e385fa90e13032eadb00bac.tar.xz linux-a47f9f131dfe4f765e385fa90e13032eadb00bac.zip |
rcu: Mark accesses to boost_starttime
The boost_starttime shared variable has conflicting unmarked C-language
accesses, which are dangerous at best. This commit therefore adds
appropriate marking. This was found by KCSAN.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel/rcu')
-rw-r--r-- | kernel/rcu/rcutorture.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 422f7e4cc08d..829ae0b7d3c0 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -997,7 +997,7 @@ static int rcu_torture_boost(void *arg) goto checkwait; /* Wait for the next test interval. */ - oldstarttime = boost_starttime; + oldstarttime = READ_ONCE(boost_starttime); while (time_before(jiffies, oldstarttime)) { schedule_timeout_interruptible(oldstarttime - jiffies); if (stutter_wait("rcu_torture_boost")) @@ -1041,10 +1041,11 @@ static int rcu_torture_boost(void *arg) * interval. Besides, we are running at RT priority, * so delays should be relatively rare. */ - while (oldstarttime == boost_starttime && !kthread_should_stop()) { + while (oldstarttime == READ_ONCE(boost_starttime) && !kthread_should_stop()) { if (mutex_trylock(&boost_mutex)) { if (oldstarttime == boost_starttime) { - boost_starttime = jiffies + test_boost_interval * HZ; + WRITE_ONCE(boost_starttime, + jiffies + test_boost_interval * HZ); n_rcu_torture_boosts++; } mutex_unlock(&boost_mutex); |