The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Calvin Owens <calvin@wbinvd.org>
To: linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	"Mike Rapoport (Microsoft)" <rppt@kernel.org>,
	Kees Cook <kees@kernel.org>, Juergen Gross <jgross@suse.com>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH] x86/cfi: add __init_or_module annotations for fineibt
Date: Wed, 10 Jun 2026 08:54:26 -0700	[thread overview]
Message-ID: <aimIsuxjtFfqIRZt@mozart.vkv.me> (raw)
In-Reply-To: <1f50aecf23311dc5ffb965c5ccfb8b49208dbb3f.1779763849.git.calvin@wbinvd.org>

On Monday 05/25 at 20:22 -0700, Calvin Owens wrote:
> I'm seeing some benign section mismatch warnings with fineibt when
> building kernels with CONFIG_MODULES=n:
> 
>     WARNING: modpost: vmlinux: section mismatch in reference: __apply_fineibt+0x1db (section: .text) -> text_poke_early (section: .init.text)
>     WARNING: modpost: vmlinux: section mismatch in reference: __apply_fineibt+0x473 (section: .text) -> text_poke_early (section: .init.text)
>     WARNING: modpost: vmlinux: section mismatch in reference: __apply_fineibt+0x57c (section: .text) -> text_poke_early (section: .init.text)
>     WARNING: modpost: vmlinux: section mismatch in reference: __apply_fineibt+0x6d9 (section: .text) -> text_poke_early (section: .init.text)
>     WARNING: modpost: vmlinux: section mismatch in reference: __apply_fineibt+0xb57 (section: .text) -> text_poke_early (section: .init.text)
>     WARNING: modpost: vmlinux: section mismatch in reference: __apply_fineibt+0xb81 (section: .text) -> text_poke_early (section: .init.text)
>     WARNING: modpost: vmlinux: section mismatch in reference: __apply_fineibt+0xd00 (section: .text) -> poison_endbr (section: .init.text)
>     WARNING: modpost: vmlinux: section mismatch in reference: __apply_fineibt+0xdd3 (section: .text) -> text_poke_early (section: .init.text)
>     WARNING: modpost: vmlinux: section mismatch in reference: __apply_fineibt+0xe58 (section: .text) -> text_poke_early (section: .init.text)
>     WARNING: modpost: vmlinux: section mismatch in reference: __apply_fineibt+0xe85 (section: .text) -> text_poke_early (section: .init.text)
>     WARNING: modpost: vmlinux: section mismatch in reference: apply_fineibt+0x8 (section: .text.unlikely.) -> __apply_fineibt (section: .init.text)
> 
> Add the missing __init_or_module section annotations to fix the
> warnings, and also free up a tiny bit of memory after boot.
> 
> Signed-off-by: Calvin Owens <calvin@wbinvd.org>

Gentle ping.

> ---
>  arch/x86/kernel/alternative.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
> index 62936a3bde19..400baffcd609 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -1775,8 +1775,8 @@ static int cfi_rewrite_callers(s32 *start, s32 *end)
>  #define FINEIBT_WARN(_f, _v) \
>  	WARN_ONCE((_f) != (_v), "FineIBT: " #_f " %ld != %d\n", _f, _v)
>  
> -static void __apply_fineibt(s32 *start_retpoline, s32 *end_retpoline,
> -			    s32 *start_cfi, s32 *end_cfi, bool builtin)
> +static void __init_or_module __apply_fineibt(s32 *start_retpoline, s32 *end_retpoline,
> +					     s32 *start_cfi, s32 *end_cfi, bool builtin)
>  {
>  	int ret;
>  
> @@ -2088,8 +2088,8 @@ bool decode_fineibt_insn(struct pt_regs *regs, unsigned long *target, u32 *type)
>  
>  #else /* !CONFIG_FINEIBT: */
>  
> -static void __apply_fineibt(s32 *start_retpoline, s32 *end_retpoline,
> -			    s32 *start_cfi, s32 *end_cfi, bool builtin)
> +static void __init_or_module __apply_fineibt(s32 *start_retpoline, s32 *end_retpoline,
> +					     s32 *start_cfi, s32 *end_cfi, bool builtin)
>  {
>  	if (IS_ENABLED(CONFIG_CFI) && builtin)
>  		pr_info("CFI: Using standard kCFI\n");
> @@ -2101,8 +2101,8 @@ static void poison_cfi(void *addr) { }
>  
>  #endif /* !CONFIG_FINEIBT */
>  
> -void apply_fineibt(s32 *start_retpoline, s32 *end_retpoline,
> -		   s32 *start_cfi, s32 *end_cfi)
> +void __init_or_module apply_fineibt(s32 *start_retpoline, s32 *end_retpoline,
> +				    s32 *start_cfi, s32 *end_cfi)
>  {
>  	return __apply_fineibt(start_retpoline, end_retpoline,
>  			       start_cfi, end_cfi,
> -- 
> 2.47.3
> 

  parent reply	other threads:[~2026-06-10 15:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26  3:22 [PATCH] x86/cfi: add __init_or_module annotations for fineibt Calvin Owens
2026-05-26  5:08 ` Juergen Gross
2026-06-10 15:54 ` Calvin Owens [this message]
2026-06-10 20:02   ` Borislav Petkov
2026-06-11  4:05     ` Calvin Owens
2026-06-10 19:54 ` Kees Cook
2026-06-28 22:24 ` [tip: x86/cleanups] x86/cfi: Add " tip-bot2 for Calvin Owens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aimIsuxjtFfqIRZt@mozart.vkv.me \
    --to=calvin@wbinvd.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=jpoimboe@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rppt@kernel.org \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox