From patchwork Tue Mar 3 08:06:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 206497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BDFEC3F2CD for ; Tue, 3 Mar 2020 08:06:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E3E4820CC7 for ; Tue, 3 Mar 2020 08:06:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583222818; bh=woSE0T1/mPucInnvKy6XmS0LeBbHNgQ0XzBMVOTpWvU=; h=From:To:Cc:Subject:Date:List-ID:From; b=Zcj/pa/GerZ2tbHpo0spjnnZEpeCvwNwpIJp1fVZbVOnraxSfWjMsanrNLCe19tTC oWvC8TodW0d2HlL96Ag7pWCunlbz3/5GCt2aDOQQpXjTkGuaOVkaOVFblvLQxU6XWb OycaKYE+qfH3l4Qeofwo2LN1G4vpMsiAq0ZLZxV0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727744AbgCCIG5 (ORCPT ); Tue, 3 Mar 2020 03:06:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:46664 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727726AbgCCIG5 (ORCPT ); Tue, 3 Mar 2020 03:06:57 -0500 Received: from e123331-lin.home (amontpellier-657-1-18-247.w109-210.abo.wanadoo.fr [109.210.65.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1157820CC7; Tue, 3 Mar 2020 08:06:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583222816; bh=woSE0T1/mPucInnvKy6XmS0LeBbHNgQ0XzBMVOTpWvU=; h=From:To:Cc:Subject:Date:From; b=eC5sD1GgEQRRk2vfp8M+bmAbjqQQz1y88qRyuVlpEVV5F2d3J9073R/kUDaGaZj54 Ii/vQ8yRwdDLgcH1tXozqebFdKrAa5yOmvXi24v/e+otS+u64C6G6+gc+WEmWFHVlM qaep8vOE1wvAMfoHJNPqXofQPMSRbYM17WuGvRK0= From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: Ard Biesheuvel , Nathan Chancellor Subject: [PATCH] efi/libstub/x86: deal with exit() boot service returning Date: Tue, 3 Mar 2020 09:06:48 +0100 Message-Id: <20200303080648.21427-1-ardb@kernel.org> X-Mailer: git-send-email 2.17.1 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Even though it is uncommon, there are cases where the Exit() EFI boot service might return, e.g., when we were booted via the EFI handover protocol from OVMF and the kernel image was specified on the command line, in which case Exit() attempts to terminate the boot manager, which is not an EFI application itself. So let's drop into a deadloop instead. Cc: Nathan Chancellor Signed-off-by: Ard Biesheuvel --- As a side effect, this also fixes [0], which is as yet undiagnosed. [0] https://github.com/ClangBuiltLinux/linux/issues/917 drivers/firmware/efi/libstub/x86-stub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c index 7f3e97c2aad3..5c7480c4d379 100644 --- a/drivers/firmware/efi/libstub/x86-stub.c +++ b/drivers/firmware/efi/libstub/x86-stub.c @@ -344,7 +344,7 @@ static void setup_graphics(struct boot_params *boot_params) static void __noreturn efi_exit(efi_handle_t handle, efi_status_t status) { efi_bs_call(exit, handle, status, 0, NULL); - unreachable(); + for(;;); } void startup_32(struct boot_params *boot_params);