scx_bpf_cpu_rq() can return NULL for invalid CPU input or when no SCX
scheduler is active, but its kfunc registration does not advertise the
nullable return to the verifier.
Add KF_RET_NULL to scx_bpf_cpu_rq(), matching the nullable metadata already
present on neighboring SCX accessors, and add a sched_ext selftest that rejects
an unchecked direct runqueue field read.
This fixes a regression introduced by 6203ef73fa5c ("sched/ext: Add BPF
function to fetch rq").
Signed-off-by: Nuoqi Gui <[email protected]>
---
Nuoqi Gui (2):
sched_ext: Mark scx_bpf_cpu_rq() as nullable
selftests/sched_ext: Cover scx_bpf_cpu_rq() null return
kernel/sched/ext.c | 2 +-
tools/testing/selftests/sched_ext/Makefile | 1 +
.../selftests/sched_ext/cpu_rq_ret_null.bpf.c | 27 +++++++++++++++
.../testing/selftests/sched_ext/cpu_rq_ret_null.c | 38 ++++++++++++++++++++++
4 files changed, 67 insertions(+), 1 deletion(-)
---
base-commit: e4287bf34f97a88c7d9322f5bde828724c073a6b
change-id: 20260617-f01-14-scx-cpu-rq-ret-null-2e79535acd57
Best regards,
--
Nuoqi Gui <[email protected]>