CVE-2021-47044
Severity CVSS v4.0:
Pending analysis
Type:
CWE-125
Out-of-bounds Read
Publication date:
28/02/2024
Last modified:
19/03/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
sched/fair: Fix shift-out-of-bounds in load_balance()<br />
<br />
Syzbot reported a handful of occurrences where an sd->nr_balance_failed can<br />
grow to much higher values than one would expect.<br />
<br />
A successful load_balance() resets it to 0; a failed one increments<br />
it. Once it gets to sd->cache_nice_tries + 3, this *should* trigger an<br />
active balance, which will either set it to sd->cache_nice_tries+1 or reset<br />
it to 0. However, in case the to-be-active-balanced task is not allowed to<br />
run on env->dst_cpu, then the increment is done without any further<br />
modification.<br />
<br />
This could then be repeated ad nauseam, and would explain the absurdly high<br />
values reported by syzbot (86, 149). VincentG noted there is value in<br />
letting sd->cache_nice_tries grow, so the shift itself should be<br />
fixed. That means preventing:<br />
<br />
"""<br />
If the value of the right operand is negative or is greater than or equal<br />
to the width of the promoted left operand, the behavior is undefined.<br />
"""<br />
<br />
Thus we need to cap the shift exponent to<br />
BITS_PER_TYPE(typeof(lefthand)) - 1.<br />
<br />
I had a look around for other similar cases via coccinelle:<br />
<br />
@expr@<br />
position pos;<br />
expression E1;<br />
expression E2;<br />
@@<br />
(<br />
E1 >> E2@pos<br />
|<br />
E1 >> E2@pos<br />
)<br />
<br />
@cst depends on expr@<br />
position pos;<br />
expression expr.E1;<br />
constant cst;<br />
@@<br />
(<br />
E1 >> cst@pos<br />
|<br />
E1
Impact
Base Score 3.x
7.70
Severity 3.x
HIGH
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.10 (including) | 5.10.37 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.11.21 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.12 (including) | 5.12.4 (excluding) |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/2f3eab368e313dba35fc2f51ede778bf7b030b54
- https://git.kernel.org/stable/c/39a2a6eb5c9b66ea7c8055026303b3aa681b49a5
- https://git.kernel.org/stable/c/805cea93e66ca7deaaf6ad3b67224ce47c104c2f
- https://git.kernel.org/stable/c/80862cbf76c2646f709a57c4517aefe0b094c774
- https://git.kernel.org/stable/c/2f3eab368e313dba35fc2f51ede778bf7b030b54
- https://git.kernel.org/stable/c/39a2a6eb5c9b66ea7c8055026303b3aa681b49a5
- https://git.kernel.org/stable/c/805cea93e66ca7deaaf6ad3b67224ce47c104c2f
- https://git.kernel.org/stable/c/80862cbf76c2646f709a57c4517aefe0b094c774



