Re: [RFC][PATCH 6/6] objtool: Add IBT validation / fixups

Peter Zijlstra
2022-02-16T12:24:51Z

On Tue, Feb 15, 2022 at 10:05:50PM +0100, Peter Zijlstra wrote:

> > Peter, is there a reason you want things in the specific order of:
> >
> > cmp, je-to-call, trap, call
> >
> > Isn't it more run-time efficient to have an out-of-line failure of
> > the form:
> >
> > cmp, jne-to-trap, call, ...code..., trap, jmp-to-call
> >
> > I thought the static label stuff allowed the "default out of line"
> > option, as far as pessimizing certain states, etc? The former is certainly
> > code-size smaller, though, yes, but doesn't it waste space in the cache
> > line for the unlikely case, etc?
>
> Mostly so that we can deduce the address of the trap from the retpoline
> site, also the above has a fairly high chance of using jcc.d32 which is
> actually larger than jcc.d8+ud2.

Also; and I think I mentioned this a few emails back, by having the
whole CFI thing as a single range of bytes it becomes easier to patch.