The patch titled Subject: x86/kexec: prepend elfcorehdr instead of appending it to the crash-kernel command-line. has been added to the -mm tree. Its filename is prepend-elfcorehdr-instead-of-appending-it-to-the-crash-kernel-command-line.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/prepend-elfcorehdr-instead-of-appending-it-to-the-crash-kernel-command-line.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/prepend-elfcorehdr-instead-of-appending-it-to-the-crash-kernel-command-line.patch 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/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: KarimAllah Ahmed <karahmed@xxxxxxxxx> Subject: x86/kexec: prepend elfcorehdr instead of appending it to the crash-kernel command-line. Any parameter passed after '--' in the kernel command-line will not be parsed by the kernel at all, instead it will be passed directly to init process. Currently the kernel appends elfcorehdr=<paddr> to the cmdline passed from kexec load, and if this command-line is used to pass parameters to init process this means that 'elfcorehdr' will not be parsed as a kernel parameter at all which will be a problem for vmcore subsystem since it will know nothing about the location of the ELF structure! Prepending 'elfcorehdr' instead of appending it fixes this problem since it ensures that it always comes before '--' and so it's always parsed as a kernel command-line parameter. Even with this patch things can still go wrong if 'CONFIG_CMDLINE' was also used to embedd a command-line to the crash dump kernel and this command-line contains '--' since the current behavior of the kernel is to actually append the boot loader command-line to the embedded command-line. Signed-off-by: KarimAllah Ahmed <karahmed@xxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: H. Peter Anvin <hpa@xxxxxxxxx> Cc: Vivek Goyal <vgoyal@xxxxxxxxxx> Cc: Haren Myneni <hbabu@xxxxxxxxxx> Cc: Eric Biederman <ebiederm@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/x86/kernel/kexec-bzimage64.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff -puN arch/x86/kernel/kexec-bzimage64.c~prepend-elfcorehdr-instead-of-appending-it-to-the-crash-kernel-command-line arch/x86/kernel/kexec-bzimage64.c --- a/arch/x86/kernel/kexec-bzimage64.c~prepend-elfcorehdr-instead-of-appending-it-to-the-crash-kernel-command-line +++ a/arch/x86/kernel/kexec-bzimage64.c @@ -72,15 +72,16 @@ static int setup_cmdline(struct kimage * unsigned long cmdline_len) { char *cmdline_ptr = ((char *)params) + cmdline_offset; - unsigned long cmdline_ptr_phys, len; + unsigned long cmdline_ptr_phys, len = 0; uint32_t cmdline_low_32, cmdline_ext_32; - memcpy(cmdline_ptr, cmdline, cmdline_len); if (image->type == KEXEC_TYPE_CRASH) { - len = sprintf(cmdline_ptr + cmdline_len - 1, - " elfcorehdr=0x%lx", image->arch.elf_load_addr); - cmdline_len += len; + len = sprintf(cmdline_ptr, + "elfcorehdr=0x%lx ", image->arch.elf_load_addr); } + memcpy(cmdline_ptr + len, cmdline, cmdline_len); + cmdline_len += len; + cmdline_ptr[cmdline_len - 1] = '\0'; pr_debug("Final command line is: %s\n", cmdline_ptr); _ Patches currently in -mm which might be from karahmed@xxxxxxxxx are prepend-elfcorehdr-instead-of-appending-it-to-the-crash-kernel-command-line.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html