From patchwork Wed Nov 6 17:06:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 1190553 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 477Xxz1tTLz9sPK; Thu, 7 Nov 2019 04:06:47 +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 1iSOlW-0000pQ-Fk; Wed, 06 Nov 2019 17:06:42 +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 1iSOlV-0000pK-7L for kernel-team@lists.ubuntu.com; Wed, 06 Nov 2019 17:06:41 +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 1iSOlU-0002EO-VG; Wed, 06 Nov 2019 17:06:41 +0000 From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [SRU B/C/D/E][bionic/master-next 1/1] LP#1836079 efi: efi_get_memory_map -- increase map headroom Date: Wed, 6 Nov 2019 17:06:40 +0000 Message-Id: <20191106170640.83841-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. 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 reallocate the buffer so we panic. To avoid this we allocate some additional entries in the buffer to cover any additional entries. These are currently insufficient for these machines in this use case. Increase EFI_MMAP_NR_SLACK_SLOTS to provide space for more map modifications. BugLink: http://bugs.launchpad.net/bugs/1836079 Signed-off-by: Andy Whitcroft --- 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;