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 503DAC433EF for ; Tue, 5 Apr 2022 16:26:14 +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=TC+YnlYCVlVNHEvOT52gEJGRawN/Kye6i8355uQ3lqA=; b=rSN1DX52NnW5UV KD5EzF5G0VN86OfhQJze7M8KJ3tkc+28frHoHJc8J7IQb8jo2KecYZB1MJdB5buP+3GU9wEPZjxC9 VFykRjuKkd7WLsk9mufwIBb6/bgE/JBiBjj/NNfeW+I3+gQ6ourvoFL433dqeKx55OtxeMyDLoxjg EzXXzNdDf9yaK8eLbYIbUT4VUigQR6NxsOn8ZJ9sKfzekZmqXmYwk6Uys0BQsyIGY7wwBtizj1Vyl 2DB1MQ++Um4SH7dzebhJy6d2DJ4bNCn4LmzIJK01r4O25oKFlq/+SSKDGlQQTiL/0cSGHuArTAGKZ XUeitvCeCAAcQ3ilimWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nblzF-001w8Y-7S; Tue, 05 Apr 2022 16:24:57 +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 1nblxh-001vXM-HW for linux-arm-kernel@lists.infradead.org; Tue, 05 Apr 2022 16:23:23 +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 AB32C23A; Tue, 5 Apr 2022 09:23:18 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.8.234]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0B3C23F718; Tue, 5 Apr 2022 09:23:16 -0700 (PDT) Date: Tue, 5 Apr 2022 17:23:13 +0100 From: Mark Rutland To: Sami Tolvanen Cc: Kees Cook , Catalin Marinas , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH 3/3] arm64: Drop the inline assembly implementation of function_nocfi Message-ID: References: <20220401201916.1487500-1-samitolvanen@google.com> <20220401201916.1487500-4-samitolvanen@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220401201916.1487500-4-samitolvanen@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220405_092321_682309_AE49E669 X-CRM114-Status: GOOD ( 17.86 ) 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 Fri, Apr 01, 2022 at 01:19:16PM -0700, Sami Tolvanen wrote: > Drop the inline assembly version of function_nocfi() now that > CONFIG_CFI_CLANG depends on __builtin_function_start(), which allows > this macro to be implemented more cleanly and in a way that works also > with static initializers. > > Signed-off-by: Sami Tolvanen > --- > arch/arm64/include/asm/compiler.h | 16 ---------------- > 1 file changed, 16 deletions(-) It's very nice to see the asm go here! I grabbed the LLVM 14.0.0 binary release from llvm.org and gave this a spin. I tested with ThinLTO and CFI_CLANG, and verified that CPU hotplug and ftrace worked as expected (given those rely on function_nocfi()), and that the LKDTM CFI_FORWARD_PROTO caught the mismatched prototype as expected. FWIW: Reviewed-by: Mark Rutland Tested-by: Mark Rutland As noted on patch 2 I think we should squash the series together, but those tags apply either way. Thanks, Mark. > > diff --git a/arch/arm64/include/asm/compiler.h b/arch/arm64/include/asm/compiler.h > index dc3ea4080e2e..6fb2e6bcc392 100644 > --- a/arch/arm64/include/asm/compiler.h > +++ b/arch/arm64/include/asm/compiler.h > @@ -23,20 +23,4 @@ > #define __builtin_return_address(val) \ > (void *)(ptrauth_clear_pac((unsigned long)__builtin_return_address(val))) > > -#ifdef CONFIG_CFI_CLANG > -/* > - * With CONFIG_CFI_CLANG, the compiler replaces function address > - * references with the address of the function's CFI jump table > - * entry. The function_nocfi macro always returns the address of the > - * actual function instead. > - */ > -#define function_nocfi(x) ({ \ > - void *addr; \ > - asm("adrp %0, " __stringify(x) "\n\t" \ > - "add %0, %0, :lo12:" __stringify(x) \ > - : "=r" (addr)); \ > - addr; \ > -}) > -#endif > - > #endif /* __ASM_COMPILER_H */ > -- > 2.35.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel