diff options
| author | Zqiang <qiang.zhang@linux.dev> | 2026-08-24 17:24:27 +0800 |
|---|---|---|
| committer | Paul E. McKenney <paulmck@kernel.org> | 2026-09-18 16:15:54 -0700 |
| commit | 834cecb21e378bc3a70cab08e5678adfde7a581a (patch) | |
| tree | 19823002d2469e9340493a6c4aac136603386ee4 /tools/perf/scripts/python/stackcollapse.py | |
| parent | b309290a246f34995c2e212ef51b620847722f39 (diff) | |
| download | linux-next-834cecb21e378bc3a70cab08e5678adfde7a581a.tar.gz linux-next-834cecb21e378bc3a70cab08e5678adfde7a581a.zip | |
rcutorture: Synchronously wait for all rcu_torture_irq() callbacks to complete
The rcu_torture_reader() drives RCU readers from interrupt context via
smp_call_function_single(cpu, rcu_torture_irq, NULL, 0) with wait=0, to
runs rcu_torture_irq() on a remote CPU. this is async, nothing waits for
the remote handler to run.
On shutdown, torture_stop_kthread() only waits for each reader kthread to
return, and the reader's timer_delete_sync() only drains its timer. Neither
waits for a rcu_torture_irq() which still pending or executing on a remote
CPU, so it can run after all readers have exited and rcu_torture_cleanup()
has already advanced.
1. rcu_torture_irq() may issue cur_ops->call(rhp, rcu_torture_timer_cb)
after cur_ops->cb_barrier() has been waiting for all outstanding
callbacks complete. once the module is unloaded, fires into freed
module text, a use-after-free happen.
2. rcu_torture_irq() may still be inside rcu_torture_one_read(), holding
a read-side critical section, when cur_ops->cleanup() tears the flavor
down (e.g. cleanup_srcu_struct()), triggering an active-reader warning
or use-after-free of the torn-down structure.
This commit therefore issue a kick_all_cpus_sync() after all readers
kthread have returned and before cur_ops->cb_barrier(), synchronous IPI
round trip to every CPU guarantees that every rcu_torture_irq() which
previously issued by any reader has completed.
Signed-off-by: Zqiang <qiang.zhang@linux.dev>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
