[PATCH v11 05/11] riscv: kexec_file: Fix potential buffer overflow in prepare_elf_headers()

Guo Ren guoren at kernel.org
Sun Mar 29 20:47:30 PDT 2026


On Sat, Mar 28, 2026 at 3:41 PM Jinjie Ruan <ruanjinjie at huawei.com> wrote:
>
> There is a race condition between the kexec_load() system call
> (crash kernel loading path) and memory hotplug operations that can lead
> to buffer overflow and potential kernel crash.
riscv left no margin for hotplug in prepare_elf_headers(). Actually,
this check has been in crash_exclude_mem_range(); this patch makes it
happen earlier.

Although this patch has no real effect for riscv for the current. I
still give an acked-by, because it's a proper check step in this
callback.

Reviewed-by: Guo Ren <guoren at kernel.org>

-- 
Best Regards
 Guo Ren



More information about the linux-riscv mailing list