From mboxrd@z Thu Jan 1 00:00:00 1970 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 4D770C433F5 for ; Mon, 6 Dec 2021 17:13:05 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TSEIVA9Kie6xdzB7y3RLkWyF/WYZyhCLvNHHUjNSZQI=; b=342BynGRN45yHl jTWwb/kuS2l3pN4CvKeNVCfpJynOg9nqDfpQh3beoI1ZIRy7sv0tCWU2Dldso6q5pCvL09DbaGMZA R3szPPhZC9Xxp1/c4HdG4abNLlHiNdU7BZL+mzwl5vtlbcJC3enHH1K/vlA0/U+LUyLNFKMaThweO Cvo9CUjBv7MOvGDORYoHMHffxxqwpsHGjQqRquh2NR8Os/kgOWoQcRZZb++WgH6nQQYRX55iCimww vSD35jdE2jLTPlS82xLYBVF3LhntwZcuBvcCVy7MhFKj7lv+vj6DoP+zdBtl6UEZBP8ThIlP9CcTF E7J4Ow+dY0OODcDuUVPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1muHWU-0050Zs-1A; Mon, 06 Dec 2021 17:11:30 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1muHWP-0050YJ-Lg for linux-arm-kernel@lists.infradead.org; Mon, 06 Dec 2021 17:11:27 +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 76FDB1042; Mon, 6 Dec 2021 09:11:24 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.65.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 802C83F73B; Mon, 6 Dec 2021 09:11:23 -0800 (PST) Date: Mon, 6 Dec 2021 17:11:20 +0000 From: Mark Rutland To: Ard Biesheuvel Cc: Mark Brown , Catalin Marinas , Will Deacon , Linux ARM Subject: Re: [PATCH] arm64: asmlinkage: Enable use of BTI_C macro in SYM_CODE Message-ID: References: <20211203130335.84733-1-broonie@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211206_091125_796602_E21F463C X-CRM114-Status: GOOD ( 26.39 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Dec 06, 2021 at 05:52:16PM +0100, Ard Biesheuvel wrote: > On Mon, 6 Dec 2021 at 17:30, Mark Rutland wrote: > > > > On Fri, Dec 03, 2021 at 01:03:35PM +0000, Mark Brown wrote: > > > A couple of SYM_CODE sections have added usage of BTI_C which is > > > currently only defined when building for BTI. This means that the > > > users have ugly ifdefs for the case where BTI is disabled so let's > > > provide an empty definition in that case and remove the ifdefs. > > > > > > Signed-off-by: Mark Brown > > > --- > > > arch/arm64/include/asm/linkage.h | 4 ++++ > > > arch/arm64/kernel/entry-ftrace.S | 4 ---- > > > arch/arm64/lib/kasan_sw_tags.S | 2 -- > > > 3 files changed, 4 insertions(+), 6 deletions(-) > > > > Looking around, there are other places that open-code `hint 34`, e.g. > > arch/arm64/crypto/aes-modes.S. Those are unconditional, so we should probably > > figure out whether we want those to be conditional (or if we're happy to make > > the other cases similarly unconditional). > > > > I'd argue we should probably place BTIs in assembly unconditionally, on the > > assumption that they shouldn't have an measureable performance impact in > > practice (as we're already assuming that when CONFIG_ARM64_BTI_KERNEL is > > selected anyhow). Thoughts? > > From the top of my head, I can't say for sure but there are some > computed gotos in the crypto code where removing an instruction may > throw off the calculation. So keeping the hint unconditionally makes > sense to me, and by the same reasoning, it would be better not to > introduce macros that shadow existing instructions if they may resolve > to a sequence of a different size. As an aside, while that code works, it's using `BTI C` in an odd way, since the those are internal labels rather than callable function entry points (but the `BR` works because of the X16/X17 exemption that makes PLTs work). For consistency, we might want to make that use `BTI J`, and an X register other than X16/X17, which is what the compiler should generate for cases like this. That would minimize the set of targets the `BR` can legitimately hit (though AFAICT this cannot be gadgetized anyway, so this'd just be for consistency/lack-of-surprise). Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel