From patchwork Mon Jan 9 17:47:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13094048 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 83961C54EBD for ; Mon, 9 Jan 2023 17:53:16 +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=M6qeHx7g/3Ty0B5NMgb4weBBCJbNQSPMkDokwpU0FsU=; b=VKCcDBHqMnVuIt +197E4hmelGpV9gzlqX8/c8d1NtyaX2w17gR6XZcMVz+yXuc0JMpV7TbZkt16yOXtfUxjxGcQVGcX 1BolKXtVqHee6cq5/bLGs53tht1/S6p8XNFTq/Xu7M6Us1766hU1YxWcckI4SDULwIz0n8+TC69rO 52YK7gt3XzpIWPJVVeIKc18QgOgsKdvrVkzhVko00m3rknD9UzsLS3cFSCcr6sEU4Bjxb50hoJISC nHiMgvmzmQYdlJQH+/nHbQrQe91lR8oArsGYAF4jetCfDOO7f4gfQ5vbxYC5EjsiBgOe50fb1sFqp s2yVX3sRLtyXzN17OBtw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEwJX-00322i-5u; Mon, 09 Jan 2023 17:52:03 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEwFl-00303Y-1Q for linux-arm-kernel@lists.infradead.org; Mon, 09 Jan 2023 17:48:14 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 664E36129E; Mon, 9 Jan 2023 17:48:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B15A8C433D2; Mon, 9 Jan 2023 17:48:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673286488; bh=3tIS4qd8hagPcgYt1GTg9azSuC/L0OKdIaU8esDmgzQ=; h=From:To:Cc:Subject:Date:From; b=DhRYnTRYxWFBBfZRYJz3svYzWsp4vSlWplFpVWzs9Uuf10MVSNWsTwLeDNEPrj8Di 6631cLRWjYtr6s/RBfxwAXTcBu2ZAk9HoDpw8qqArXVVBuArzZWRIeniOmn1K2T2pI uQwSP3BMtlYfHQQTQE8nRC+j7UNiJkH+J/GhwLV8imGEoIA/6UDlbfxHVKXwjfMxFE Rn9I8s2zflP38eiO+djAHayP/X4xUU8Urh3KiQ2l8yEsYAURNYHShQOggxNO39uHh2 cvPUEH4iMpIblE/cOW8rHgXXJd19Cbjvm9r/Zk3HOS+5FHfCig7mrpRHJHSt5p15l3 bVWWkDcf58sxQ== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, Ard Biesheuvel , Sami Tolvanen , Kees Cook Subject: [PATCH v2 0/2] arm64: harden shadow call stack pointer handling Date: Mon, 9 Jan 2023 18:47:58 +0100 Message-Id: <20230109174800.3286265-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=668; i=ardb@kernel.org; h=from:subject; bh=3tIS4qd8hagPcgYt1GTg9azSuC/L0OKdIaU8esDmgzQ=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjvFNMfelf8Cre7YJkgJK2GuA4kX4/dfIGHfLURrHM X8JKCvKJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY7xTTAAKCRDDTyI5ktmPJBDfC/ 0TFF+qDk3uGk+9BMVUhWGPcy+yJ9xnJXanlpvT1ToQBdSkIp7+jU2TgPSlMODOb/5i3MtyBldMAFs3 1bPY8DPU9vDPnzZkhzmI4CzFaBMN24BbANsHa3NIAHFr6Rj6mMabqzAo2im74BPukD44UPrZT7bbb3 OkWueadEQt7ENNwqMtBRUBmcrJYGCZkE4NKYs9nCUner0w4PBAq/HWnTKcg1bRwAHZRgljEiTb+BZT 17mmZEGS5R1xqJvvmODpZvrBS/tua6qt4hN0J83nNHY9XexC08C6qlyO/e93g8WqBvpqT6hTjFB68v C4ECZp2PeLYHJOsXNNFrAqD9R7ZLTozgToe75yz1O8pKlK7V2EzRIwsRK8gZHoykdlRbVr3ZkQc+Ga jlQPcX1Wq/yOW7+JnHvOzrgJf3gQA9zKeBbL3tWZGFI5xy43VYmJsR8YUX1wWdE92JOi/zn9HxkR2i wqEapFlMWGvCBxLTAA3INsApwxa5Wi4YPMqMr7YSJUREU= 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-20230109_094811_341919_1ADCBCAB X-CRM114-Status: UNSURE ( 9.27 ) X-CRM114-Notice: Please train this message. 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 A couple of tweaks to the arm64 entry code to avoid loading the shadow call stack pointer in a way that could potentially be unsafe in the context of ROP attacks. Changes since v1: - rebase onto v6.2-rc1 Cc: Sami Tolvanen Cc: Kees Cook Ard Biesheuvel (2): arm64: Always load shadow stack pointer directly from the task struct arm64: Stash shadow stack pointer in the task struct on interrupt arch/arm64/include/asm/scs.h | 7 ++++--- arch/arm64/kernel/entry.S | 16 +++++++--------- arch/arm64/kernel/head.S | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-)