CVE-2021-47640·Kernel vulnerability
In the Linux kernel, the following vulnerability has been resolved: powerpc/kasan: Fix early region not updated correctly The shadow's page table is not updated when PTE_RPN_SHIFT is 24 and PAGE_SHIFT is 12. It not only causes false positives but also false negative as shown the following text. Fix it by bringing the logic of kasan_early_shadow_page_entry here. 1. False Positive: ================================================================== BUG: KASAN: vmalloc-out-of-bounds in pcpu_alloc+0x508/0xa50 Write of size 16 at addr f57f3be0 by task swapper/0/1 CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.15.0-12267-gdebe436e77c7 #1 Call Trace: [c80d1c20] [c07fe7b8] dump_stack_lvl+0x4c/0x6c (unreliable) [c80d1c40] [c02ff668] print_address_description.constprop.0+0x88/0x300 [c80d1c70] [c02ff45c] kasan_report+0x1ec/0x200 [c80d1cb0] [c0300b20] kasan_check_range+0x160/0x2f0 [c80d1cc0] [c03018a4] memset+0x34/0x90 [c80d1ce0] [c0280108] pcpu_alloc+0x508/0xa50 [c80d1d40] [c02fd7bc] __kmem_cache_create+0xfc/0x570 [c80d1d70] [c0283d64] kmem_cache_create_usercopy+0x274/0x3e0 [c80d1db0] [c2036580] init_sd+0xc4/0x1d0 [c80d1de0] [c00044a0] do_one_initcall+0xc0/0x33c [c80d1eb0] [c2001624] kernel_init_freeable+0x2c8/0x384 [c80d1ef0] [c0004b14] kernel_init+0x24/0x170 [c80d1f10] [c001b26c] ret_from_kernel_thread+0x5c/0x64 Memory state around the buggy address: f57f3a80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f57f3b00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 >f57f3b80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 ^ f57f3c00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f57f3c80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 ================================================================== 2. False Negative (with KASAN tests): ================================================================== Before fix: ok 45 - kmalloc_double_kzfree # vmalloc_oob: EXPECTATION FAILED at lib/test_kasan.c:1039 KASAN failure expected in "((volatile char *)area)[3100]", but none occurred not ok 46 - vmalloc_oob not ok 1 - kasan ================================================================== After fix: ok 1 - kasan
- Severity
- high
- Software
- Kernel
- Fixed in
- 5.17.2
- Published
- 2025-02-26
Affected versions
From: 5.17
Until: 5.17.2
Fixed in: 5.17.2
How to fix this CVE
Update your Linux kernel to version 5.17.2 or later to resolve this KASAN memory safety tracking defect on PowerPC systems. The vulnerability causes incorrect shadow page table updates when PTE_RPN_SHIFT is 24 and PAGE_SHIFT is 12, leading to both false positive and false negative memory corruption reports. Immediate patching is recommended to restore reliable kernel memory sanitization.
sudo dnf update kernelDefensia detects this vulnerability
How to check if you are affected
- Step 1: Check your current kernel version with `uname -r` and compare against 5.17.2 — if running 5.17.0, 5.17.1, or earlier 5.17.x, you are vulnerable
- Step 2: Verify KASAN is enabled in your kernel build with `grep CONFIG_KASAN /boot/config-$(uname -r)` — if set to 'y', the system is affected
- Step 3: Search system logs for spurious KASAN reports using `grep -i 'KASAN.*out-of-bounds' /var/log/kern.log | head -20` — false positives may indicate exploitation of this defect
- Step 4: After patching, reboot with `sudo reboot` and confirm new kernel version with `uname -r`, then re-run KASAN self-tests with `dmesg | grep -i kasan` to verify no false negatives remain
FAQ
What is CVE-2021-47640?
CVE-2021-47640 is a kernel memory safety defect affecting PowerPC systems where KASAN's shadow page table fails to update correctly, causing the memory sanitizer to either ignore real memory corruption (false negative) or flag valid memory accesses as errors (false positive).
Is CVE-2021-47640 being actively exploited?
No, there is no evidence of active exploitation in the wild. This is a detection mechanism flaw rather than a direct code execution vulnerability.
What versions of Kernel are affected by CVE-2021-47640?
Linux kernel versions 5.17.0 through 5.17.1 on PowerPC architectures are vulnerable. The fix is included in 5.17.2 and later.
How do I check if my server is vulnerable to CVE-2021-47640?
Run `uname -r` and check if the output shows 5.17.0 or 5.17.1; if so, you are vulnerable. On non-PowerPC systems, this CVE does not apply.
Does Defensia detect CVE-2021-47640?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If Kernel is installed on a monitored server, CVE-2021-47640 will appear in your dashboard with remediation steps.
Related Kernel CVEs
References
- https://git.kernel.org/stable/c/5a3d8f3192a409893c57808cc935e16484df1068
- https://git.kernel.org/stable/c/7f19245c3647afea8c7c41f795506ef70f64b9f2
- https://git.kernel.org/stable/c/dd75080aa8409ce10d50fb58981c6b59bf8707d3
- https://git.kernel.org/stable/c/de56beace6648065d404cd9835aa7d30e3df519d
- https://git.kernel.org/stable/c/e3d157a4b4f4e0268c98be5b7013bf4b31234bb6
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2021-47640. Free for 1 server.
Get started free