Re: [PATCH] objtool: Fix SLS checks

From: Josh Poimboeuf
Date: Thu May 05 2022 - 17:04:43 EST


On Wed, May 04, 2022 at 09:26:47AM +0200, Peter Zijlstra wrote:
> > I don't quite follow this 2nd sentence and how it's related here, since
> > this function doesn't actually deal with direct jumps.
>
> Ah, my bad. Also, this wrong.
>
> I suppose this wants to be something like:
>
> if (i < insn->length && op == JMP32_INSN_OPCODE)
> bytes[i++] = INT3_INSN_OPCODE;
>
> So this *can* be a jump, but typically won't be I suppose.

Yep.

> > Speaking of, I guess we'll eventually need to hack this SLS mess into
> > jump labels :-/
>
> Urgh... can't we reason that the straight line case is actually expected
> to run with the given register state anyway and ignore this?

Yeah, that makes sense.

So for jump labels the SLS path would probably not be worse than a
typical v1-style conditional branch misspeculation into the 'else' path,
and we've already given up on worrying about those anyway.

--
Josh