summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc/allocator
diff options
context:
space:
mode:
authorShubhang Kaushik (Ampere) <sh@gentwo.org>2026-11-01 21:00:12 -0800
committerTejun Heo <tj@kernel.org>2026-11-02 06:51:40 -1000
commit4c2e0751d5e6d181a5b9b2a8ada869b5bee66a83 (patch)
tree2f343be995059114dc1b4e27bc9a879e80e1bb0c /rust/kernel/alloc/allocator
parent2227a34ff7bfcf6112931039e3554f4b70b65ab9 (diff)
sched_ext: Reject scx_bpf_destroy_dsq() in tracing programs
scx_bpf_destroy_dsq() takes the target user DSQ's raw spinlock. However, it is in scx_kfunc_ids_any, which is also registered for BPF_PROG_TYPE_TRACING. For an active root scheduler without ops.sub_attach, the compatibility path in scx_prog_sched() lets an unassociated tracing program resolve to that scheduler. The tracing program can then call scx_bpf_destroy_dsq() while the target DSQ lock is already held. For example, a scheduler which mixes FIFO and priority-queue insertions into a user DSQ triggers scx_error() from scx_dispatch_enqueue() while holding that DSQ's lock. scx_claim_exit() emits sched_ext_exit before the lock is released: scx_dispatch_enqueue() raw_spin_lock(&dsq->lock) scx_error() scx_claim_exit() trace_sched_ext_exit() tracing BPF program scx_bpf_destroy_dsq(dsq_id) destroy_dsq() raw_spin_lock_irqsave(&dsq->lock) The tracing program recursively acquires the same raw spinlock and locks up the CPU. Because the tracepoint runs before scx_finish_exit(), disable_irq_work is not queued and the scheduler cannot enter its normal disable path. Reject scx_bpf_destroy_dsq() from tracing programs at verification time. The kfunc remains available to SCX struct_ops and syscall programs. Fixes: f0e1a0643a59 ("sched_ext: Implement BPF extensible scheduler class") Signed-off-by: Shubhang Kaushik (Ampere) <sh@gentwo.org> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'rust/kernel/alloc/allocator')
0 files changed, 0 insertions, 0 deletions