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 07EFBC433F5 for ; Tue, 5 Apr 2022 16:21:18 +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=5JJNO+e2LCGLGcfmjiRDW66/zWQVCVTkXAVKOwLSE8I=; b=fvKJ4FIqXAlrwC Qn1F8jfTix7jXoHd9QLx00y7RXuknEP2gnGw4vK2zPKihRYewzU8qH+FZpgQXBaWUzqEm96RPk4zK 9X/veY3wBruBOPCrHieenTQTmPeyW61wT0n49DsscYSAraRqY1Xaq1TFlMBoTdbwN57ybdDdoMTbX EWS9JE8kxxGR1CYqlvXlOPohWWLRsTK0J2shWA+roGCfZ8Z3RIR7XgkBMphIP0KNBwc0141+GGvKY 4wt7t9FmBJBzIg48JBZLWbTHcbolIzRIAjIEXKCOivhuaA9byKGsp1YhdYWWFi3xvSDBu88zVVZXM IFCDtJD0GlJz6ORm/rQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nbluR-001uIG-QS; Tue, 05 Apr 2022 16:20:00 +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 1nblqq-001svw-QG for linux-arm-kernel@lists.infradead.org; Tue, 05 Apr 2022 16:16:24 +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 2B5B41424; Tue, 5 Apr 2022 09:16:13 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.8.234]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 85FD93F73B; Tue, 5 Apr 2022 09:16:11 -0700 (PDT) Date: Tue, 5 Apr 2022 17:16:02 +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 2/3] linux/compiler-clang.h: define function_nocfi Message-ID: References: <20220401201916.1487500-1-samitolvanen@google.com> <20220401201916.1487500-3-samitolvanen@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220401201916.1487500-3-samitolvanen@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220405_091616_929441_E6C897F4 X-CRM114-Status: GOOD ( 17.78 ) 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:15PM -0700, Sami Tolvanen wrote: > Use __builtin_function_start() to implement the function_nocfi() macro > when CONFIG_CFI_CLANG is selected. > > Signed-off-by: Sami Tolvanen > --- > include/linux/compiler-clang.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h > index babb1347148c..c84fec767445 100644 > --- a/include/linux/compiler-clang.h > +++ b/include/linux/compiler-clang.h > @@ -69,6 +69,16 @@ > #define __nocfi __attribute__((__no_sanitize__("cfi"))) > #define __cficanonical __attribute__((__cfi_canonical_jump_table__)) > > +#if defined(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) __builtin_function_start(x) > +#endif As a heads-up, with patches 1 and 2 applied (but not patch 3), we have two definitions of function_nocfi(), which casues the compiler to scream for every object: | In file included from :3: | In file included from ././include/linux/compiler_types.h:107: | ./arch/arm64/include/asm/compiler.h:33:9: warning: 'function_nocfi' macro redefined [-Wmacro-redefined] | #define function_nocfi(x) ({ \ | ^ | ./include/linux/compiler-clang.h:79:9: note: previous definition is here | #define function_nocfi(x) __builtin_function_start(x) | ^ | 1 warning generated. ... which would be painful for bisection. I suspect It's probably worth folding patches 2 and 3 together to avoid that? Arguably we could fold the entire series together into one commit at that point. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel