Skip to contentSkip to conversation

Suspicious RCU usage in perf_event_exec()

DISCUSSION Ido Schimmel 1 participant 1 message Oct 28, 2024

lore
Share & tools
lore
#0 lore raw

Hi,

I have recently enabled CONFIG_RCU_EXPERT and CONFIG_PROVE_RCU_LIST in our debug configuration file and started observing the following splat
[1] on one of our machines. Can be reproduced using something as simple as [2]. Searched the archives, but did not find a similar report.

It seems perf_iterate_ctx() is expected to be called from an RCU read-side critical section and all the callers honor that except perf_event_exec(). Note that perf_event_exec() did invoke the function from an RCU read-side critical section prior to commit bd2756811766 ("perf: Rewrite core context handling").

Thanks

[1]
WARNING: suspicious RCU usage 6.12.0-rc4-custom-g84fcd02ffaf6 #169 Not tainted
-----------------------------
kernel/events/core.c:8124 RCU-list traversed in non-reader section!!

other info that might help us debug this:

rcu_scheduler_active = 2, debug_locks = 1
2 locks held by perf-exec/348:
#0: ffff888007ff5998 (&sig->cred_guard_mutex){+.+.}-{3:3}, at: bprm_execve+0xb8/0x18d0 #1: ffff888007ff5a40 (&sig->exec_update_lock){++++}-{3:3}, at: begin_new_exec+0x237b/0x33d0

stack backtrace:
CPU: 6 UID: 0 PID: 348 Comm: perf-exec Not tainted 6.12.0-rc4-custom-g84fcd02ffaf6 #169
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
Call Trace:
 <TASK>
 dump_stack_lvl+0xba/0x110
 lockdep_rcu_suspicious.cold+0x4f/0xd6
 perf_iterate_ctx+0x438/0x580
 perf_event_exec+0x628/0xb50
 begin_new_exec+0x172e/0x33d0
 load_elf_binary+0x80f/0x4fc0
 bprm_execve+0x70d/0x18d0
 do_execveat_common.isra.0+0x51b/0x5f0
 __x64_sys_execve+0x91/0xc0
 do_syscall_64+0xbb/0x1d0
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

[2]

# perf record -q -e fib:* -- ip route get 1.1.1.1