[RFC PATCH v3 2/5] x86: Support for Static Trampolines
DJ Delorie
dj@redhat.com
Fri Jan 29 02:09:56 GMT 2021
"Madhavan T. Venkataraman" <madvenka@linux.microsoft.com> writes:
> So, the definition is like this:
>
> #if !defined(GENERATE_LIBFFI_MAP) && defined(__ASSEMBLER__) \
> && defined(__CET__)
> # include <cet.h>
> # define _CET_NOTRACK notrack
> #else
> # define _CET_ENDBR
> # define _CET_NOTRACK
> #endif
>
> Where we include cet.h, CET_ENDBR may still be defined either
> as endbr64 or empty depending on __CET__ & 1 being non-zero or
> zero, right?
>
> So, would something like this work?
I suspect you only need one trampoline template, with __CET_ENDBR in it. Use
.align instead of hardcoding the right number of NOPs, and other logic
to figure out the repeat counts. It's safe to execute endbr64 when CET
is not enabled.
More information about the Libffi-discuss
mailing list