CVE-2021-47640

Source
https://cve.org/CVERecord?id=CVE-2021-47640
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-47640.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2021-47640
Downstream
Published
2025-02-26T06:37:05.780Z
Modified
2026-03-15T22:43:17.023197Z
Severity
  • 7.8 (High) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H CVSS Calculator
Summary
[none]
Details

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 PTERPNSHIFT 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 kasanearlyshadowpageentry 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] dumpstacklvl+0x4c/0x6c (unreliable) [c80d1c40] [c02ff668] printaddressdescription.constprop.0+0x88/0x300 [c80d1c70] [c02ff45c] kasanreport+0x1ec/0x200 [c80d1cb0] [c0300b20] kasancheckrange+0x160/0x2f0 [c80d1cc0] [c03018a4] memset+0x34/0x90 [c80d1ce0] [c0280108] pcpualloc+0x508/0xa50 [c80d1d40] [c02fd7bc] __kmemcachecreate+0xfc/0x570 [c80d1d70] [c0283d64] kmemcachecreateusercopy+0x274/0x3e0 [c80d1db0] [c2036580] initsd+0xc4/0x1d0 [c80d1de0] [c00044a0] dooneinitcall+0xc0/0x33c [c80d1eb0] [c2001624] kernelinitfreeable+0x2c8/0x384 [c80d1ef0] [c0004b14] kernelinit+0x24/0x170 [c80d1f10] [c001b26c] retfromkernelthread+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 - kmallocdoublekzfree # vmallocoob: EXPECTATION FAILED at lib/testkasan.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

References

Affected packages

Git /

Affected ranges

Database specific

source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-47640.json"
unresolved_ranges
[
    {
        "events": [
            {
                "introduced": "5.4"
            },
            {
                "fixed": "5.4.189"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "5.5"
            },
            {
                "fixed": "5.10.110"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "5.11"
            },
            {
                "fixed": "5.15.33"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "5.16"
            },
            {
                "fixed": "5.16.19"
            }
        ]
    },
    {
        "events": [
            {
                "introduced": "5.17"
            },
            {
                "fixed": "5.17.2"
            }
        ]
    }
]