vmalloc: fix buffer overflow in vrealloc_node_align()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
6.18.277.0.47.1In the Linux kernel, the following vulnerability has been resolved:
vmalloc: fix buffer overflow in vrealloc_node_align()
Commit 4c5d3365882d ("mm/vmalloc: allow to set node and align in vrealloc") added the ability to force a new allocation if the current pointer is on the wrong NUMA node, or if an alignment constraint is not met, even if the user is shrinking the allocation.
On this path (need_realloc), the code allocates a new object of 'size' bytes and then memcpy()s 'old_size' bytes into it. If the request is to shrink the object (size < old_size), this results in an out-of-bounds write on the new buffer.
Fix this by bounding the copy length by the new allocation size.
From the CVE record · Linux
The Linux kernel’s vrealloc_node_align() can write past a newly allocated buffer when a shrinking request forces reallocation because of a NUMA-node or alignment constraint. The supplied description does not specify whether an attacker can trigger this remotely or locally, whether authentication is needed, or whether user interaction is required.
Engineers running Linux kernels that include the affected vrealloc_node_align() behavior should check their versions; no affected version range was provided.