summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/export-to-sqlite.py
diff options
context:
space:
mode:
authorKuba Piecuch <jpiecuch@google.com>2026-11-24 10:31:14 +0000
committerTejun Heo <tj@kernel.org>2026-11-24 04:15:20 -1000
commit1b28ee399b23c455211e0b654da3017b8edd119e (patch)
treedcc9727213e400003aa85feea9045fe9ceef93c0 /tools/perf/scripts/python/export-to-sqlite.py
parent2f7928516314f37d7cb334675656b4412edc8be3 (diff)
sched_ext: Fix suspicious RCU usage in KF_RCU_PROTECTED kfuncs
scx_bpf_dsq_peek() and scx_bpf_tid_to_task() call rcu_dereference() without taking rcu_read_lock() and rely on KF_RCU_PROTECTED instead. However, the verifier treats every non-sleepable program as being in an RCU read-side section, including bpf_timer callbacks. bpf_timer_cb() runs those from hrtimer softirq without rcu_read_lock(), so calling either kfunc from a bpf_timer callback triggers: WARNING: suspicious RCU usage kernel/sched/ext/ext.c:11170 suspicious rcu_dereference_check() usage! ... scx_bpf_dsq_peek+0x7d/0xd0 bpf_timer_cb+0xf9/0x130 The same happens from a sleepable program inside bpf_preempt_disable(). Both contexts are RCU readers, so this is a lockdep false positive, not a use-after-free. Every context accepted by KF_RCU_PROTECTED satisfies rcu_read_lock_any_held(). Use rcu_dereference_all() in both kfuncs, matching scx_prog_sched() and rhashtable_lookup(), and convert scx_bpf_cpu_curr() and scx_bpf_cid_curr() from guard(rcu)() + rcu_dereference() to rcu_dereference_all() as well to avoid redundant per-call RCU read-side lock/unlock overhead. This patch was written with the help of an AI coding assistant. Fixes: 44f5c8ec5b9a ("sched_ext: Add lockless peek operation for DSQs") Fixes: 41e3312861ea ("sched_ext: add p->scx.tid and SCX_OPS_TID_TO_TASK lookup") Signed-off-by: Kuba Piecuch <jpiecuch@google.com> Reviewed-by: Andrea Righi <arighi@nvidia.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
0 files changed, 0 insertions, 0 deletions