Re: [PATCH] x86/ibt: Implement FineIBT

From: Joao Moreira
Date: Tue Nov 01 2022 - 17:50:32 EST


On 2022-11-01 14:39, Kees Cook wrote:
On Mon, Oct 31, 2022 at 12:13:50PM -0700, Joao Moreira wrote:
On 2022-10-18 22:19, Kees Cook wrote:
> On Tue, Oct 18, 2022 at 09:48:42PM -0700, Joao Moreira wrote:
> > > > Is it useful to get the compiler to emit 0xcc with
> > > > -fpatchable-function-entry under any circumstance? I can probably
> > > > change
> > > > that quickly if needed/useful.
> > >
> > > Having it emit 0xcc for the bytes in front of the symbol might be
> > > interesting. It would mean a few kernel changes, but nothing too hard.

Should I push for this within clang? I have the patch semi-ready (below) and
would have some cycles this week for polishing it.

Sure! While the NOP vs CC issue isn't very interesting when IBT is
available, it's nice for non-IBT to make attackers have to target
addresses precisely.

If it's really invasive or hard to maintain in Clang (or objtool),
then I'd say leave it as-is.

The Clang implementation is actually quite simple and, IIRC, I heard in the past someone mentioning that trapping instructions actually provide benefits for holding undesired straight-line speculation. Maybe someone can comment on that, or even if that is really relevant.

Meanwhile I'll work on pushing it then.