[PATCH] objtool: Fix SLS checks

From: Peter Zijlstra
Date: Sat Apr 30 2022 - 07:06:31 EST



Fix the SLS validation; not having a next instruction is also a fail
when the next instruction should be INSN_TRAP.

Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
tools/objtool/check.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 3f6785415894..3354101ffe34 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -3380,7 +3380,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,

case INSN_RETURN:
if (sls && !insn->retpoline_safe &&
- next_insn && next_insn->type != INSN_TRAP) {
+ (!next_insn || (next_insn && next_insn->type != INSN_TRAP))) {
WARN_FUNC("missing int3 after ret",
insn->sec, insn->offset);
}
@@ -3428,7 +3428,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,

case INSN_JUMP_DYNAMIC:
if (sls && !insn->retpoline_safe &&
- next_insn && next_insn->type != INSN_TRAP) {
+ (!next_insn || (next_insn && next_insn->type != INSN_TRAP))) {
WARN_FUNC("missing int3 after indirect jump",
insn->sec, insn->offset);
}