[PATCH 1/2] Remove the "mem=" parameter when using the --reuse-cmdline option in kdump operation

Youling Tang youling.tang at linux.dev
Wed Sep 24 23:32:40 PDT 2025


From: Youling Tang <tangyouling at kylinos.cn>

During kdump operations, the capture kernel cannot reuse the "mem="
parameter from the production kernel. The "mem=" parameter is used
to specify the available memory range for the kernel. Reusing the
"mem=" memory range may destroy the production environment.

Signed-off-by: Youling Tang <tangyouling at kylinos.cn>
---
 kexec/kexec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kexec/kexec.c b/kexec/kexec.c
index c9e4bcb..fadf986 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -1256,8 +1256,10 @@ char *get_command_line(void)
 		*p = '\0';
 
 	remove_parameter(line, "BOOT_IMAGE");
-	if (kexec_flags & KEXEC_ON_CRASH)
+	if (kexec_flags & KEXEC_ON_CRASH) {
 		remove_parameter(line, "crashkernel");
+		remove_parameter(line, "mem=");
+	}
 
 	return line;
 }
-- 
2.48.1




More information about the kexec mailing list