Skip to content

Commit a47f9f1

Browse files
committed
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>
1 parent da12301 commit a47f9f1

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

kernel/rcu/rcutorture.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ static int rcu_torture_boost(void *arg)
997997
goto checkwait;
998998

999999
/* Wait for the next test interval. */
1000-
oldstarttime = boost_starttime;
1000+
oldstarttime = READ_ONCE(boost_starttime);
10011001
while (time_before(jiffies, oldstarttime)) {
10021002
schedule_timeout_interruptible(oldstarttime - jiffies);
10031003
if (stutter_wait("rcu_torture_boost"))
@@ -1041,10 +1041,11 @@ static int rcu_torture_boost(void *arg)
10411041
* interval. Besides, we are running at RT priority,
10421042
* so delays should be relatively rare.
10431043
*/
1044-
while (oldstarttime == boost_starttime && !kthread_should_stop()) {
1044+
while (oldstarttime == READ_ONCE(boost_starttime) && !kthread_should_stop()) {
10451045
if (mutex_trylock(&boost_mutex)) {
10461046
if (oldstarttime == boost_starttime) {
1047-
boost_starttime = jiffies + test_boost_interval * HZ;
1047+
WRITE_ONCE(boost_starttime,
1048+
jiffies + test_boost_interval * HZ);
10481049
n_rcu_torture_boosts++;
10491050
}
10501051
mutex_unlock(&boost_mutex);

0 commit comments

Comments
 (0)