From patchwork Wed Apr 12 16:01:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 13209313 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 39828C77B73 for ; Wed, 12 Apr 2023 16:03:07 +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=RRmeMrRKvKgGmeBs7Lkbgo+BmBWham/z1WA6ZQrmVjo=; b=SiJaXtzl4L6dwj qxvza7y4rSRNmcF3BDyu7DJeq0B/3uedBDuFICrMJ0loCfx8kFoW8Z4kn2tPkXqLIHExh3I0gSE5J 9odTEjF7PwMX8/g97Z9GQaXgPegBR7Z7sz7Vk2gu9zkk6oD5F2d/9rGKETsiYSgezZD5JOmfBxFLl oOh3WP2hRNhIGcwUdkaljD5Sj9zt1I0cjxYTrz5649erQXxlg1Rhj1QYq5Q8uol6hYEeGIWbXKBL8 BjBupLkpD4VJSV6GV6jX/Iq2o6qYmwu5hrn5IsXRWkx1px5PIRVWh9Qc/j9AobugYh9I7SDdWSKWQ zctiCv5QpPWFLnDwSRog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmcv0-003jrp-10; Wed, 12 Apr 2023 16:01:58 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmcuw-003jq4-3C for linux-arm-kernel@lists.infradead.org; Wed, 12 Apr 2023 16:01:56 +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 BA22FD75; Wed, 12 Apr 2023 09:02:34 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 47B113F587; Wed, 12 Apr 2023 09:01:49 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: amit.kachhap@arm.com, catalin.marinas@arm.com, james.morse@arm.com, kristina.martsenko@arm.com, mark.rutland@arm.com, will@kernel.org Subject: [PATCH v2 0/3] arm64: PAC stripping cleanups Date: Wed, 12 Apr 2023 17:01:31 +0100 Message-Id: <20230412160134.306148-1-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230412_090155_080559_83E200A4 X-CRM114-Status: UNSURE ( 9.12 ) 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 While working on some stacktrace and noinstr cleanups, I spotted that we're doing a bunch of redundant work to strip PACs from pointers which have already been stripped. Further, for historical reasons we use C code to strip PACs when we can easily use XPACLRI. These patches clean up the PAC stripping, removing the redundant work and making better use of XPACLRI to strip PACs in the kernel. Since v1 [1]: * Use 'hint #7' to assemble with older binutils [1] https://lore.kernel.org/linux-arm-kernel/20230314162044.888747-1-mark.rutland@arm.com/ Mark. Mark Rutland (3): arm64: avoid redundant PAC stripping in __builtin_return_address() arm64: use XPACLRI to strip PAC arm64: move PAC masks to arch/arm64/Kconfig | 14 +++++++++++ arch/arm64/include/asm/compiler.h | 36 +++++++++++++++++++-------- arch/arm64/include/asm/pointer_auth.h | 13 +++++----- arch/arm64/kernel/crash_core.c | 1 + arch/arm64/kernel/perf_callchain.c | 2 +- arch/arm64/kernel/process.c | 2 +- arch/arm64/kernel/stacktrace.c | 2 +- 7 files changed, 50 insertions(+), 20 deletions(-)