In the Linux kernel, the following vulnerability has been resolved:
slub: fix data loss and overflow in krealloc()
Commit 2cd8231796b5 ("mm/slub: allow to set node and align in k[v]realloc") introduced the ability to force a reallocation if the original object does not satisfy new alignment or NUMA node, even when the object is being shrunk.
This introduced two bugs in the reallocation fallback path:
1. Data loss during NUMA migration: The jump to 'alloc_new' happens before 'ks' and 'orig_size' are initialized. As a result, the memcpy() in the 'alloc_new' block would copy 0 bytes into the new allocation.
2. Buffer overflow during shrinking: When shrinking an object while forcing a new alignment, 'new_size' is smaller than the old size. However, the memcpy() used the old size ('orig_size ?: ks'), leading to an out-of-bounds write.
The same overflow bug exists in the kvrealloc() fallback path, where the old bucket size ksize(p) is copied into the new buffer without being bounded by the new size.
A simple reproducer:
// e.g. add to lkdtm as KREALLOC_SHRINK_OVERFLOW while (1) { void *p = kmalloc(128, GFP_KERNEL); p = krealloc_node_align(p, 64, 256, GFP_KERNEL, NUMA_NO_NODE); kfree(p); }
demonstrates the issue:
================================================================== BUG: KFENCE: out-of-bounds write in memcpy_orig+0x68/0x130
Out-of-bounds write at 0xffff8883ad757038 (120B right of kfence-#47): memcpy_orig+0x68/0x130 krealloc_node_align_noprof+0x1c8/0x340 lkdtm_KREALLOC_SHRINK_OVERFLOW+0x8c/0xc0 [lkdtm] lkdtm_do_action+0x3a/0x60 [lkdtm] ...
kfence-#47: 0xffff8883ad756fc0-0xffff8883ad756fff, size=64, cache=kmalloc-64
allocated by task 316 on cpu 7 at 97.680481s (0.021813s ago): krealloc_node_align_noprof+0x19c/0x340 lkdtm_KREALLOC_SHRINK_OVERFLOW+0x8c/0xc0 [lkdtm] lkdtm_do_action+0x3a/0x60 [lkdtm] ... ==================================================================
Fix it by moving the old size calculation to the top of __do_krealloc() and bounding all copy lengths by the new allocation size.
CVSS Details
- CVSS 3.1 Base Score: 5.5
- CVSS 3.1 Vector: (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H)
Covered by Rapid7
| Product | Vendor Advisory | Solution File | Added | Published |
|---|---|---|---|---|
| Amazon_linux_2023 | — | Upgrade kernel6.18-debuginfo-common-aarch64Upgrade perf6.18-debuginfoUpgrade bpftool6.18Upgrade bpftool6.18-debuginfoUpgrade kernel6.18-tools-debuginfoUpgrade kernel6.18-modules-extra-commonUpgrade python3-perf6.18Upgrade perf6.18Upgrade python3-perf6.18-debuginfoUpgrade kernel6.18-debuginfoUpgrade kernel6.18Upgrade kernel6.18-headersUpgrade kernel6.18-debuginfo-common-x86_64Upgrade kernel6.18-tools-develUpgrade kernel6.18-modules-extraUpgrade kernel6.18-develUpgrade kernel-livepatch-6.18.30-61.116Upgrade kernel6.18-tools | Jun 23, 2026 | May 27, 2026 |
| Ubuntu | — | Upgrade linux-image-7.0.0-1014-raspiUpgrade linux-image-7.0.0-1014-raspi-realtimeUpgrade linux-image-aws-7.0Upgrade linux-image-nvidia-64k-7.0Upgrade linux-image-7.0.0-1007-gcpUpgrade linux-image-raspi-realtime-7.0Upgrade linux-image-oem-24.04bUpgrade linux-image-7.0.0-28-genericUpgrade linux-image-oracleUpgrade linux-image-7.0.0-1013-nvidiaUpgrade linux-image-7.0.0-27-genericUpgrade linux-image-azure-fdeUpgrade linux-image-raspi-7.0Upgrade linux-image-realtimeUpgrade linux-image-7.0.0-1010-azureUpgrade linux-image-raspiUpgrade linux-image-generic-64k-hwe-24.04Upgrade linux-image-7.0.0-1008-aws-64kUpgrade linux-image-aws-64k-7.0Upgrade linux-image-nvidiaUpgrade linux-image-generic-64k-hwe-26.04Upgrade linux-image-realtime-7.0Upgrade linux-image-7.0.0-28-generic-64kUpgrade linux-image-7.0.0-27-realtime-64kUpgrade linux-image-awsUpgrade linux-image-gcp-64kUpgrade linux-image-oem-26.04aUpgrade linux-image-oem-26.04Upgrade linux-image-gcp-64k-7.0Upgrade linux-image-genericUpgrade linux-image-nvidia-7.0Upgrade linux-image-gcp-7.0Upgrade linux-image-7.0.0-27-generic-64kUpgrade linux-image-azure-fde-7.0Upgrade linux-image-7.0.0-1008-awsUpgrade linux-image-7.0.0-1009-ibmUpgrade linux-image-raspi-realtimeUpgrade linux-image-oem-24.04aUpgrade linux-image-virtualUpgrade linux-image-7.0.0-27-realtimeUpgrade linux-image-oracle-7.0Upgrade linux-image-oem-24.04cUpgrade linux-image-7.0.0-1007-oracleUpgrade linux-image-nvidia-64kUpgrade linux-image-virtual-hwe-26.04Upgrade linux-image-virtual-7.0Upgrade linux-image-generic-7.0Upgrade linux-image-7.0.0-1013-nvidia-64kUpgrade linux-image-generic-hwe-26.04Upgrade linux-image-realtime-64k-7.0Upgrade linux-image-oem-24.04Upgrade linux-image-azure-7.0Upgrade linux-image-virtual-hwe-24.04Upgrade linux-image-oracle-64kUpgrade linux-image-gcpUpgrade linux-image-7.0.0-1007-oracle-64kUpgrade linux-image-7.0.0-1008-oemUpgrade linux-image-7.0.0-1007-gcp-64kUpgrade linux-image-oem-7.0Upgrade linux-image-ibmUpgrade linux-image-oracle-64k-7.0Upgrade linux-image-oem-24.04dUpgrade linux-image-generic-hwe-24.04Upgrade linux-image-generic-64k-7.0Upgrade linux-image-ibm-7.0Upgrade linux-image-generic-64kUpgrade linux-image-realtime-hwe-26.04Upgrade linux-image-realtime-64k-hwe-26.04Upgrade linux-image-realtime-64kUpgrade linux-image-7.0.0-1009-azure-fdeUpgrade linux-image-azureUpgrade linux-image-aws-64k | Jul 1, 2026 | May 27, 2026 |
Prioritise with Active Threat Intelligence
With curated Threat Intelligence, you can see which vulnerabilities truly put you at risk, prioritize what matters most, and act before attackers do.
Explore Intelligence Hub