NVIDIA / libglvnd

The GL Vendor-Neutral Dispatch library
496 stars 92 forks source link

Add BTI landing pads for aarch64 #214

Closed ggardet closed 2 years ago

ggardet commented 2 years ago

When Branch Target Identifier (BTI) is enabled on aarch64, any software which run libglvnd will fail with SIGILL, Illegal instruction. If I run kmscube within gdb, I get:

Thread 1 "kmscube" received signal SIGILL, Illegal instruction.
0x0000fffff7e7e300 in glGetString () from /lib64/libGLESv2.so.2
#0  0x0000fffff7e7e300 in glGetString () from /lib64/libGLESv2.so.2
#1  0x0000aaaaaaaa7b28 in ?? ()
#2  0x0000aaaaaaaa5dc8 [PAC] in ?? ()
#3  0x0000fffff77b70c4 [PAC] in __libc_start_call_main () from /lib64/libc.so.6
#4  0x0000fffff77b7198 [PAC] in __libc_start_main_impl () from /lib64/libc.so.6
#5  0x0000aaaaaaaa75f8 [PAC] in ?? ()

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.

kbrenneman commented 2 years ago

@ggardet - Libglvnd is hosted on GitLab now. Can you please post this as a merge request there? https://gitlab.freedesktop.org/glvnd/libglvnd

ggardet commented 2 years ago

@ggardet - Libglvnd is hosted on GitLab now. Can you please post this as a merge request there? https://gitlab.freedesktop.org/glvnd/libglvnd

Done: https://gitlab.freedesktop.org/glvnd/libglvnd/-/merge_requests/262