From patchwork Fri Jan 6 17:47:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13091662 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9BA5EC54E76 for ; Fri, 6 Jan 2023 17:48:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=zTlkZ379Dbor9SHKEdOVFFreOTthWEMMONKANC0tkOo=; b=BeI9yTuM1OgLUi Jitduz2zkc7vV2+ucwvpEveqV4ql0ODs4CCEd6EVex0v6nvWqTMXxmgFT1be+wAwMoL513tKetWMl uCKyQz7DOimsO4xKLpyv+OrBoBAyOjosuqdXeF5fds+1e8d9H6fNjNks5Bf2vczcQ2eYvDHv14Neg GkEWPaISGah8LfX+HY/pZWzHSGrjLTk8FvhmPJ9Y5e1H756CswZi6iFcnSD/reVq39gLHPo6m2ylZ bA5ll4zgLbk9rQA6s9dfN2D6nQrCx9EOOicmCaMK7e7aBPlTeyuC3qYqXYi5twz++UeQ+vsLFWUMh j5BIZWMSiEvXf2QFl4RA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDqoZ-00DVqN-LN; Fri, 06 Jan 2023 17:47:35 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDqoV-00DVic-It for linux-arm-kernel@lists.infradead.org; Fri, 06 Jan 2023 17:47:32 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1B263B81E42; Fri, 6 Jan 2023 17:47:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EF22C433EF; Fri, 6 Jan 2023 17:47:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673027248; bh=3vHzVE3ATz/h7AEpWm2ma7G8J5And5yeY2tgzOFOE5Y=; h=From:To:Cc:Subject:Date:From; b=O8GPmjBFagy7ddXg2XeflNlbBvWRc+u3i1TUQHDBYe861gkCa1d5rJLXAzYCalcHu lwpUF92hTumlNrUGPbsjOCSldm6xhTuwCIGFlcOUQEmdqdkpgSn38UbAkNO7wdNsJe rxX/qLI0k26kdYJwuGsYH2LemX4WLf+99/wgBlc2cEVb6y1AXR+oPfn5+XRCC2dmjP PRiLXTynmXgBk2KQ+PqhmHc/p+XZn1quMsGjUv2f3H1XWZQ42SVYuBLZ6uz+zx63+1 s7b8cFzwAdvJRjd6aOG2y1Y0YTfHwFL6RsKV+FVsMC13aIBndqLNXVdfKymO6K4PZ+ Udt91yh0dg5oA== From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, will@kernel.org, catalin.marinas@arm.com, Ard Biesheuvel , Mark Rutland , Lee Jones Subject: [PATCH v3 0/2] efi: Follow-up fixes for EFI runtime stack Date: Fri, 6 Jan 2023 18:47:01 +0100 Message-Id: <20230106174703.1883495-1-ardb@kernel.org> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1509; i=ardb@kernel.org; h=from:subject; bh=3vHzVE3ATz/h7AEpWm2ma7G8J5And5yeY2tgzOFOE5Y=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjuF6TummHytSd1zyVmT/ov5qlI1jUh+xm/m0B5bNg zuVQoA6JAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY7hekwAKCRDDTyI5ktmPJFyfDA CdOX79WZLHh2YWIE4pU356JwLs4OV+9kyM7WJwgcP5XQQRXUKP7yEuLLyEpYT+NV2/MDa/OpV2sik/ wcIfh73m8ClLvrDKJbjIJ2b9tQQePF6DXTZdGvK1T+Z17xJsd5tMbBRUlOaJVLuK+pEvB1g+14tvjc T+y7h8ix6ocCemfPAmE/BNxIFe1FKkwRKhoPOgAEjmGuq/7tHKa+mJb+mb/Q9O/Sw4/kSJjDoVVfB4 2c9WN4bx7lb5LSKpnkBVJQ5eauXxjPT1rdTCyiMah0ZR7K1pvbcOXvtNRkzN2v5VDY1eFdaoiqW1nL 6DLLdcKnfFaUMW0LiMM2vhpbN+zh9dq9xBy56g+MyqzXVMVohE7t9nQX3oWmLPurPoukzFLXBhB6zi PsU6YnV49CRZEcqq2GlXr1ZdFtPHQYtc94SznM19+ZT5YWDyvdd1xUzz0ADx1oZCmEuVy1PP8QcmEp MJq5q0CwQOpUXtT7riexUYWTju3bAxairwusradVYpDHE= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230106_094731_779484_7771F407 X-CRM114-Status: GOOD ( 13.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit ff7a167961d1b ("arm64: efi: Execute runtime services from a dedicated stack") introduced a dedicated stack for EFI runtime services, in an attempt to make the execution of EFI runtime services more robust, given that they execute at the same privilege level as the kernel. However, this stack needs to be declared to the stacktrace machinery, which is careful not to walk the stack when it leads into memory regions that are not known to be allocated for stack use. Also, given that the ACPI code may invoke the low-level EFI runtime call wrapper without using the dedicated kernel thread and workqueue, we should take this into account when trying to gracefully handle synchronous exceptions. Changes since v2: - clear efi_rt_stack_top[-1] from asm code, and use READ_ONCE() to read its value when not holding the spinlock, to ensure that all accesses are safe under concurrency; - add Mark's ack to patch #2 Cc: Mark Rutland Cc: Lee Jones Ard Biesheuvel (2): arm64: efi: Avoid workqueue to check whether EFI runtime is live arm64: efi: Account for the EFI runtime stack in stack unwinder arch/arm64/include/asm/efi.h | 9 +++++++++ arch/arm64/include/asm/stacktrace.h | 15 +++++++++++++++ arch/arm64/kernel/efi-rt-wrapper.S | 6 ++++++ arch/arm64/kernel/efi.c | 3 ++- arch/arm64/kernel/stacktrace.c | 12 ++++++++++++ 5 files changed, 44 insertions(+), 1 deletion(-)