Skip to contentSkip to conversation

x86/extable: Annotate ex_handler_msr_mce() as a dead end

PATCH Applied Borislav Petkov 2 participants 2 messages May 20, 2022 – May 30, 2022

Subsystems (2)
lore
Share & tools
lore

Borislav Petkov

author maintainer
#0 lore raw

PATCH 1/1 x86/extable: Annotate ex_handler_msr_mce() as a dead end

From: Borislav Petkov <[email protected]>

Fix

vmlinux.o: warning: objtool: fixup_exception+0x2d6: unreachable instruction

---
 arch/x86/include/asm/extable.h | 4 ++--
 tools/objtool/check.c          | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
arch/x86/include/asm/extable.h +2 -2
index 155c991ba95e..6ac53e98fff4 100644
@@ -42,9 +42,9 @@ extern int ex_get_fixup_type(unsigned long ip);
 extern void early_fixup_exception(struct pt_regs *regs, int trapnr);
 
 #ifdef CONFIG_X86_MCE
-extern void ex_handler_msr_mce(struct pt_regs *regs, bool wrmsr);
+extern void __noreturn ex_handler_msr_mce(struct pt_regs *regs, bool wrmsr);
 #else
-static inline void ex_handler_msr_mce(struct pt_regs *regs, bool wrmsr) { }
+static inline void __noreturn ex_handler_msr_mce(struct pt_regs *regs, bool wrmsr) { }
 #endif
 
 #if defined(CONFIG_BPF_JIT) && defined(CONFIG_X86_64)
tools/objtool/check.c +2 -1
index 190b2f6e360a..c23e46c4a882 100644
@@ -185,7 +185,8 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
 		"do_group_exit",
 		"stop_this_cpu",
 		"__invalid_creds",
-               "cpu_startup_entry",
+		"cpu_startup_entry",
+		"ex_handler_msr_mce",
 	};
 
 	if (!func)
Signature · 1 line
2.35.1
#1 lore raw
The following commit has been merged into the objtool/urgent branch of tip:

The following commit has been merged into the objtool/urgent branch of tip:

Commit-ID:     2028a255f4df3af9e759f01f958d3237f825f256
Gitweb:        https://git.kernel.org/tip/2028a255f4df3af9e759f01f958d3237f825f256
Author:        Borislav Petkov <[email protected]>
AuthorDate:    Fri, 20 May 2022 21:27:29 +02:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Fri, 27 May 2022 12:34:45 +02:00

x86/extable: Annotate ex_handler_msr_mce() as a dead end

Fix

vmlinux.o: warning: objtool: fixup_exception+0x2d6: unreachable instruction

---
 arch/x86/include/asm/extable.h | 8 ++++++--
 tools/objtool/check.c          | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)
arch/x86/include/asm/extable.h +6 -2
index 155c991..eeed395 100644
@@ -42,9 +42,13 @@ extern int ex_get_fixup_type(unsigned long ip);
 extern void early_fixup_exception(struct pt_regs *regs, int trapnr);
 
 #ifdef CONFIG_X86_MCE
-extern void ex_handler_msr_mce(struct pt_regs *regs, bool wrmsr);
+extern void __noreturn ex_handler_msr_mce(struct pt_regs *regs, bool wrmsr);
 #else
-static inline void ex_handler_msr_mce(struct pt_regs *regs, bool wrmsr) { }
+static inline void __noreturn ex_handler_msr_mce(struct pt_regs *regs, bool wrmsr)
+{
+	for (;;)
+		cpu_relax();
+}
 #endif
 
 #if defined(CONFIG_BPF_JIT) && defined(CONFIG_X86_64)
tools/objtool/check.c +1 -0
index 7a187da..864bb9d 100644
@@ -187,6 +187,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
 		"__invalid_creds",
 		"cpu_startup_entry",
 		"__ubsan_handle_builtin_unreachable",
+		"ex_handler_msr_mce",
 	};
 
 	if (!func)