CVE-2021-47044·Kernel vulnerability
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.
- Severity
- high
- Software
- Kernel
- Fixed in
- 5.12.4
- Published
- 2024-02-28
Affected versions
From: 5.12
Until: 5.12.4
Fixed in: 5.12.4
How to fix this CVE
Update your Linux kernel to version 5.12.4 or later to patch the shift-out-of-bounds vulnerability in the load_balance() scheduler function. This fix prevents undefined behavior when the CPU load balancer attempts to shift values beyond the bit width of the operand. Systems running kernel versions 5.12.0 through 5.12.3 should prioritize this update to eliminate the risk of kernel instability and potential denial of service.
sudo dnf update kernel kernel-develDefensia detects this vulnerability
How to check if you are affected
- Check your current kernel version: uname -r
- Verify if you are running 5.12.0-5.12.3: if uname -r | grep -qE '5\.12\.[0-3]'; then echo 'VULNERABLE'; else echo 'Not vulnerable'; fi
- Review kernel logs for scheduler anomalies: grep -i 'shift' /var/log/kern.log or dmesg | tail -50
- Confirm the patch is applied after update: uname -r should show 5.12.4 or later, and verify with: cat /proc/version
FAQ
What is CVE-2021-47044?
CVE-2021-47044 is a kernel scheduling vulnerability where the load_balance() function fails to properly cap bit-shift exponents, causing undefined behavior when the shift operand exceeds the bit width of the target variable. This can lead to kernel instability and potential denial of service.
Is CVE-2021-47044 being actively exploited?
No, according to CISA's Known Exploited Vulnerabilities (KEV) database, CVE-2021-47044 is not currently being actively exploited in the wild, and no public exploit code is available.
What versions of Kernel are affected by CVE-2021-47044?
Linux kernel versions 5.12.0 through 5.12.3 are affected. Kernel 5.12.4 and later versions include the fix.
How do I check if my server is vulnerable to CVE-2021-47044?
Run 'uname -r' and check if the output shows a version matching 5.12.[0-3]. If it does, your system is vulnerable and requires immediate patching.
Does Defensia detect CVE-2021-47044?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If Kernel is installed on a monitored server, CVE-2021-47044 will appear in your dashboard with remediation steps.
Related Kernel CVEs
References
- 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
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2021-47044. Free for 1 server.
Get started free