CVE-2026-139171: sched_ext: Reject scx_bpf_sub_grant/revoke() in tracing programs
In the Linux kernel, the following vulnerability has been resolved:
schedext: Reject scxbpfsubgrant/revoke() in tracing programs
A tracing program can call scxbpfsubgrant() and scxbpfsubrevoke() through scxkfuncidsany, which is registered on the tracing kfunc hook. Before returning, both invoke ops.subcapsupdated() of the sub-schedulers whose caps changed, so those ops run in the tracing program's context. No SCX op expects to run from an arbitrary tracing context.
With an rq lock held, this leads to the same deadlock that b07a7450f6ef ("schedext: Reject rq-lock-taking kfuncs in tracing programs") fixed for direct calls:
1. A tpbtf/schedswitch program fires from schedule() with the rq lock held. scxlockedrq() only tracks rq locks held across SCX callbacks, so it returns NULL there. 2. The program calls scxbpfsubgrant() on a child, which invokes the child's ops.subcapsupdated() before returning. 3. That op calls scxbpfcidperfset() on this cpu, which sees no locked rq and takes the rq lock the cpu already holds.
Add both kfuncs to scxkfuncidsnotracing and rewrite the set's comment to cover both reasons for membership: taking an rq lock and running SCX ops.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.6 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.3.6-1 - Compensating control
In the Linux kernel, add scx_bpf_sub_grant() and scx_bpf_sub_revoke() to scx_kfunc_ids_no_tracing so tracing programs cannot call them.
Event History
Frequently Asked Questions
Which systems are exposed to the deadlock condition?
Systems using sched_ext sub-schedulers are exposed when a tracing BPF program can call scx_bpf_sub_grant() or scx_bpf_sub_revoke(). The described path specifically involves a tp_btf/sched_switch program running while the runqueue lock is held.
What does an attacker or triggering program need to do?
A tracing program must invoke scx_bpf_sub_grant() or scx_bpf_sub_revoke() for a child sub-scheduler. The resulting sub_caps_updated() callback can run in the tracing program's context; if it then performs an operation such as scx_bpf_cidperf_set() that takes the already-held runqueue lock, the system can deadlock.
What can be done before the kernel fix is deployed?
Do not permit tracing programs to call scx_bpf_sub_grant() or scx_bpf_sub_revoke(). Review sched_ext sub-scheduler callbacks, especially sub_caps_updated(), for operations that acquire runqueue locks when they could be reached from tracing context.
How can administrators identify a potentially affected configuration?
Inspect loaded or deployed tracing BPF programs for calls to scx_bpf_sub_grant() or scx_bpf_sub_revoke(), particularly programs attached to sched_switch through tp_btf. Also identify sub-schedulers whose sub_caps_updated() callback can call scx_bpf_cidperf_set() or otherwise acquire a runqueue lock.