On Tue, 04 Apr, at 04:41:55PM, Omar Sandoval wrote:
> From: Omar Sandoval <osan...@fb.com>
> 
> Reserving a runtime region results in splitting the efi memory
> descriptors for the runtime region. This results in runtime region
> descriptors with bogus memory mappings, leading to interesting crashes
> like the following during a kexec:
 
[...]
 
> Runtime regions will not be freed and do not need to be reserved, so
> skip the memmap modification in this case.
> 
> Fixes: 8e80632fb23f ("efi/esrt: Use efi_mem_reserve() and avoid a kmalloc()")
> Signed-off-by: Omar Sandoval <osan...@fb.com>
> ---
>  arch/x86/platform/efi/quirks.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c
> index 30031d5293c4..cdfe8c628959 100644
> --- a/arch/x86/platform/efi/quirks.c
> +++ b/arch/x86/platform/efi/quirks.c
> @@ -201,6 +201,10 @@ void __init efi_arch_mem_reserve(phys_addr_t addr, u64 
> size)
>               return;
>       }
>  
> +     /* No need to reserve regions that will never be freed. */
> +     if (md.attribute & EFI_MEMORY_RUNTIME)
> +             return;
> +
>       size += addr % EFI_PAGE_SIZE;
>       size = round_up(size, EFI_PAGE_SIZE);
>       addr = round_down(addr, EFI_PAGE_SIZE);

Thanks Omar, I've picked this up for the urgent branch.

Reply via email to