summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/parallel-perf.py
diff options
context:
space:
mode:
authorChengfeng Ye <nicoyip.dev@gmail.com>2026-08-01 13:42:34 +0800
committerJakub Kicinski <kuba@kernel.org>2026-08-05 17:51:48 -0700
commit2bb824660ef8116ca74bbbc265bfc2d716cd4708 (patch)
treea81cf4919a5e3e94fc84698dd49f98c5fa56a5ea /tools/perf/scripts/python/parallel-perf.py
parent1aae367b1646fb68a39a4c5aa8ac2e1f1512e0af (diff)
rds: synchronize info callbacks with module unload
rds_info_getsockopt() reads a callback from rds_info_funcs and invokes it without protecting the callback's lifetime. Transport modules register functions stored in this array. For example, rds_tcp.ko registers rds_tcp_tc_info() for RDS_INFO_TCP_SOCKETS. This permits the following interleaving: CPU0 CPU1 rds_info_getsockopt() func = rds_tcp_tc_info rmmod rds_tcp rds_tcp_exit() rds_info_deregister_func() rds_info_funcs[offset] = NULL free rds_tcp module text func() The reader can therefore branch to an address in unloaded module text. Protect callback invocation with SRCU. Enter the SRCU read-side critical section before loading the callback and leave it only after the callback returns. Clear the callback with WRITE_ONCE() and call synchronize_srcu() before deregistration returns, preventing module unload from freeing its text while an old reader is still executing it. SRCU is required because callbacks such as RDS_INFO_COUNTERS can sleep. Keep the callback array unannotated and use READ_ONCE() and WRITE_ONCE() for concurrent slot access so sparse does not have to apply __rcu through the function-pointer typedef. Replace the two callback-slot BUG_ON() checks with WARN_ON_ONCE() and return without changing the slot on mismatch. Link: https://lore.kernel.org/netdev/20260720184955.3008978-1-nicoyip.dev@gmail.com/ Suggested-by: Allison Henderson <achender@kernel.org> Suggested-by: Kuniyuki Iwashima <kuniyu@google.com> Reviewed-by: Allison Henderson <achender@kernel.org> Signed-off-by: Chengfeng Ye <nicoyip.dev@gmail.com> Link: https://patch.msgid.link/20260801054234.3535077-1-nicoyip.dev@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/parallel-perf.py')
0 files changed, 0 insertions, 0 deletions