Skip to main content

CVE-2021-47640: Vulnerability in Linux Linux

Medium
VulnerabilityCVE-2021-47640cvecve-2021-47640
Published: Wed Feb 26 2025 (02/26/2025, 01:54:12 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

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

AI-Powered Analysis

AILast updated: 06/28/2025, 05:26:34 UTC

Technical Analysis

CVE-2021-47640 is a vulnerability identified in the Linux kernel, specifically affecting the Kernel Address Sanitizer (KASAN) implementation on the PowerPC architecture. The flaw arises because the shadow page table used by KASAN is not correctly updated when certain page table entry shifts (PTE_RPN_SHIFT = 24 and PAGE_SHIFT = 12) are applied. This results in inconsistencies in the shadow memory mappings, causing both false positives and false negatives during memory error detection. False positives manifest as erroneous reports of out-of-bounds memory accesses, while false negatives mean actual memory errors go undetected. The vulnerability is demonstrated by a KASAN bug report showing a vmalloc out-of-bounds write detected incorrectly during kernel initialization routines. The root cause is that the early shadow page entries are not updated properly, and the fix involves integrating the logic of kasan_early_shadow_page_entry to ensure accurate shadow page table updates. This vulnerability affects Linux kernel versions containing the specified commits and impacts the reliability of KASAN's memory error detection on PowerPC systems. Although no direct exploit is known in the wild, the flaw undermines the kernel's ability to detect critical memory corruption bugs, potentially allowing latent memory errors to persist undetected.

Potential Impact

For European organizations, the impact of CVE-2021-47640 is primarily related to the reliability and security assurance of Linux systems running on PowerPC architectures. PowerPC is less common than x86_64 but is still used in specialized environments such as embedded systems, telecommunications infrastructure, industrial control systems, and certain high-performance computing platforms. Organizations relying on these systems may face increased risk of undetected memory corruption bugs, which can lead to system instability, data corruption, or security vulnerabilities if exploited indirectly. The inability of KASAN to reliably detect memory errors reduces confidence in kernel integrity and complicates debugging and vulnerability mitigation efforts. While this vulnerability does not directly allow remote code execution or privilege escalation, the diminished effectiveness of memory error detection can facilitate the persistence of other kernel bugs that could be leveraged by attackers. European critical infrastructure operators, research institutions, and industries using PowerPC-based Linux systems should be particularly vigilant.

Mitigation Recommendations

1. Apply the official Linux kernel patch that corrects the shadow page table update logic in KASAN for PowerPC architectures as soon as it becomes available. 2. Upgrade to a Linux kernel version that includes the fix for CVE-2021-47640 to ensure KASAN operates correctly. 3. For organizations using custom or embedded Linux distributions, coordinate with vendors or maintainers to integrate the patch promptly. 4. Increase monitoring and logging around kernel memory errors and system stability on affected systems to detect potential latent issues. 5. Conduct thorough testing of kernel memory error detection tools post-patch to confirm the effectiveness of KASAN. 6. Where feasible, consider architectural diversification or migration away from PowerPC-based Linux systems if memory error detection reliability is critical. 7. Maintain rigorous kernel update policies and vulnerability scanning to detect and remediate related kernel vulnerabilities that could be masked by this flaw.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2025-02-26T01:48:21.519Z
Cisa Enriched
false
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9822c4522896dcbde19c

Added to database: 5/21/2025, 9:08:50 AM

Last enriched: 6/28/2025, 5:26:34 AM

Last updated: 7/28/2025, 5:43:36 PM

Views: 8

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats