[PATCH v10 04/10] x86/retpoline: Make warn_thunk_thunk .noinstr
From: Valentin Schneider
Date: Fri Nov 27 2026 - 15:13:46 EST
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@xxxxxxxxxx>
---
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 2bc217bb5475b..4f85cdb5011fc 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 56eac5611c318..caf8c3c76b544 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -3771,7 +3771,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.56.1