From patchwork Fri Jun 30 13:32:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 114729 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10380598vqr; Fri, 30 Jun 2023 06:51:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7jtRBtlskOvCdpqNzST4v+kk93o1d5miLboxjDMEul7zRq3KspMimin32kXE/r5wFBLOnP X-Received: by 2002:a05:6870:73cd:b0:1b0:68f7:da8 with SMTP id a13-20020a05687073cd00b001b068f70da8mr3148210oan.12.1688133101176; Fri, 30 Jun 2023 06:51:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688133101; cv=none; d=google.com; s=arc-20160816; b=e/hetzjNyKvyxB+gRSMs2QXyOLdmtcoRl3yoQzNGW63leWjO+J/braWLDmdi/AoYhy 3HX/ca54B6HfN6whjAsm5uIBJN4kjeBKa/fB28ZwbGCY9LqvjVczEwlhvDOhb/jWUKIo Bw7aoD3rXNNbtCf9TKmuG/GFtnRHa8BSGh5H9KmMKE0kc0z7xISr/CFtWjL8hYx4oRgw j4GbSDMAAYgX9q48uIzboLTjDo1mf6lFmIHWTZ59LVZYQHEJekjqImfiJAhXeozn9SnW C72XNI+PdbNyPiwin14WlnXmHFEfs0P/9Ep91nQ6ZhbsTJFdifVNmfsP6VntJkV69sIS 7rOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=5Ct27fAT+6XX7UPKXfhBWOCjOGHDjnQ44IBDaz+qjbw=; fh=NMLqItAOQQQT+hVAVNmhdjXT1gZWgEDLI4gymnBT3gQ=; b=GDV3W+SJMuRSsVeAVO1HmmI6ro0Ce362KQmlj5F2GnXjIN3ZGk7xenaRf03Li9on// 9DZbv7BsCdtm28qTnHBfarqsJARmIGL9+X6gs620EOMy5Jra3GIsgHq+iVFvCccv14G8 5oSEXkNojM/paTvltpxZ5aMXhvM7tRkhN9Tm/xsPjkUpZgevIHLsI5nRXmMOcBFH8DS8 ZyEQY4NdsT6u3uPX0acenadQLdGAmiV6LxJq55MVSBOJ22blT5LR5zFYPXfWJJKXJwER MfHVYB5BPaT9T8DbAEB02e+4QuZ80wfIAieoeDot5eqMAT0u+65BElMS7uWnSF/apw5o aLpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=hfRme7N5; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a17090a728900b00263337c8329si5484648pjg.156.2023.06.30.06.51.25; Fri, 30 Jun 2023 06:51:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=hfRme7N5; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232636AbjF3Ncj (ORCPT + 99 others); Fri, 30 Jun 2023 09:32:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232619AbjF3Ncf (ORCPT ); Fri, 30 Jun 2023 09:32:35 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7341B359E; Fri, 30 Jun 2023 06:32:21 -0700 (PDT) Date: Fri, 30 Jun 2023 13:32:19 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1688131940; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5Ct27fAT+6XX7UPKXfhBWOCjOGHDjnQ44IBDaz+qjbw=; b=hfRme7N5dKXKo5O1TO8gz0XfuS+yInortheRRP39ifAjWip5iS8uieiiZ/+Tro9hYD4DRn Cj6BL2SaWZ09364aGxDA9D2a/pGZwDhLL+JLdnw9s6gowhiQE/BR+JLaqAHw6ohBNFE4Zp h+147ndUyUHUJMDa3lFxjjrckmEMSNY29oCuwFsq/Bn3zQwF7LfqHhQQJm0xgi6/JJzqgr Z8/38yj9CX9XYzP/HVBwdaSsfEbgfNUVFLpSz0+32b/tpQ+V38m2BJzpuPCfWkghd1IlKg rtUf2ADO233Zimskvr6niaXfrblijGnjJwJ27LAye7kb/Eq7qJGJXK4/eePT0w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1688131940; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5Ct27fAT+6XX7UPKXfhBWOCjOGHDjnQ44IBDaz+qjbw=; b=aqIZJQLhieGpMxed3LDBpQb2BhQrZARAV4obijh/ckkjZiqQf5VdwzRK6yXAYiefxbBr24 HlLZnoBeC4DVY5Cg== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/efi: Make efi_set_virtual_address_map IBT safe Cc: pinkflames.linux@gmail.com, Thomas Gleixner , Ard Biesheuvel , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <87jzvm12q0.ffs@tglx> References: <87jzvm12q0.ffs@tglx> MIME-Version: 1.0 Message-ID: <168813193932.404.2885732890333911092.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770067860554361577?= X-GMAIL-MSGID: =?utf-8?q?1770135854864157587?= The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 0303c9729afc4094ef53e552b7b8cff7436028d6 Gitweb: https://git.kernel.org/tip/0303c9729afc4094ef53e552b7b8cff7436028d6 Author: Thomas Gleixner AuthorDate: Thu, 29 Jun 2023 21:35:19 +02:00 Committer: Thomas Gleixner CommitterDate: Fri, 30 Jun 2023 15:26:24 +02:00 x86/efi: Make efi_set_virtual_address_map IBT safe Niklāvs reported a boot regression on an Alderlake machine and bisected it to commit 9df9d2f0471b ("init: Invoke arch_cpu_finalize_init() earlier"). By moving the invocation of arch_cpu_finalize_init() further down he identified that efi_enter_virtual_mode() is the function which causes the boot hang. The main difference of the earlier invocation is that the boot CPU is already fully initialized and mitigations and alternatives are applied. But the only really interesting change turned out to be IBT, which is now enabled before efi_enter_virtual_mode(). "ibt=off" on the kernel command line cured the problem. Inspection of the involved calls in efi_enter_virtual_mode() unearthed that efi_set_virtual_address_map() is the only place in the kernel which invokes an EFI call without the IBT safe wrapper. This went obviously unnoticed so far as IBT was enabled later. Use arch_efi_call_virt() instead of efi_call() to cure that. Fixes: fe379fa4d199 ("x86/ibt: Disable IBT around firmware") Fixes: 9df9d2f0471b ("init: Invoke arch_cpu_finalize_init() earlier") Reported-by: Niklāvs Koļesņikovs Signed-off-by: Thomas Gleixner Reviewed-by: Ard Biesheuvel Link: https://bugzilla.kernel.org/show_bug.cgi?id=217602 Link: https://lore.kernel.org/r/87jzvm12q0.ffs@tglx --- arch/x86/platform/efi/efi_64.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index 232acf4..77f7ac3 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c @@ -853,9 +853,9 @@ efi_set_virtual_address_map(unsigned long memory_map_size, /* Disable interrupts around EFI calls: */ local_irq_save(flags); - status = efi_call(efi.runtime->set_virtual_address_map, - memory_map_size, descriptor_size, - descriptor_version, virtual_map); + status = arch_efi_call_virt(efi.runtime, set_virtual_address_map, + memory_map_size, descriptor_size, + descriptor_version, virtual_map); local_irq_restore(flags); efi_fpu_end();