]> git.ipfire.org Git - thirdparty/glibc.git/commit
aarch64: Fix _dl_tlsdesc_dynamic unwind for pac-ret (BZ 32612)
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 28 Mar 2025 17:27:45 +0000 (14:27 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 31 Mar 2025 13:08:06 +0000 (10:08 -0300)
commit4352e2cc934b2874dba37397157bf890fcee455a
tree5bcc9ff6e6cef71333269d05bca4627f6d568c24
parent145097dff170507fe73190e8e41194f5b5f7e6bf
aarch64: Fix _dl_tlsdesc_dynamic unwind for pac-ret (BZ 32612)

When libgcc is built with pac-ret, it requires to autenticate the
unwinding frame based on CFI information.  The _dl_tlsdesc_dynamic
uses a custom calling convention, where it is responsible to save
and restore all registers it might use (even volatile).

The pac-ret support added by 1be3d6eb823d8b952fa54b7bbc90cbecb8981380
was added only on the slow-path, but the fast path also adds DWARF
Register Rule Instruction (cfi_adjust_cfa_offset) since it requires
to save/restore some auxiliary register.  It seems that this is not
fully supported neither by libgcc nor AArch64 ABI [1].

Instead, move paciasp/autiasp to function prologue/epilogue to be
used on both fast and slow paths.

I also corrected the _dl_tlsdesc_dynamic comment description, it was
copied from i386 implementation without any adjustment.

Checked on aarch64-linux-gnu with a toolchain built with
--enable-standard-branch-protection on a system with pac-ret
support.

[1]  https://github.com/ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst#id1

Reviewed-by: Yury Khrustalev <yury.khrustalev@arm.com>
sysdeps/aarch64/dl-tlsdesc.S
sysdeps/unix/sysv/linux/aarch64/Makefile
sysdeps/unix/sysv/linux/aarch64/tst-tlsdesc-pac-mod.c [new file with mode: 0644]
sysdeps/unix/sysv/linux/aarch64/tst-tlsdesc-pac.c [new file with mode: 0644]