Add BTI landing pads for aarch64

When Branch Target Identifier (BTI) is enabled on aarch64,
any software which run libglvnd will fail with SIGILL, Illegal instruction.
This is because some assembler code misses the BTI landing pads.
See: https://developer.arm.com/documentation/102433/0100/Jump-oriented-programming

"hint #34" is the same thing as "BTI C" landing pad, but keep
compatibility with systems without BTI enabled.
This commit is contained in:
Guillaume Gardet 2022-01-21 09:26:07 +01:00
parent b2f8babece
commit 7107f73939
2 changed files with 2 additions and 0 deletions

View File

@ -90,6 +90,7 @@ extern char glx_entrypoint_end[];
#define STUB_SIZE 16
#define STUB_ASM_ARCH(slot) \
"hint #34\n" \
"adrp x16, entrypointFunctions + " slot "*8\n" \
"ldr x16, [x16, #:lo12:(entrypointFunctions + " slot "*8)]\n" \
"br x16\n"

View File

@ -69,6 +69,7 @@
* table then does a branch without link to the function address.
*/
#define STUB_ASM_CODE(slot) \
"hint #34\n\t" \
"stp x1, x0, [sp, #-16]!\n\t" \
"adrp x0, :got:_glapi_Current\n\t" \
"ldr x0, [x0, #:got_lo12:_glapi_Current]\n\t" \