objtool: Default ignore INT3 for unreachable

commit 1ffbe4e935f9b7308615c75be990aec07464d1e7 upstream.

Ignore all INT3 instructions for unreachable code warnings, similar to NOP.
This allows using INT3 for various paddings instead of NOPs.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/20220308154317.343312938@infradead.org
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Peter Zijlstra
2022-03-08 16:30:14 +01:00
committed by Greg Kroah-Hartman
parent bef21f88b4
commit 03c5c33e04

View File

@@ -2775,9 +2775,8 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
switch (insn->type) { switch (insn->type) {
case INSN_RETURN: case INSN_RETURN:
if (next_insn && next_insn->type == INSN_TRAP) { if (sls && !insn->retpoline_safe &&
next_insn->ignore = true; next_insn && next_insn->type != INSN_TRAP) {
} else if (sls && !insn->retpoline_safe) {
WARN_FUNC("missing int3 after ret", WARN_FUNC("missing int3 after ret",
insn->sec, insn->offset); insn->sec, insn->offset);
} }
@@ -2824,9 +2823,8 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
break; break;
case INSN_JUMP_DYNAMIC: case INSN_JUMP_DYNAMIC:
if (next_insn && next_insn->type == INSN_TRAP) { if (sls && !insn->retpoline_safe &&
next_insn->ignore = true; next_insn && next_insn->type != INSN_TRAP) {
} else if (sls && !insn->retpoline_safe) {
WARN_FUNC("missing int3 after indirect jump", WARN_FUNC("missing int3 after indirect jump",
insn->sec, insn->offset); insn->sec, insn->offset);
} }
@@ -2997,7 +2995,7 @@ static bool ignore_unreachable_insn(struct objtool_file *file, struct instructio
int i; int i;
struct instruction *prev_insn; struct instruction *prev_insn;
if (insn->ignore || insn->type == INSN_NOP) if (insn->ignore || insn->type == INSN_NOP || insn->type == INSN_TRAP)
return true; return true;
/* /*