[PATCH 1/2] Remove the "mem=" parameter when using the --reuse-cmdline option in kdump operation
Dave Young
dyoung at redhat.com
Thu Sep 25 02:34:14 PDT 2025
On Thu, 25 Sept 2025 at 17:26, Youling Tang <youling.tang at linux.dev> wrote:
>
> Hi, Dave
>
> On 9/25/25 17:11, Dave Young wrote:
> > Hi Youling,
> >
> > On Thu, 25 Sept 2025 at 14:33, Youling Tang <youling.tang at linux.dev> wrote:
> >> 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=");
> >> + }
> > People can remove it from the kdump load scripts instead if it is not
> > useful. I do not suggest removing other cmdline in c code. The
> > crashkernel is a special one which is fine.
> Removing it in scripts is also acceptable. However, reusing the
> production kernel's
> "mem=" parameter will inevitably damage the production environment. In
> my view,
> modifying it in C code can achieve a permanent solution (avoiding the
> need to
> modify kdump services for each distribution, and also applicable to
> non-kdump
> services scenarios where commands are executed directly).
But the param is a general one, not specific for kexec, people can use
it in their own way, eg. use less memory to boot a machine for debug
purposes. This is why I suggest doing it in scripts and
distributions.
The two kdump related param, crashkernel and elfcorehdr are special anyway.
>
> Thanks,
> Youling.
> >> return line;
> >> }
> >> --
> >> 2.48.1
> >>
> >>
> > Thanks
> > Dave
> >
>
More information about the kexec
mailing list