FAILED: patch "[PATCH] sched_ext: Validate prev_cpu in scx_bpf_select_cpu_dfl()" failed to apply to 6.13-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.13-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.13.y
git checkout FETCH_HEAD
git cherry-pick -x 9360dfe4cbd62ff1eb8217b815964931523b75b3
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025031611-flatly-revolving-8c7b@gregkh' --subject-prefix 'PATCH 6.13.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 9360dfe4cbd62ff1eb8217b815964931523b75b3 Mon Sep 17 00:00:00 2001
From: Andrea Righi <[email protected]>
Date: Mon, 3 Mar 2025 18:51:59 +0100
Subject: [PATCH] sched_ext: Validate prev_cpu in scx_bpf_select_cpu_dfl()
If a BPF scheduler provides an invalid CPU (outside the nr_cpu_ids range) as prev_cpu to scx_bpf_select_cpu_dfl() it can cause a kernel crash.
To prevent this, validate prev_cpu in scx_bpf_select_cpu_dfl() and trigger an scx error if an invalid CPU is specified.
kernel/sched/ext.c +3 -0
@@ -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;
PATCH 1/1 sched_ext: Validate prev_cpu in scx_bpf_select_cpu_dfl()
If a BPF scheduler provides an invalid CPU (outside the nr_cpu_ids range) as prev_cpu to scx_bpf_select_cpu_dfl() it can cause a kernel crash.
To prevent this, validate prev_cpu in scx_bpf_select_cpu_dfl() and trigger an scx error if an invalid CPU is specified.
--- kernel/sched/ext.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/sched/ext.c +3 -0
@@ -6376,6 +6376,9 @@ __bpf_kfunc_start_defs(); __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 (!static_branch_likely (&scx_builtin_idle_enabled)) {scx_ops_error ("built-in idle tracking is disabled" ); goto prev_cpu;
Signature · 1 line
2.48.1
Sasha Levin
maintainerRe: [PATCH 6.13.y] sched_ext: Validate prev_cpu in scx_bpf_select_cpu_dfl()
[ Sasha's backport helper bot ]
Hi,
Summary of potential issues:
⚠️ Found matching upstream commit but patch is missing proper reference to it
Found matching upstream commit: 9360dfe4cbd62ff1eb8217b815964931523b75b3
Note: The patch differs from the upstream commit:
---
1: 9360dfe4cbd62 < -: ------------- sched_ext: Validate prev_cpu in scx_bpf_select_cpu_dfl() -: ------------- > 1: e6f4df3e8bc2c sched_ext: Validate prev_cpu in scx_bpf_select_cpu_dfl()
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.13.y | Success | Success |