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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A337C433F5 for ; Tue, 15 Mar 2022 10:45:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347433AbiCOKqQ (ORCPT ); Tue, 15 Mar 2022 06:46:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347246AbiCOKpJ (ORCPT ); Tue, 15 Mar 2022 06:45:09 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFC1435867; Tue, 15 Mar 2022 03:43:54 -0700 (PDT) Date: Tue, 15 Mar 2022 10:43:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1647341033; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PyPfSNK7F9E0Re0Lyq39CuljWYLxINrwTkbxkDLqxw8=; b=FRWoVL69dxaUNkB/De2Jsj4rYQExAcMIyvi1+znzVzY/tqumBzhLo9Ru42yr+iUufzkR2d m6x/+qOBga62Oz9fILaiqZRBY3R1yCrmRcEDPfpDByKmPMrIuQKzbqfX8lBU2VEElHUSXB L0v1Ssyb9FgY4DJEg0uGbGT3qvqPKlAJlcFCd9Coz23gXrbMPQVfBALzcK1ndz4o29sN8W ll92fn7Blejt1gofd3aTiQj4VU57nPowFoQlQBTwSRFCB8u7wBH1T/ONJSm4VkOYZn9Qud IlLQXdIHi92nG4CC7cwgkgs0v+69rdqR2dg9xJM4C2WNqYhDyuKi+Jr+b5L50w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1647341033; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PyPfSNK7F9E0Re0Lyq39CuljWYLxINrwTkbxkDLqxw8=; b=K6HNccWu2zNmPfNOm8LyMsRjn/Hso7maEaQ2ym8z+PwOb+HrEjEEdomVGlLhJRg8KHEcNH 007TsFkbKTCzkNCw== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/core] x86/ibt: Ensure module init/exit points have references Cc: "Peter Zijlstra (Intel)" , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220308154319.113767246@infradead.org> References: <20220308154319.113767246@infradead.org> MIME-Version: 1.0 Message-ID: <164734103192.16921.3948203360443496828.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/core branch of tip: Commit-ID: cb9010f87dcbcdbb51cc96b922c6260848cecbd1 Gitweb: https://git.kernel.org/tip/cb9010f87dcbcdbb51cc96b922c6260848cecbd1 Author: Peter Zijlstra AuthorDate: Tue, 08 Mar 2022 16:30:44 +01:00 Committer: Peter Zijlstra CommitterDate: Tue, 15 Mar 2022 10:32:42 +01:00 x86/ibt: Ensure module init/exit points have references Since the references to the module init/exit points only have external references, a module LTO run will consider them 'unused' and seal them, leading to an immediate fail on module load. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Josh Poimboeuf Link: https://lore.kernel.org/r/20220308154319.113767246@infradead.org --- include/linux/cfi.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/linux/cfi.h b/include/linux/cfi.h index 879744a..c6dfc1e 100644 --- a/include/linux/cfi.h +++ b/include/linux/cfi.h @@ -34,8 +34,17 @@ static inline void cfi_module_remove(struct module *mod, unsigned long base_addr #else /* !CONFIG_CFI_CLANG */ -#define __CFI_ADDRESSABLE(fn, __attr) +#ifdef CONFIG_X86_KERNEL_IBT + +#define __CFI_ADDRESSABLE(fn, __attr) \ + const void *__cfi_jt_ ## fn __visible __attr = (void *)&fn + +#endif /* CONFIG_X86_KERNEL_IBT */ #endif /* CONFIG_CFI_CLANG */ +#ifndef __CFI_ADDRESSABLE +#define __CFI_ADDRESSABLE(fn, __attr) +#endif + #endif /* _LINUX_CFI_H */