CVE-2023-52451: powerpc/pseries/memhp: Fix access beyond end of drmem array
In the Linux kernel, the following vulnerability has been resolved:
powerpc/pseries/memhp: Fix access beyond end of drmem array
dlparmemoryremovebyindex() may access beyond the bounds of the drmem lmb array when the LMB lookup fails to match an entry with the given DRC index. When the search fails, the cursor is left pointing to &drmeminfo->lmbs[drmeminfo->nlmbs], which is one element past the last valid entry in the array. The debug message at the end of the function then dereferences this pointer:
prdebug("Failed to hot-remove memory at %llx\n", lmb->baseaddr);
This was found by inspection and confirmed with KASAN:
pseries-hotplug-mem: Attempting to hot-remove LMB, drc index 1234 ================================================================== BUG: KASAN: slab-out-of-bounds in dlparmemory+0x298/0x1658 Read of size 8 at addr c000000364e97fd0 by task bash/949
dumpstacklvl+0xa4/0xfc (unreliable) printreport+0x214/0x63c kasanreport+0x140/0x2e0 asanload8+0xa8/0xe0 dlparmemory+0x298/0x1658 handledlparerrorlog+0x130/0x1d0 dlparstore+0x18c/0x3e0 kobjattrstore+0x68/0xa0 sysfskfwrite+0xc4/0x110 kernfsfopwriteiter+0x26c/0x390 vfswrite+0x2d4/0x4e0 ksyswrite+0xac/0x1a0 systemcallexception+0x268/0x530 systemcallvectoredcommon+0x15c/0x2ec
Allocated by task 1: kasansavestack+0x48/0x80 kasansettrack+0x34/0x50 kasansaveallocinfo+0x34/0x50 kasankmalloc+0xd0/0x120 kmalloc+0x8c/0x320 kmallocarray.constprop.0+0x48/0x5c drmeminit+0x2a0/0x41c dooneinitcall+0xe0/0x5c0 kernelinitfreeable+0x4ec/0x5a0 kernelinit+0x30/0x1e0 retfromkerneluserthread+0x14/0x1c
The buggy address belongs to the object at c000000364e80000 which belongs to the cache kmalloc-128k of size 131072 The buggy address is located 0 bytes to the right of allocated 98256-byte region [c000000364e80000, c000000364e97fd0)
================================================================== pseries-hotplug-mem: Failed to hot-remove memory at 0
Log failed lookups with a separate message and dereference the cursor only when it points to a valid entry.
Other sources
Linux Kernel is vulnerable to a denial of service, caused by an error related to access beyond end of drmem array. A local attacker could exploit this vulnerability to cause a denial of service.
— IBM
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2023-52451?
CVE-2023-52451 has been categorized with a severity that may allow memory access violations in the Linux kernel.
How do I fix CVE-2023-52451?
To remediate CVE-2023-52451, users should update their Linux kernel to versions 5.10.223-1, 5.10.226-1, 6.1.119-1, 6.1.123-1, 6.12.10-1, or 6.12.11-1.
Which versions of the Linux kernel are affected by CVE-2023-52451?
CVE-2023-52451 affects Linux kernel versions from 4.1.0 up to but not including 6.7.0.
Is CVE-2023-52451 a remote vulnerability?
CVE-2023-52451 is primarily related to local memory handling issues and does not directly constitute a remote exploitation risk.
What systems are vulnerable to CVE-2023-52451?
Systems running vulnerable versions of the Linux kernel, specifically versions between 4.1.0 and 6.7.0, are at risk of CVE-2023-52451.