CVE-2024-38585: tools/nolibc/stdlib: fix memory error in realloc()
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
tools/nolibc/stdlib: fix memory error in realloc()
Pass user_p_len to memcpy() instead of heap->len to prevent realloc() from copying an extra sizeof(heap) bytes from beyond the allocated region.
The Linux kernel CVE team has assigned CVE-2024-38585 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.19 with commit 0e0ff638400b and fixed in 6.1.93 with commit 5996b2b2dac7 Issue introduced in 5.19 with commit 0e0ff638400b and fixed in 6.6.33 with commit f678c3c33655 Issue introduced in 5.19 with commit 0e0ff638400b and fixed in 6.8.12 with commit 8019d3dd921f Issue introduced in 5.19 with commit 0e0ff638400b and fixed in 6.9.3 with commit 4e6f225aefeb Issue introduced in 5.19 with commit 0e0ff638400b and fixed in 6.10-rc1 with commit 791f4641142e
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2024-38585
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
tools/include/nolibc/stdlib.h
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/5996b2b2dac739f2a27da13de8eee5b85b2550b3 https://git.kernel.org/stable/c/f678c3c336559cf3255a32153e9a17c1be4e7c15 https://git.kernel.org/stable/c/8019d3dd921f39a237a9fab6d2ce716bfac0f983 https://git.kernel.org/stable/c/4e6f225aefeb712cdb870176b6621f02cf235b8c https://git.kernel.org/stable/c/791f4641142e2aced85de082e5783b4fb0b977c2