Skip to contentSkip to conversation

CVE-2025-38012: sched_ext: bpf_iter_scx_dsq_new() should always initialize iterator

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Jun 18, 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: bpf_iter_scx_dsq_new() should always initialize iterator

BPF programs may call next() and destroy() on BPF iterators even after new() returns an error value (e.g. bpf_for_each() macro ignores error returns from new()). bpf_iter_scx_dsq_new() could leave the iterator in an uninitialized state after an error return causing bpf_iter_scx_dsq_next() to dereference garbage data. Make bpf_iter_scx_dsq_new() always clear $kit->dsq so that next() and destroy() become noops.

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

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

	Issue introduced in 6.12 with commit 650ba21b131ed1f8ee57826b2c6295a3be221132 and fixed in 6.12.30 with commit 0102989af4c334d1d98b2a0fd4d61a5152e39b72
	Issue introduced in 6.12 with commit 650ba21b131ed1f8ee57826b2c6295a3be221132 and fixed in 6.14.8 with commit 255dd31bfc4a67a19b1fc2cd130a50284dadfe3a
	Issue introduced in 6.12 with commit 650ba21b131ed1f8ee57826b2c6295a3be221132 and fixed in 6.15 with commit 428dc9fc0873989d73918d4a9cc22745b7bbc799

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

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/0102989af4c334d1d98b2a0fd4d61a5152e39b72
	https://git.kernel.org/stable/c/255dd31bfc4a67a19b1fc2cd130a50284dadfe3a
	https://git.kernel.org/stable/c/428dc9fc0873989d73918d4a9cc22745b7bbc799