{"id":"CVE-2021-47640","state":"PUBLISHED","title":"powerpc/kasan: Fix early region not updated correctly","description":"In the Linux kernel, the following vulnerability has been resolved:\n\npowerpc/kasan: Fix early region not updated correctly\n\nThe shadow's page table is not updated when PTE_RPN_SHIFT is 24\nand PAGE_SHIFT is 12. It not only causes false positives but\nalso false negative as shown the following text.\n\nFix it by bringing the logic of kasan_early_shadow_page_entry here.\n\n1. False Positive:\n==================================================================\nBUG: KASAN: vmalloc-out-of-bounds in pcpu_alloc+0x508/0xa50\nWrite of size 16 at addr f57f3be0 by task swapper/0/1\n\nCPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.15.0-12267-gdebe436e77c7 #1\nCall Trace:\n[c80d1c20] [c07fe7b8] dump_stack_lvl+0x4c/0x6c (unreliable)\n[c80d1c40] [c02ff668] print_address_description.constprop.0+0x88/0x300\n[c80d1c70] [c02ff45c] kasan_report+0x1ec/0x200\n[c80d1cb0] [c0300b20] kasan_check_range+0x160/0x2f0\n[c80d1cc0] [c03018a4] memset+0x34/0x90\n[c80d1ce0] [c0280108] pcpu_alloc+0x508/0xa50\n[c80d1d40] [c02fd7bc] __kmem_cache_create+0xfc/0x570\n[c80d1d70] [c0283d64] kmem_cache_create_usercopy+0x274/0x3e0\n[c80d1db0] [c2036580] init_sd+0xc4/0x1d0\n[c80d1de0] [c00044a0] do_one_initcall+0xc0/0x33c\n[c80d1eb0] [c2001624] kernel_init_freeable+0x2c8/0x384\n[c80d1ef0] [c0004b14] kernel_init+0x24/0x170\n[c80d1f10] [c001b26c] ret_from_kernel_thread+0x5c/0x64\n\nMemory state around the buggy address:\n f57f3a80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8\n f57f3b00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8\n>f57f3b80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8\n                                               ^\n f57f3c00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8\n f57f3c80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8\n==================================================================\n\n2. False Negative (with KASAN tests):\n==================================================================\nBefore fix:\n    ok 45 - kmalloc_double_kzfree\n    # vmalloc_oob: EXPECTATION FAILED at lib/test_kasan.c:1039\n    KASAN failure expected in \"((volatile char *)area)[3100]\", but none occurred\n    not ok 46 - vmalloc_oob\n    not ok 1 - kasan\n\n==================================================================\nAfter fix:\n    ok 1 - kasan","publishedAt":"2025-02-26T01:54:12.130Z","updatedAt":"2026-05-23T15:20:23.390Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"CISA-ADP"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"cbd18991e24fea2c31da3bb117c83e4a3538cd11","status":"affected","lessThan":"7f19245c3647afea8c7c41f795506ef70f64b9f2","versionType":"git"},{"version":"cbd18991e24fea2c31da3bb117c83e4a3538cd11","status":"affected","lessThan":"f39a3309393a4a484532f6ba745c6acbcfe06115","versionType":"git"},{"version":"cbd18991e24fea2c31da3bb117c83e4a3538cd11","status":"affected","lessThan":"5a3d8f3192a409893c57808cc935e16484df1068","versionType":"git"},{"version":"cbd18991e24fea2c31da3bb117c83e4a3538cd11","status":"affected","lessThan":"de56beace6648065d404cd9835aa7d30e3df519d","versionType":"git"},{"version":"cbd18991e24fea2c31da3bb117c83e4a3538cd11","status":"affected","lessThan":"e3d157a4b4f4e0268c98be5b7013bf4b31234bb6","versionType":"git"},{"version":"cbd18991e24fea2c31da3bb117c83e4a3538cd11","status":"affected","lessThan":"dd75080aa8409ce10d50fb58981c6b59bf8707d3","versionType":"git"},{"version":"3822dd8c102d11ada9d9ed8e04cad0b347a04689","status":"affected","versionType":"git"},{"version":"5.3.6","status":"affected","lessThan":"5.4","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["arch/powerpc/mm/kasan/kasan_init_32.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.4","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.4","versionType":"semver"},{"version":"5.4.189","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.110","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.33","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"5.16.19","status":"unaffected","lessThanOrEqual":"5.16.*","versionType":"semver"},{"version":"5.17.2","status":"unaffected","lessThanOrEqual":"5.17.*","versionType":"semver"},{"version":"5.18","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["arch/powerpc/mm/kasan/kasan_init_32.c"]}],"references":["https://git.kernel.org/stable/c/7f19245c3647afea8c7c41f795506ef70f64b9f2","https://git.kernel.org/stable/c/f39a3309393a4a484532f6ba745c6acbcfe06115","https://git.kernel.org/stable/c/5a3d8f3192a409893c57808cc935e16484df1068","https://git.kernel.org/stable/c/de56beace6648065d404cd9835aa7d30e3df519d","https://git.kernel.org/stable/c/e3d157a4b4f4e0268c98be5b7013bf4b31234bb6","https://git.kernel.org/stable/c/dd75080aa8409ce10d50fb58981c6b59bf8707d3"],"weaknesses":["CWE-787"],"ingestedAt":"2026-10-29T19:49:19.404Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2021/47xxx/CVE-2021-47640.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2021-47640","state":"PUBLISHED","datePublished":"2025-02-26T01:54:12.130Z","dateUpdated":"2026-05-23T15:20:23.390Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-02-26T01:48:21.519Z"},"containers":{"cna":{"title":"powerpc/kasan: Fix early region not updated correctly","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\npowerpc/kasan: Fix early region not updated correctly\n\nThe shadow's page table is not updated when PTE_RPN_SHIFT is 24\nand PAGE_SHIFT is 12. It not only causes false positives but\nalso false negative as shown the following text.\n\nFix it by bringing the logic of kasan_early_shadow_page_entry here.\n\n1. False Positive:\n==================================================================\nBUG: KASAN: vmalloc-out-of-bounds in pcpu_alloc+0x508/0xa50\nWrite of size 16 at addr f57f3be0 by task swapper/0/1\n\nCPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.15.0-12267-gdebe436e77c7 #1\nCall Trace:\n[c80d1c20] [c07fe7b8] dump_stack_lvl+0x4c/0x6c (unreliable)\n[c80d1c40] [c02ff668] print_address_description.constprop.0+0x88/0x300\n[c80d1c70] [c02ff45c] kasan_report+0x1ec/0x200\n[c80d1cb0] [c0300b20] kasan_check_range+0x160/0x2f0\n[c80d1cc0] [c03018a4] memset+0x34/0x90\n[c80d1ce0] [c0280108] pcpu_alloc+0x508/0xa50\n[c80d1d40] [c02fd7bc] __kmem_cache_create+0xfc/0x570\n[c80d1d70] [c0283d64] kmem_cache_create_usercopy+0x274/0x3e0\n[c80d1db0] [c2036580] init_sd+0xc4/0x1d0\n[c80d1de0] [c00044a0] do_one_initcall+0xc0/0x33c\n[c80d1eb0] [c2001624] kernel_init_freeable+0x2c8/0x384\n[c80d1ef0] [c0004b14] kernel_init+0x24/0x170\n[c80d1f10] [c001b26c] ret_from_kernel_thread+0x5c/0x64\n\nMemory state around the buggy address:\n f57f3a80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8\n f57f3b00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8\n>f57f3b80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8\n                                               ^\n f57f3c00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8\n f57f3c80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8\n==================================================================\n\n2. False Negative (with KASAN tests):\n==================================================================\nBefore fix:\n    ok 45 - kmalloc_double_kzfree\n    # vmalloc_oob: EXPECTATION FAILED at lib/test_kasan.c:1039\n    KASAN failure expected in \"((volatile char *)area)[3100]\", but none occurred\n    not ok 46 - vmalloc_oob\n    not ok 1 - kasan\n\n==================================================================\nAfter fix:\n    ok 1 - kasan"}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"cbd18991e24fea2c31da3bb117c83e4a3538cd11","status":"affected","lessThan":"7f19245c3647afea8c7c41f795506ef70f64b9f2","versionType":"git"},{"version":"cbd18991e24fea2c31da3bb117c83e4a3538cd11","status":"affected","lessThan":"f39a3309393a4a484532f6ba745c6acbcfe06115","versionType":"git"},{"version":"cbd18991e24fea2c31da3bb117c83e4a3538cd11","status":"affected","lessThan":"5a3d8f3192a409893c57808cc935e16484df1068","versionType":"git"},{"version":"cbd18991e24fea2c31da3bb117c83e4a3538cd11","status":"affected","lessThan":"de56beace6648065d404cd9835aa7d30e3df519d","versionType":"git"},{"version":"cbd18991e24fea2c31da3bb117c83e4a3538cd11","status":"affected","lessThan":"e3d157a4b4f4e0268c98be5b7013bf4b31234bb6","versionType":"git"},{"version":"cbd18991e24fea2c31da3bb117c83e4a3538cd11","status":"affected","lessThan":"dd75080aa8409ce10d50fb58981c6b59bf8707d3","versionType":"git"},{"version":"3822dd8c102d11ada9d9ed8e04cad0b347a04689","status":"affected","versionType":"git"},{"version":"5.3.6","status":"affected","lessThan":"5.4","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["arch/powerpc/mm/kasan/kasan_init_32.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.4","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.4","versionType":"semver"},{"version":"5.4.189","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.110","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.33","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"5.16.19","status":"unaffected","lessThanOrEqual":"5.16.*","versionType":"semver"},{"version":"5.17.2","status":"unaffected","lessThanOrEqual":"5.17.*","versionType":"semver"},{"version":"5.18","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["arch/powerpc/mm/kasan/kasan_init_32.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/7f19245c3647afea8c7c41f795506ef70f64b9f2"},{"url":"https://git.kernel.org/stable/c/f39a3309393a4a484532f6ba745c6acbcfe06115"},{"url":"https://git.kernel.org/stable/c/5a3d8f3192a409893c57808cc935e16484df1068"},{"url":"https://git.kernel.org/stable/c/de56beace6648065d404cd9835aa7d30e3df519d"},{"url":"https://git.kernel.org/stable/c/e3d157a4b4f4e0268c98be5b7013bf4b31234bb6"},{"url":"https://git.kernel.org/stable/c/dd75080aa8409ce10d50fb58981c6b59bf8707d3"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-05-23T15:20:23.390Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.4","versionEndExcluding":"5.4.189"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.4","versionEndExcluding":"5.10.110"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.4","versionEndExcluding":"5.15.33"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.4","versionEndExcluding":"5.16.19"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.4","versionEndExcluding":"5.17.2"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.4","versionEndExcluding":"5.18"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.3.6"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"cvssV3_1":{"scope":"UNCHANGED","version":"3.1","baseScore":7.8,"attackVector":"LOCAL","baseSeverity":"HIGH","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","integrityImpact":"HIGH","userInteraction":"NONE","attackComplexity":"LOW","availabilityImpact":"HIGH","privilegesRequired":"LOW","confidentialityImpact":"HIGH"}},{"other":{"type":"ssvc","content":{"id":"CVE-2021-47640","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"total"}],"version":"2.0.3","timestamp":"2025-10-01T19:50:44.222623Z"}}}],"problemTypes":[{"descriptions":[{"cweId":"CWE-787","lang":"en","type":"CWE","description":"CWE-787 Out-of-bounds Write"}]}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2025-10-01T19:57:08.385Z"}}]}}}