From patchwork Fri Nov 8 10:25:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 1191794 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 478byT4Mzsz9sPk; Fri, 8 Nov 2019 21:25:53 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1iT1Se-0005ZW-IZ; Fri, 08 Nov 2019 10:25:48 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iT1Sc-0005ZB-NH for kernel-team@lists.ubuntu.com; Fri, 08 Nov 2019 10:25:46 +0000 Received: from 1.general.apw.uk.vpn ([10.172.192.78] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iT1Sc-0001mC-HQ; Fri, 08 Nov 2019 10:25:46 +0000 From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [SRU B/D/E/F V2 1/1] efi: efi_get_memory_map -- increase map headroom Date: Fri, 8 Nov 2019 10:25:46 +0000 Message-Id: <20191108102546.233856-1-apw@canonical.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andy Whitcroft Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" We are seeing some EFI based machines failing to boot hard in the EFI stub: exit_boot() failed! efi_main() failed! This seems to occur when the bootloader (grub2 in this case) has had to manipulate some additional files due to a change in the way MAAS boots the machines. We tracked this down to the memory map dance efi_get_memory_map(). Basically we attempt to close boot services and it informs us it cannot do so because it failed to record the updated memory map. This occurs when there is insufficient space in the passed memory map buffer to record changes during the operation. At the point when this occurs we are unable to call the allocation functions to reallocate the buffer so we panic. To avoid this we allocate some additional entries in the buffer to cover any additional entries. This headroom is currently insufficient for these machines under this use case. Increase EFI_MMAP_NR_SLACK_SLOTS to provide space for more memory map modifications. BugLink: https://bugs.launchpad.net/bugs/1851810 Signed-off-by: Andy Whitcroft Acked-by: Seth Forshee Acked-by: Stefan Bader --- drivers/firmware/efi/libstub/efi-stub-helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c index 39f87e6dac5c..957dff5a26a2 100644 --- a/drivers/firmware/efi/libstub/efi-stub-helper.c +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c @@ -49,7 +49,7 @@ int __pure novamap(void) return __novamap; } -#define EFI_MMAP_NR_SLACK_SLOTS 8 +#define EFI_MMAP_NR_SLACK_SLOTS 16 struct file_info { efi_file_handle_t *handle;