CVE-2022-50765
Unknown Unknown - Not Provided
Memory Leak in Linux Kernel RISC-V kexec elf Header Buffer

Publication date: 2025-12-24

Last updated on: 2025-12-24

Assigner: kernel.org

Description
In the Linux kernel, the following vulnerability has been resolved: RISC-V: kexec: Fix memory leak of elf header buffer This is reported by kmemleak detector: unreferenced object 0xff2000000403d000 (size 4096): comm "kexec", pid 146, jiffies 4294900633 (age 64.792s) hex dump (first 32 bytes): 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 .ELF............ 04 00 f3 00 01 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000566ca97c>] kmemleak_vmalloc+0x3c/0xbe [<00000000979283d8>] __vmalloc_node_range+0x3ac/0x560 [<00000000b4b3712a>] __vmalloc_node+0x56/0x62 [<00000000854f75e2>] vzalloc+0x2c/0x34 [<00000000e9a00db9>] crash_prepare_elf64_headers+0x80/0x30c [<0000000067e8bf48>] elf_kexec_load+0x3e8/0x4ec [<0000000036548e09>] kexec_image_load_default+0x40/0x4c [<0000000079fbe1b4>] sys_kexec_file_load+0x1c4/0x322 [<0000000040c62c03>] ret_from_syscall+0x0/0x2 In elf_kexec_load(), a buffer is allocated via vzalloc() to store elf headers. While it's not freed back to system when kdump kernel is reloaded or unloaded, or when image->elf_header is successfully set and then fails to load kdump kernel for some reason. Fix it by freeing the buffer in arch_kimage_file_post_load_cleanup().
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2025-12-24
Last Modified
2025-12-24
Generated
2026-05-07
AI Q&A
2025-12-24
EPSS Evaluated
2026-05-05
NVD
EUVD
Affected Vendors & Products
Showing 1 associated CPE
Vendor Product Version / Range
linux linux_kernel *
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-UNKNOWN
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

This vulnerability is a memory leak in the Linux kernel's RISC-V kexec functionality. Specifically, when loading ELF headers during a kexec operation, a buffer is allocated but not properly freed in certain failure scenarios, such as when reloading or unloading the kdump kernel or when the ELF header is set but the kdump kernel fails to load. This causes unreferenced memory to remain allocated, leading to a memory leak. The fix involves freeing this buffer during cleanup to prevent the leak.


How can this vulnerability impact me? :

The memory leak can cause increased memory usage over time, potentially leading to reduced system performance or stability issues, especially on systems frequently using kexec for kernel loading or crash dumping. This could result in resource exhaustion or system crashes if the leak is significant and not addressed.


How can this vulnerability be detected on my network or system? Can you suggest some commands?

This vulnerability can be detected using the kmemleak detector in the Linux kernel, which reports unreferenced memory objects related to the kexec process. You can check for memory leaks by enabling kmemleak and inspecting its output. For example, you can use the following commands: 1. Enable kmemleak (if not already enabled): echo scan > /sys/kernel/debug/kmemleak 2. Check for memory leaks: cat /sys/kernel/debug/kmemleak Look for entries related to 'kexec' and elf header buffers similar to the reported unreferenced object in the vulnerability description.


What immediate steps should I take to mitigate this vulnerability?

To mitigate this vulnerability, you should update your Linux kernel to a version where the fix has been applied. The fix involves freeing the elf header buffer in arch_kimage_file_post_load_cleanup() to prevent memory leaks during kexec operations. Applying the latest kernel patches or upgrading to a fixed kernel version will address this issue.


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart