[PATCH v9 04/10] x86/retpoline: Make warn_thunk_thunk .noinstr

Valentin Schneider
2026-05-05T08:25:48Z

Objtool now warns about it:

vmlinux.o: warning: objtool: .altinstr_replacement+0x28e1: call to warn_thunk_thunk() leaves .noinstr.text section

Mark it noinstr.

Signed-off-by: Valentin Schneider <vschneid@redhat.com>
---
arch/x86/entry/entry.S | 3 ++-
arch/x86/kernel/cpu/bugs.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/entry/entry.S b/arch/x86/entry/entry.S
index 6ba2b3adcef0f..e76560f86b332 100644
--- a/arch/x86/entry/entry.S
+++ b/arch/x86/entry/entry.S
@@ -40,6 +40,8 @@ SYM_FUNC_START(__WARN_trap)
SYM_FUNC_END(__WARN_trap)
EXPORT_SYMBOL(__WARN_trap)

+THUNK warn_thunk_thunk, __warn_thunk
+
.popsection

/*
@@ -60,7 +62,6 @@ EXPORT_SYMBOL_FOR_KVM(x86_verw_sel);

.popsection

-THUNK warn_thunk_thunk, __warn_thunk

/*
* Clang's implementation of TLS stack cookies requires the variable in
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 83f51cab0b1e3..87dffa7a95a4e 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -3731,7 +3731,7 @@ ssize_t cpu_show_vmscape(struct device *dev, struct device_attribute *attr, char
}
#endif

-void __warn_thunk(void)
+void noinstr __warn_thunk(void)
{
WARN_ONCE(1, "Unpatched return thunk in use. This should not happen!\n");
}
--
2.52.0