CVE-2021-47227·Kernel vulnerability
In the Linux kernel, the following vulnerability has been resolved: x86/fpu: Prevent state corruption in __fpu__restore_sig() The non-compacted slowpath uses __copy_from_user() and copies the entire user buffer into the kernel buffer, verbatim. This means that the kernel buffer may now contain entirely invalid state on which XRSTOR will #GP. validate_user_xstate_header() can detect some of that corruption, but that leaves the onus on callers to clear the buffer. Prior to XSAVES support, it was possible just to reinitialize the buffer, completely, but with supervisor states that is not longer possible as the buffer clearing code split got it backwards. Fixing that is possible but not corrupting the state in the first place is more robust. Avoid corruption of the kernel XSAVE buffer by using copy_user_to_xstate() which validates the XSAVE header contents before copying the actual states to the kernel. copy_user_to_xstate() was previously only called for compacted-format kernel buffers, but it works for both compacted and non-compacted forms. Using it for the non-compacted form is slower because of multiple __copy_from_user() operations, but that cost is less important than robust code in an already slow path. [ Changelog polished by Dave Hansen ]
- Severity
- medium
- Software
- Kernel
- Fixed in
- 5.12.13
- Published
- 2024-05-21
Affected versions
From: 5.11
Until: 5.12.13
Fixed in: 5.12.13
How to fix this CVE
Update your Linux kernel to version 5.12.13 or later to remediate CVE-2021-47227, which could cause kernel state corruption during FPU signal restoration. Systems running kernel versions 5.11 through 5.12.12 should prioritize this patch to prevent potential denial of service conditions resulting from corrupted floating-point and SIMD state.
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 a vulnerable version (5.11.x through 5.12.12): if uname -r | grep -E '5\.(11|12\.[0-9]|12\.[1-2][0-9]|12\.1[0-2])'; then echo 'VULNERABLE'; fi
- Review kernel logs for general protection faults or state corruption messages: sudo dmesg | grep -i 'general protection\|#gp\|fpu'
- After patching, confirm the new kernel version is running: uname -r (should be 5.12.13 or higher)
FAQ
What is CVE-2021-47227?
CVE-2021-47227 is a kernel vulnerability in the x86 FPU (floating-point unit) signal restoration code where non-compacted user buffers could corrupt kernel state, causing a general protection fault when XRSTOR instructions attempt to restore invalid state.
Is CVE-2021-47227 being actively exploited?
No, this vulnerability is not listed in CISA's Known Exploited Vulnerabilities catalog and no public exploits are available.
What versions of Kernel are affected by CVE-2021-47227?
Linux kernel versions 5.11.0 through 5.12.12 are affected; version 5.12.13 and later contain the fix.
How do I check if my server is vulnerable to CVE-2021-47227?
Run 'uname -r' to check your kernel version. If the output matches 5.11.x or 5.12.0 through 5.12.12, your system is vulnerable.
Does Defensia detect CVE-2021-47227?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If Kernel is installed on a monitored server, CVE-2021-47227 will appear in your dashboard with remediation steps.
Related Kernel CVEs
References
- https://git.kernel.org/stable/c/076f732b16a5bf842686e1b43ab6021a2d98233e
- https://git.kernel.org/stable/c/484cea4f362e1eeb5c869abbfb5f90eae6421b38
- https://git.kernel.org/stable/c/ec25ea1f3f05d6f8ee51d1277efea986eafd4f2a
- https://git.kernel.org/stable/c/076f732b16a5bf842686e1b43ab6021a2d98233e
- https://git.kernel.org/stable/c/484cea4f362e1eeb5c869abbfb5f90eae6421b38
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2021-47227. Free for 1 server.
Get started free