From: Mike Galbraith <efault@gmx.de>
To: Dave Young <dyoung@redhat.com>
Cc: Baoquan He <bhe@redhat.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86, kdump: Fix efi=noruntime NULL pointer dereference
Date: Fri, 10 Aug 2018 12:23:01 +0200 [thread overview]
Message-ID: <1533896581.5885.16.camel@gmx.de> (raw)
In-Reply-To: <20180810084501.GA11901@dhcp-128-65.nay.redhat.com>
On Fri, 2018-08-10 at 16:45 +0800, Dave Young wrote:
>
> BTW, this patch only fix the kexec load phase problem, even if kexec
> load successfully with the fix, the 2nd kernel can not boot because efi
> memmap info is not correct and usable.
Hm. I didn't do anything else with kexec, but did crashdump my box
both w/wo efi=noruntime.
> So we should go with some fix similar to below, and do the cleanup we
> mentioned with a separate patch later.
Ah, you mean the one I had _just_ built when I saw this :)
> Also user space kexec-tools need a similar patch to error out in case
> no runtime maps. It would be good to fix both userspace and kernel
> load.
>
> diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c
> index 7326078eaa7a..e34ba2f53cfb 100644
> --- a/arch/x86/kernel/kexec-bzimage64.c
> +++ b/arch/x86/kernel/kexec-bzimage64.c
> @@ -123,7 +123,7 @@ static int setup_efi_info_memmap(struct boot_params *params,
> struct efi_info *ei = ¶ms->efi_info;
>
> if (!efi_map_sz)
> - return 0;
> + return -EINVAL;
>
> efi_runtime_map_copy(efi_map, efi_map_sz);
>
> @@ -166,9 +166,10 @@ setup_efi_state(struct boot_params *params, unsigned long params_load_addr,
> {
> struct efi_info *current_ei = &boot_params.efi_info;
> struct efi_info *ei = ¶ms->efi_info;
> + int ret;
>
> if (!current_ei->efi_memmap_size)
> - return 0;
> + return -EINVAL;
>
> /*
> * If 1:1 mapping is not enabled, second kernel can not setup EFI
> @@ -176,8 +177,8 @@ setup_efi_state(struct boot_params *params, unsigned long params_load_addr,
> * acpi_rsdp=<addr> on kernel command line to make second kernel boot
> * without efi.
> */
> - if (efi_enabled(EFI_OLD_MEMMAP))
> - return 0;
> + if (efi_enabled(EFI_OLD_MEMMAP) || !efi_enabled(EFI_RUNTIME_SERVICES))
> + return -ENODEV;
>
> ei->efi_loader_signature = current_ei->efi_loader_signature;
> ei->efi_systab = current_ei->efi_systab;
> @@ -186,8 +187,10 @@ setup_efi_state(struct boot_params *params, unsigned long params_load_addr,
> ei->efi_memdesc_version = current_ei->efi_memdesc_version;
> ei->efi_memdesc_size = efi_get_runtime_map_desc_size();
>
> - setup_efi_info_memmap(params, params_load_addr, efi_map_offset,
> + ret = setup_efi_info_memmap(params, params_load_addr, efi_map_offset,
> efi_map_sz);
> + if (ret)
> + return ret;
> prepare_add_efi_setup_data(params, params_load_addr,
> efi_setup_data_offset);
> return 0;
> @@ -250,8 +253,10 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params,
>
> #ifdef CONFIG_EFI
> /* Setup EFI state */
> - setup_efi_state(params, params_load_addr, efi_map_offset, efi_map_sz,
> + ret = setup_efi_state(params, params_load_addr, efi_map_offset, efi_map_sz,
> efi_setup_data_offset);
> + if (ret)
> + return ret;
> #endif
>
> /* Setup EDD info */
next prev parent reply other threads:[~2018-08-10 10:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-08 14:03 [PATCH] x86, kdump: Fix efi=noruntime NULL pointer dereference Mike Galbraith
2018-08-09 4:21 ` Dave Young
2018-08-09 5:05 ` Mike Galbraith
2018-08-09 7:33 ` Mike Galbraith
2018-08-09 9:13 ` Dave Young
2018-08-21 13:39 ` Ard Biesheuvel
2018-08-22 10:23 ` Dave Young
2018-08-23 3:57 ` Dave Young
2018-08-23 4:08 ` Mike Galbraith
2018-08-24 4:48 ` Mike Galbraith
2018-08-24 6:49 ` Dave Young
2018-08-10 8:45 ` Dave Young
2018-08-10 10:23 ` Mike Galbraith [this message]
2018-08-10 10:28 ` Dave Young
2018-08-10 17:39 ` Mike Galbraith
2018-08-15 3:59 ` Dave Young
2018-08-15 4:57 ` Mike Galbraith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1533896581.5885.16.camel@gmx.de \
--to=efault@gmx.de \
--cc=bhe@redhat.com \
--cc=bigeasy@linutronix.de \
--cc=dyoung@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox