Skip to contentSkip to conversation

CVE-2025-40260: sched_ext: Fix scx_enable() crash on helper kthread creation failure

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Dec 4, 2025

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

sched_ext: Fix scx_enable() crash on helper kthread creation failure

A crash was observed when the sched_ext selftests runner was terminated with Ctrl+\ while test 15 was running:

NIP [c00000000028fa58] scx_enable.constprop.0+0x358/0x12b0 LR [c00000000028fa2c] scx_enable.constprop.0+0x32c/0x12b0

Call Trace:
scx_enable.constprop.0+0x32c/0x12b0 (unreliable)
bpf_struct_ops_link_create+0x18c/0x22c
__sys_bpf+0x23f8/0x3044
sys_bpf+0x2c/0x6c
system_call_exception+0x124/0x320
system_call_vectored_common+0x15c/0x2ec

kthread_run_worker() returns an ERR_PTR() on failure rather than NULL, but the current code in scx_alloc_and_add_sched() only checks for a NULL helper. Incase of failure on SIGQUIT, the error is not handled in scx_alloc_and_add_sched() and scx_enable() ends up dereferencing an error pointer.

Error handling is fixed in scx_alloc_and_add_sched() to propagate PTR_ERR() into ret, so that scx_enable() jumps to the existing error path, avoiding random dereference on failure.

The Linux kernel CVE team has assigned CVE-2025-40260 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.16 with commit bff3b5aec1b727b620adc7c47085592802390125 and fixed in 6.17.10 with commit 625e173e2a59b6cf6cbfb51c0a6bea47f3861eab
	Issue introduced in 6.16 with commit bff3b5aec1b727b620adc7c47085592802390125 and fixed in 6.18 with commit 7b6216baae751369195fa3c83d434d23bcda406a

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-40260

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/625e173e2a59b6cf6cbfb51c0a6bea47f3861eab
	https://git.kernel.org/stable/c/7b6216baae751369195fa3c83d434d23bcda406a