The patch titled Subject: crash: fix crash memory reserve exceed system memory bug has been added to the -mm mm-nonmm-unstable branch. Its filename is crash-fix-crash-memory-reserve-exceed-system-memory-bug.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/crash-fix-crash-memory-reserve-exceed-system-memory-bug.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Jinjie Ruan <ruanjinjie@xxxxxxxxxx> Subject: crash: fix crash memory reserve exceed system memory bug Date: Mon, 29 Jul 2024 19:52:52 +0800 On x86_32 Qemu machine with 1GB memory, the cmdline "crashkernel=4G" is ok as below: crashkernel reserved: 0x0000000020000000 - 0x0000000120000000 (4096 MB) It's similar on other architectures, such as ARM32 and RISCV32. The cause is that the crash_size is parsed and printed with "unsigned long long" data type which is 8 bytes but allocated used with "phys_addr_t" which is 4 bytes in memblock_phys_alloc_range(). Fix it by checking if crash_size is greater than system RAM size and return error if so. After this patch, there is no above confusing reserve success info. Link: https://lkml.kernel.org/r/20240729115252.1659112-1-ruanjinjie@xxxxxxxxxx Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx> Suggested-by: Mike Rapoport <rppt@xxxxxxxxxx> Acked-by: Baoquan He <bhe@xxxxxxxxxx> Cc: Albert Ou <aou@xxxxxxxxxxxxxxxxx> Cc: Dave Young <dyoung@xxxxxxxxxx> Cc: Palmer Dabbelt <palmer@xxxxxxxxxxx> Cc: Paul Walmsley <paul.walmsley@xxxxxxxxxx> Cc: Vivek Goyal <vgoyal@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/crash_reserve.c | 3 +++ 1 file changed, 3 insertions(+) --- a/kernel/crash_reserve.c~crash-fix-crash-memory-reserve-exceed-system-memory-bug +++ a/kernel/crash_reserve.c @@ -335,6 +335,9 @@ int __init parse_crashkernel(char *cmdli if (!*crash_size) ret = -EINVAL; + if (*crash_size >= system_ram) + ret = -EINVAL; + return ret; } _ Patches currently in -mm which might be from ruanjinjie@xxxxxxxxxx are crash-fix-x86_32-crash-memory-reserve-dead-loop-bug.patch crash-fix-x86_32-crash-memory-reserve-dead-loop.patch arm-use-generic-interface-to-simplify-crashkernel-reservation.patch crash-fix-crash-memory-reserve-exceed-system-memory-bug.patch