diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2025-03-12 11:52:04 -1000 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2025-03-12 11:52:04 -1000 |
commit | b7f94fcf55469ad3ef8a74c35b488dbfa314d1bb (patch) | |
tree | c4391531f49ea8430560e9225abaeaec98ae2f8c | |
parent | 6e8e2f82bc26d4b4ac9bc4f3abe99a5661a04009 (diff) | |
parent | 9360dfe4cbd62ff1eb8217b815964931523b75b3 (diff) |
Merge tag 'sched_ext-for-6.14-rc6-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext
Pull sched_ext fix from Tejun Heo:
"BPF schedulers could trigger a crash by passing in an invalid CPU to
the scx_bpf_select_cpu_dfl() helper.
Fix it by verifying input validity"
* tag 'sched_ext-for-6.14-rc6-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext:
sched_ext: Validate prev_cpu in scx_bpf_select_cpu_dfl()
-rw-r--r-- | kernel/sched/ext.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index 0f1da199cfc7..7b9dfee858e7 100644 --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -6422,6 +6422,9 @@ static bool check_builtin_idle_enabled(void) __bpf_kfunc s32 scx_bpf_select_cpu_dfl(struct task_struct *p, s32 prev_cpu, u64 wake_flags, bool *is_idle) { + if (!ops_cpu_valid(prev_cpu, NULL)) + goto prev_cpu; + if (!check_builtin_idle_enabled()) goto prev_cpu; |