Re: [PATCH] objtool: Fix SLS checks

From: Peter Zijlstra
Date: Mon May 02 2022 - 16:02:05 EST


On Mon, May 02, 2022 at 11:15:47AM -0700, Josh Poimboeuf wrote:
> On Sat, Apr 30, 2022 at 12:50:02PM +0200, Peter Zijlstra wrote:
> >
> > 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);
> > }
>
> My SLS rewrite in tip/objtool/core already fixed this, FWIW. But this
> could be good for -urgent.

Urgh, I should've looked at that indeed. This didn't find any new sites
though; so I don't think this needs to go through urgent.