From patchwork Tue Jun 6 14:56:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jamie Cunliffe X-Patchwork-Id: 13269336 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 05E90C7EE24 for ; Tue, 6 Jun 2023 14:58:41 +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:References:In-Reply-To: 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: List-Owner; bh=hQ2z+NF4elYjAmlPDixtnLF2Bj+LRcv3fgJWB/QWewg=; b=HrlphsT0B7qKG7 qzWbIbA+cMOvjJspszan4zwHM25Ibsy9u5J9kXeUVgEO4VuBRz49x3sO6kmWH2CBoUsEyWyPyXaoO Di9D2bNEx1tSJJwFkFUAuR5WZwyinEgK7hN/Y8dTcaNG0xCyhYuhtyCGhdrOFnUhqR5Kdtmy5fO+Z 931pPykWMbcJBjYFnU2q/TqPKtKSAV1kaQoJlugy54qYilU7LzoXPC0ytr7VeChf7fZyhAh3L9Coj 7hnzC4QlcBFrq1LCZPxOE9PDmPli4DR7DTYWfeFNq6+o52MVjOyYRXeHaMH4jEQbewtsZql3rDFZL nNmm5Cordo9ZAf8Sy/LQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q6Y8X-0028FZ-0l; Tue, 06 Jun 2023 14:58:17 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q6Y8U-0028E6-0z for linux-arm-kernel@lists.infradead.org; Tue, 06 Jun 2023 14:58:15 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 51CE82F4; Tue, 6 Jun 2023 07:58:56 -0700 (PDT) Received: from capper-ampere.manchester.arm.com (capper-ampere.manchester.arm.com [10.32.100.23]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BA71E3F6C4; Tue, 6 Jun 2023 07:58:09 -0700 (PDT) From: Jamie Cunliffe To: linux-arm-kernel@lists.infradead.org, rust-for-linux@vger.kernel.org Cc: Miguel Ojeda , Catalin Marinas , Will Deacon , steve.capper@arm.com, Asahi Lina Subject: [PATCH v2 2/3] arm64: rust: Enable PAC support for Rust. Date: Tue, 6 Jun 2023 15:56:05 +0100 Message-Id: <20230606145606.1153715-3-Jamie.Cunliffe@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230606145606.1153715-1-Jamie.Cunliffe@arm.com> References: <20230606145606.1153715-1-Jamie.Cunliffe@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230606_075814_392779_74BF6427 X-CRM114-Status: UNSURE ( 9.10 ) 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 Enable the PAC ret and BTI options in the Rust build flags to match the options that are used when building C. Signed-off-by: Jamie Cunliffe --- arch/arm64/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 2ce1555e9fc5..4a2c807d65db 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -67,7 +67,9 @@ endif ifeq ($(CONFIG_ARM64_BTI_KERNEL),y) KBUILD_CFLAGS += -mbranch-protection=pac-ret+bti + KBUILD_RUSTFLAGS += -Z branch-protection=bti,pac-ret else ifeq ($(CONFIG_ARM64_PTR_AUTH_KERNEL),y) + KBUILD_RUSTFLAGS += -Z branch-protection=pac-ret ifeq ($(CONFIG_CC_HAS_BRANCH_PROT_PAC_RET),y) KBUILD_CFLAGS += -mbranch-protection=pac-ret else