[PATCH] add support for -fcf-protection
nisse at lysator.liu.se
Sat Jun 1 08:08:33 UTC 2019
Jakub Martisko <jamartis at redhat.com> writes:
> attached patch modifies the x86_64 assembly files, to support
> -fcf-protection/intel CET [1,2] controls. Modifications are done via the
> m4 macros, so it should be quite easy to modify the patch to use the
> changes only conditionaly druing the compilation.
> --- a/mpn/x86_64/coreibwl/addmul_1.asm
> +++ b/mpn/x86_64/coreibwl/addmul_1.asm
> @@ -107,33 +107,39 @@ L(tab): JMPENT( L(f0), L(tab))
> JMPENT( L(f7), L(tab))
> -L(f0): mulx( (up), %r10, %r8)
> +L(f0): CFPROT_ENDBR
> + mulx( (up), %r10, %r8)
This looks a bit intrusive. Maybe better to split the L macro into two,
one for code labels and one for data labels, and have the expansion of
the former include an endbr instructin, when appropriate?
> diff --git a/mpn/x86_64/coreihwl/mul_basecase.asm b/mpn/x86_64/coreihwl/mul_basecase.asm
> index b2656c8..e4a8381 100644
> --- a/mpn/x86_64/coreihwl/mul_basecase.asm
> +++ b/mpn/x86_64/coreihwl/mul_basecase.asm
> @@ -439,3 +439,4 @@ L(ret2):pop %rbp
Adn this should perhaps go into ASM_END. Not sure how consistently
ASM_END is used, though. Another alternative is to use m4 divert to get the
note added at the end of each assembly file.
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
More information about the gmp-devel