CVE-2025-21965: sched_ext: Validate prev_cpu in scx_bpf_select_cpu_dfl()
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
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.
The Linux kernel CVE team has assigned CVE-2025-21965 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.12 with commit f0e1a0643a59bf1f922fa209cec86a170b784f3f and fixed in 6.12.20 with commit 752b56bb76e2471197d25d6948d85753043b10da Issue introduced in 6.12 with commit f0e1a0643a59bf1f922fa209cec86a170b784f3f and fixed in 6.13.8 with commit 515680e76c536dd4aa8e2b5d674b0d441baddf5b Issue introduced in 6.12 with commit f0e1a0643a59bf1f922fa209cec86a170b784f3f and fixed in 6.14 with commit 9360dfe4cbd62ff1eb8217b815964931523b75b3
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2025-21965
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
kernel/sched/ext.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/752b56bb76e2471197d25d6948d85753043b10da https://git.kernel.org/stable/c/515680e76c536dd4aa8e2b5d674b0d441baddf5b https://git.kernel.org/stable/c/9360dfe4cbd62ff1eb8217b815964931523b75b3