From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752728AbdDIWVx (ORCPT ); Sun, 9 Apr 2017 18:21:53 -0400 Received: from mail-wr0-f181.google.com ([209.85.128.181]:36092 "EHLO mail-wr0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752567AbdDIWVo (ORCPT ); Sun, 9 Apr 2017 18:21:44 -0400 Date: Sun, 9 Apr 2017 23:21:42 +0100 From: Matt Fleming To: Omar Sandoval Cc: Ard Biesheuvel , Dave Young , Ingo Molnar , Peter Jones , linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH] x86/efi: don't try to reserve runtime regions Message-ID: <20170409222142.GA32464@codeblueprint.co.uk> References: <52d0b66c20ed7712eebcd82e642983e2877fbceb.1491349117.git.osandov@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52d0b66c20ed7712eebcd82e642983e2877fbceb.1491349117.git.osandov@fb.com> User-Agent: Mutt/1.5.24+41 (02bc14ed1569) (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 04 Apr, at 04:41:55PM, Omar Sandoval wrote: > From: Omar Sandoval > > 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 > --- > 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.