CVE-2025-37821

Source
https://nvd.nist.gov/vuln/detail/CVE-2025-37821
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-37821.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2025-37821
Downstream
Published
2025-05-08T06:26:15Z
Modified
2025-10-10T09:59:44.917291Z
Summary
sched/eevdf: Fix se->slice being set to U64_MAX and resulting crash
Details

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

sched/eevdf: Fix se->slice being set to U64_MAX and resulting crash

There is a code path in dequeueentities() that can set the slice of a schedentity to U64_MAX, which sometimes results in a crash.

The offending case is when dequeue_entities() is called to dequeue a delayed group entity, and then the entity's parent's dequeue is delayed. In that case:

  1. In the if (entityistask(se)) else block at the beginning of dequeueentities(), slice is set to cfsrqminslice(groupcfsrq(se)). If the entity was delayed, then it has no queued tasks, so cfsrqminslice() returns U64MAX.
  2. The first foreachsched_entity() loop dequeues the entity.
  3. If the entity was its parent's only child, then the next iteration tries to dequeue the parent.
  4. If the parent's dequeue needs to be delayed, then it breaks from the first foreachschedentity() loop _without updating slice.
  5. The second foreachschedentity() loop sets the parent's ->slice to the saved slice, which is still U64MAX.

This throws off subsequent calculations with potentially catastrophic results. A manifestation we saw in production was:

  1. In updateentitylag(), se->slice is used to calculate limit, which ends up as a huge negative number.
  2. limit is used in se->vlag = clamp(vlag, -limit, limit). Because limit is negative, vlag > limit, so se->vlag is set to the same huge negative number.
  3. In place_entity(), se->vlag is scaled, which overflows and results in another huge (positive or negative) number.
  4. The adjusted lag is subtracted from se->vruntime, which increases or decreases se->vruntime by a huge number.
  5. pickeevdf() calls entityeligible()/vruntimeeligible(), which incorrectly returns false because the vruntime is so far from the other vruntimes on the queue, causing the (vruntime - cfsrq->min_vruntime) * load calulation to overflow.
  6. Nothing appears to be eligible, so pick_eevdf() returns NULL.
  7. picknextentity() tries to dereference the return value of pick_eevdf() and crashes.

Dumping the cfsrq states from the core dumps with drgn showed tell-tale huge vruntime ranges and bogus vlag values, and I also traced se->slice being set to U64MAX on live systems (which was usually "benign" since the rest of the runqueue needed to be in a particular state to crash).

Fix it in dequeueentities() by always setting slice from the first non-empty cfsrq.

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
aef6987d89544d63a47753cf3741cabff0b5574c
Fixed
86b37810fa1e40b93171da023070b99ccbb4ea04
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
aef6987d89544d63a47753cf3741cabff0b5574c
Fixed
50a665496881262519f115f1bfe5822f30580eb0
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
aef6987d89544d63a47753cf3741cabff0b5574c
Fixed
bbce3de72be56e4b5f68924b7da9630cc89aa1a8

Affected versions

v6.*

v6.11
v6.11-rc2
v6.11-rc3
v6.11-rc4
v6.11-rc5
v6.11-rc6
v6.11-rc7
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.18
v6.12.19
v6.12.2
v6.12.20
v6.12.21
v6.12.22
v6.12.23
v6.12.24
v6.12.25
v6.12.26
v6.12.27
v6.12.28
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.14
v6.14-rc1
v6.14-rc2
v6.14-rc3
v6.14-rc4
v6.14-rc5
v6.14-rc6
v6.14-rc7
v6.14.1
v6.14.2
v6.14.3
v6.14.4
v6.15-rc1
v6.15-rc2
v6.15-rc3

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.12.0
Fixed
6.12.29
Type
ECOSYSTEM
Events
Introduced
6.13.0
Fixed
6.14.5