Skip to content

Commit 48297a2

Browse files
qiangzh3paulmckrcu
authored andcommitted
rcutorture: Use the barrier operation specified by cur_ops
The rcutorture_oom_notify() function unconditionally invokes rcu_barrier(), which is OK when the rcutorture.torture_type value is "rcu", but unhelpful otherwise. The purpose of these barrier calls is to wait for all outstanding callback-flooding callbacks to be invoked before cleaning up their data. Using the wrong barrier function therefore risks arbitrary memory corruption. Thus, this commit changes these rcu_barrier() calls into cur_ops->cb_barrier() to make things work when torturing non-vanilla flavors of RCU. Signed-off-by: Zqiang <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 7634b1e commit 48297a2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/rcu/rcutorture.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,12 +2600,12 @@ static int rcutorture_oom_notify(struct notifier_block *self,
26002600
for (i = 0; i < fwd_progress; i++)
26012601
ncbs += rcu_torture_fwd_prog_cbfree(&rfp[i]);
26022602
pr_info("%s: Freed %lu RCU callbacks.\n", __func__, ncbs);
2603-
rcu_barrier();
2603+
cur_ops->cb_barrier();
26042604
ncbs = 0;
26052605
for (i = 0; i < fwd_progress; i++)
26062606
ncbs += rcu_torture_fwd_prog_cbfree(&rfp[i]);
26072607
pr_info("%s: Freed %lu RCU callbacks.\n", __func__, ncbs);
2608-
rcu_barrier();
2608+
cur_ops->cb_barrier();
26092609
ncbs = 0;
26102610
for (i = 0; i < fwd_progress; i++)
26112611
ncbs += rcu_torture_fwd_prog_cbfree(&rfp[i]);

0 commit comments

Comments
 (0)