CVE-2025-21897

Source
https://nvd.nist.gov/vuln/detail/CVE-2025-21897
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-21897.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2025-21897
Downstream
Published
2025-04-01T15:26:49.705Z
Modified
2025-11-20T08:31:36.247282Z
Summary
sched_ext: Fix pick_task_scx() picking non-queued tasks when it's called without balance()
Details

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

schedext: Fix picktask_scx() picking non-queued tasks when it's called without balance()

a6250aa251ea ("schedext: Handle cases where picktaskscx() is called without preceding balancescx()") added a workaround to handle the cases where picktaskscx() is called without prececing balancescx() which is due to a fair class bug where picktaksfair() may return NULL after a true return from balancefair().

The workaround detects when picktaskscx() is called without preceding balancescx() and emulates SCXRQBALKEEP and triggers kicking to avoid stalling. Unfortunately, the workaround code was testing whether @prev was on SCX to decide whether to keep the task running. This is incorrect as the task may be on SCX but no longer runnable.

This could lead to a non-runnable task to be returned from picktaskscx() which cause interesting confusions and failures. e.g. A common failure mode is the task ending up with (!onrq && oncpu) state which can cause potential wakers to busy loop, which can easily lead to deadlocks.

Fix it by testing whether @prev has SCXTASKQUEUED set. This makes @prevonscx only used in one place. Open code the usage and improve the comment while at it.

References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
a6250aa251eacaf3ebfcfe152a96a727fd483ecd
Fixed
5324c459f90d16b0c43a78b494c598915d782b7a
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
a6250aa251eacaf3ebfcfe152a96a727fd483ecd
Fixed
de60a31cb0bcacfaf9487546eac5e70e0a9c66d7
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
a6250aa251eacaf3ebfcfe152a96a727fd483ecd
Fixed
8fef0a3b17bb258130a4fcbcb5addf94b25e9ec5

Affected versions

v6.*

v6.12
v6.12-rc1
v6.12-rc2
v6.12-rc3
v6.12-rc4
v6.12-rc5
v6.12-rc6
v6.12-rc7
v6.12.1
v6.12.10
v6.12.11
v6.12.12
v6.12.13
v6.12.14
v6.12.15
v6.12.16
v6.12.17
v6.12.2
v6.12.3
v6.12.4
v6.12.5
v6.12.6
v6.12.7
v6.12.8
v6.12.9
v6.13
v6.13-rc1
v6.13-rc2
v6.13-rc3
v6.13-rc4
v6.13-rc5
v6.13-rc6
v6.13-rc7
v6.13.1
v6.13.2
v6.13.3
v6.13.4
v6.13.5

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.12.0
Fixed
6.12.18
Type
ECOSYSTEM
Events
Introduced
6.13.0
Fixed
6.13.6