mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] sched_ext: Mark scx_bpf_cpu_rq() nullable
@ 2026-06-19 14:45 Nuoqi Gui
  2026-06-19 14:45 ` [PATCH bpf-next 1/2] sched_ext: Mark scx_bpf_cpu_rq() as nullable Nuoqi Gui
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Nuoqi Gui @ 2026-06-19 14:45 UTC (permalink / raw)
  To: Tejun Heo, David Vernet, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko
  Cc: Andrea Righi, Changwoo Min, Shuah Khan, sched-ext, bpf,
	linux-kselftest, linux-kernel, Nuoqi Gui

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 <gnq25@mails.tsinghua.edu.cn>
---
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 <gnq25@mails.tsinghua.edu.cn>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-06-19 16:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-19 14:45 [PATCH bpf-next 0/2] sched_ext: Mark scx_bpf_cpu_rq() nullable Nuoqi Gui
2026-06-19 14:45 ` [PATCH bpf-next 1/2] sched_ext: Mark scx_bpf_cpu_rq() as nullable Nuoqi Gui
2026-06-19 14:45 ` [PATCH bpf-next 2/2] selftests/sched_ext: Cover scx_bpf_cpu_rq() null return Nuoqi Gui
2026-06-19 15:31 ` [PATCH bpf-next 0/2] sched_ext: Mark scx_bpf_cpu_rq() nullable Christian Loehle
2026-06-19 16:02   ` Nuoqi Gui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®