From patchwork Mon Dec 5 20:03:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13065053 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 9D960C4332F for ; Mon, 5 Dec 2022 20:04:48 +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=W+g/1FvYCjgfviN6fYBdeZN3f8NWOHD+CwnzZSj983Y=; b=LT5oMJXIqVI5D9 SUcI8bBChmbykcA5DSb4eZipH10Qb8RIyfIi8YtIkfZb46KimqGFnJrFsXrpRvFkSdpMZiqmCrJc9 zi0PL1un9mLAMrvaklGRiiuuHhY28YA/jRCUEvINPQ52EPkAOmjsv77A8lStCTntr6wYncnNzKg1o P38r0PjkRljfmQdmN2CaO+gd2MBsj/xxAEsdBFIO4XKNluqvVKkCeU+vvveBBd+rhFZpyQ1gItQT7 WgpeIPgngdp3R7vod3KMD8n6cJDXDihDrTkO/IPsmj3U86XfzT1Q5nKfnv78pFOrJSiwZNrgpU1eb ItQrpQun7taVERWCKhUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p2Hgv-009t2J-A7; Mon, 05 Dec 2022 20:03:53 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p2Hgs-009sws-80 for linux-arm-kernel@lists.infradead.org; Mon, 05 Dec 2022 20:03:51 +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 14CBEB8120C; Mon, 5 Dec 2022 20:03:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 601DCC433C1; Mon, 5 Dec 2022 20:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670270626; bh=vsNxuvO6vcDoz7Hsmhknz2UkIG0o0XvPPZQo9oinzhE=; h=From:To:Cc:Subject:Date:From; b=WaSwdrt6lgvJkN3PpwwU0dWgMlQrzd0yMZkJ6Qz465xzrD3j/qITx/33BS4kZ+zZW 48qPTAgvgTUd4vV7e54IjftrBbZDYWrshRDADtE9xHojsAy/TB7AAqxBDfrOLBn69D KInJR9ltr3+hqIZtUUl2ERfEFM6Q/0+dx96t2erBMngIYGoh/FkDvcpqzOZKc3t+Wo ZOrMocEusxi2LFLnYVyOu3pKxnWpXOtare/k4TzpI2rDb1ZucviTkL48pyvsqZ/6br iG9CjhZYQeCwvUDPbb0bGeRPuLRAGK9WAMSxeH1DztI1Yx0c6eaPwIyIdi+4Mgcz6+ jXPq4YSi//w0A== 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 0/2] arm64: harden shadow call stack pointer handling Date: Mon, 5 Dec 2022 21:03:39 +0100 Message-Id: <20221205200341.463601-1-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=623; i=ardb@kernel.org; h=from:subject; bh=vsNxuvO6vcDoz7Hsmhknz2UkIG0o0XvPPZQo9oinzhE=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjjk6YfIKU+lYncmXygwhTbqTVyAGJdvtqe0MQlDq/ IQZFFAiJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY45OmAAKCRDDTyI5ktmPJKULDA C/j/cjvQzaLygT7ih8XCOqtSM/IucQEqta+6NMuz07gQIKtgV+Q/mYT44CyM50g9i9qaWXqs8lgfjU hSxU+4Vzz1RPu9LfXzGn3ld2XdvNwASbL8y3UnhFgOLfrMist/MfNoHNj2ovsLkkXHydlkZ7bQsHJt YFwCevjnM+/a0AVavELVxnUQ+1qg2wPzgJ7p6v/gVFztIkP95iWrI5FcaEDmcNE9DW6WZdquLNvzJQ kQCPBXuq23A0XTqNAWLHlCsE8/zcwUF77tjtflNUKS+jk7EuFA5VaMCbxZ+HZoJkccF1zJh/Ok/sLR 1tPPNexJZrJ0nUdwya/eEXHQiloH2+jnftiQZ/vTWlKVrbAqzypSt8BujY0SmXe0GSurM0tX6ZdIvF +3I3+UwWUKKFzNu66dQTHrp0CYUSXxocTRUZd1jq7WZzmnJw8gDrofZ7w4T6gy36lFdBbHkj90xF1o j0LNOWYIeQlUX/MgTFnlEQDpDXxBkQxrmjU7dCQNK8QZg= 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-20221205_120350_467635_437FBA08 X-CRM114-Status: UNSURE ( 8.31 ) 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. 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(-)