On Mon, Apr 14, 2025 at 04:43:26PM -0700, Josh Poimboeuf wrote:

> > +    * Verify all indirect calls are kCFI adorned by checking for the
> > +    * UD2. Notably, doing __nocfi calls to regular (cfi) functions is
> > +    * broken.
> 
> This "__nocfi calls" is confusing me.  IIUC, there are two completely
> different meanings for "nocfi":
> 
>   - __nocfi: disable the kcfi function entry stuff

Ah, no. __nocfi is a bit of a mess, this is both the function entry
thing, but also very much the caller verification stuff for indirect
calls done inside this function.

This leads to lovely stuff like:

void (*foo)(void);

static __always_inline __nocfi void nocfi_caller(void)
{
        foo();
}

void bar(void)
{
        nocfi_caller();
        foo();
}

This actually compiles and has bar() have two distinctly different
indirect calls to foo, while bar itself has a __cfi preamble.


Anyway, let me have a poke at the annotation.

Reply via email to