diff options
| author | Kuba Piecuch <jpiecuch@google.com> | 2026-11-23 13:55:24 +0000 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-11-24 09:47:29 -1000 |
| commit | 4fec59cdc2f3cdcdbb71d665b53daf384b36d60d (patch) | |
| tree | d56915747ff33f9a1d7b92685d77ea8e89ca185c /kernel/workqueue.c | |
| parent | e667a652dd0a6f6d0d89e2d0f80881ddabea1ead (diff) | |
sched_ext: Don't allow unlocked kfuncs from ops.dump() and ops.init_cids()
scx_kf_allow_flags[] grants SCX_KF_ALLOW_UNLOCKED to ops.dump(). This
allows ops.dump() to call scx_bpf_dsq_move*(), scx_bpf_dsq_reenq_task(),
and scx_bpf_select_cpu_*(). When no rq is locked, these kfuncs acquire
rq, DSQ, and pi locks and may invoke nested SCX ops such as
ops.dequeue().
scx_dump_state() runs ops.dump() with IRQs disabled under scx_dump_lock.
Callers include the hardirq disable irq_work and SysRq-D. With
SCX_KF_ALLOW_UNLOCKED, a debug dump can migrate tasks and run nested
scheduler callbacks instead of only inspecting state. ops.dump_cpu() and
ops.dump_task() already deny these kfuncs. Remove SCX_KF_ALLOW_UNLOCKED
from ops.dump().
ops.init_cids() runs before the cid tables are published and before the
arena pool and pshards are set up. Its only job is to finalize the cid
layout. SCX_KF_ALLOW_UNLOCKED also gave it scx_bpf_create_dsq(),
scx_bpf_dsq_move*(), and scx_bpf_dsq_reenq_task(). Restrict
ops.init_cids() to SCX_KF_ALLOW_INIT_CIDS.
No in-tree scheduler calls these kfuncs from either op.
Fixes: 4c30f5ce4f7a ("sched_ext: Implement scx_bpf_dispatch[_vtime]_from_dsq()")
Fixes: 874fdc0e86e4 ("sched_ext: Add ops.init_cids() to finalize the cid layout before init")
Cc: stable@vger.kernel.org # v7.3+
Signed-off-by: Kuba Piecuch <jpiecuch@google.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/workqueue.c')
0 files changed, 0 insertions, 0 deletions
