[tip: objtool/urgent] objtool: Stop UNRET validation on UD2

From: tip-bot2 for Josh Poimboeuf
Date: Tue Apr 08 2025 - 04:12:51 EST


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

Commit-ID: 9f9cc012c2cbac4833746a0182e06a8eec940d19
Gitweb: https://git.kernel.org/tip/9f9cc012c2cbac4833746a0182e06a8eec940d19
Author: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
AuthorDate: Tue, 08 Apr 2025 00:02:15 -07:00
Committer: Ingo Molnar <mingo@xxxxxxxxxx>
CommitterDate: Tue, 08 Apr 2025 09:14:11 +02:00

objtool: Stop UNRET validation on UD2

In preparation for simplifying INSN_SYSCALL, make validate_unret()
terminate control flow on UD2 just like validate_branch() already does.

Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/ce841269e7e28c8b7f32064464a9821034d724ff.1744095216.git.jpoimboe@xxxxxxxxxx
---
tools/objtool/check.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 2c703b9..2dd89b0 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -3902,6 +3902,9 @@ static int validate_unret(struct objtool_file *file, struct instruction *insn)
break;
}

+ if (insn->dead_end)
+ return 0;
+
if (!next) {
WARN_INSN(insn, "teh end!");
return 1;