CVE-2021-47044

sched/fair: Fix shift-out-of-bounds in load_balance()

HIGH
7.7
CVSS Score
Published: February 28, 2024 at 08:13 AM UTC
Updated: June 17, 2026 at 04:16 AM UTC
1 product affected across 1 vendorLinux Kernel

Using Linux by Linux?

Get instant alerts when new vulnerabilities affect Linux - before attackers find them.

Real-time alertsTrack your software stackFree plan available
Severity
HIGH7.7
Exploit prediction
EPSS 0.3%
SSVC
No known exploit

Description

In the Linux kernel, the following vulnerability has been resolved: sched/fair: Fix shift-out-of-bounds in load_balance() Syzbot reported a handful of occurrences where an sd->nr_balance_failed can grow to much higher values than one would expect. A successful load_balance() resets it to 0; a failed one increments it. Once it gets to sd->cache_nice_tries + 3, this *should* trigger an active balance, which will either set it to sd->cache_nice_tries+1 or reset it to 0. However, in case the to-be-active-balanced task is not allowed to run on env->dst_cpu, then the increment is done without any further modification. This could then be repeated ad nauseam, and would explain the absurdly high values reported by syzbot (86, 149). VincentG noted there is value in letting sd->cache_nice_tries grow, so the shift itself should be fixed. That means preventing: """ If the value of the right operand is negative or is greater than or equal to the width of the promoted left operand, the behavior is undefined. """ Thus we need to cap the shift exponent to BITS_PER_TYPE(typeof(lefthand)) - 1. I had a look around for other similar cases via coccinelle: @expr@ position pos; expression E1; expression E2; @@ ( E1 >> E2@pos | E1 >> E2@pos ) @cst depends on expr@ position pos; expression expr.E1; constant cst; @@ ( E1 >> cst@pos | E1 << cst@pos ) @script:python depends on !cst@ pos << expr.pos; exp << expr.E2; @@ # Dirty hack to ignore constexpr if exp.upper() != exp: coccilib.report.print_report(pos[0], "Possible UB shift here") The only other match in kernel/sched is rq_clock_thermal() which employs sched_thermal_decay_shift, and that exponent is already capped to 10, so that one is fine.

Affected

Our own answer: ranges merged, affected separated from platform-only, with confidence and review flags.

5.10 ≤ v < 5.10.375.10 ≤ v < 5.11.215.10 ≤ v < 5.12.45.10 ≤ v < 5.135.11 ≤ v < 5.11.215.12 ≤ v < 5.12.45.105a7f555904671c0737819fe4d19bd6143de3f6c0
Vendor states this is fixed in 2f3eab368e313dba35fc2f51ede778bf7b030b54 (fixed)
Vendor states this is fixed in 39a2a6eb5c9b66ea7c8055026303b3aa681b49a5 (fixed)
Vendor states this is fixed in 805cea93e66ca7deaaf6ad3b67224ce47c104c2f (fixed)
Vendor states this is fixed in 80862cbf76c2646f709a57c4517aefe0b094c774 (fixed)
Vendor states this is fixed in 5.10 (unaffected)
Vendor states this is fixed in 5.10.37 (unaffected)
Vendor states this is fixed in 5.11.21 (unaffected)
Vendor states this is fixed in 5.12.4 (unaffected)
Vendor states this is fixed in 5.13 (unaffected)

References (4)

Patch
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
https://git.kernel.org/stable/c/2f3eab368e313dba35fc2f51ede778bf7b030b54
Patch
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
https://git.kernel.org/stable/c/39a2a6eb5c9b66ea7c8055026303b3aa681b49a5
Patch
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
https://git.kernel.org/stable/c/805cea93e66ca7deaaf6ad3b67224ce47c104c2f
Patch
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
https://git.kernel.org/stable/c/80862cbf76c2646f709a57c4517aefe0b094c774

SSVC — Action Prioritization

SSVCNo known exploitNot automatablePartial impact

SSVC signals action urgency (what to patch first), separate from CVSS which measures severity.

CVSS

7.7HIGHCISA-ADP
Attack Vector
LOCAL
Complexity
LOW
Privileges
NONE
User Interaction
NONE
Scope
UNCHANGED
Confidentiality
HIGH
Integrity
NONE
Availability
HIGH
Vector?

Quick Info

StatusANALYZED
CWE
CWE-125

Get alerted

Stop reading CVE feeds looking for your own stack

Track the products you run and VulnTracker tells you when a new CVE affects them — with what is known about fixing it, and nothing about the rest.

Free plan, no card