diff options
Diffstat (limited to 'sysdeps/unix/sysv/linux/aarch64')
-rw-r--r-- | sysdeps/unix/sysv/linux/aarch64/Makefile | 13 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/aarch64/arch-syscall.h | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/aarch64/cpu-features.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/aarch64/libc.abilist | 14 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/aarch64/libm.abilist | 24 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/aarch64/libmvec.abilist | 20 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/aarch64/makecontext.c | 4 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/aarch64/setcontext.S | 27 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/aarch64/swapcontext.S | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/aarch64/tst-tlsdesc-pac-mod.c | 27 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/aarch64/tst-tlsdesc-pac.c | 48 |
11 files changed, 159 insertions, 22 deletions
diff --git a/sysdeps/unix/sysv/linux/aarch64/Makefile b/sysdeps/unix/sysv/linux/aarch64/Makefile index 0839f0b..15a2b44 100644 --- a/sysdeps/unix/sysv/linux/aarch64/Makefile +++ b/sysdeps/unix/sysv/linux/aarch64/Makefile @@ -1,3 +1,16 @@ +ifeq ($(subdir),elf) +tests += \ + tst-tlsdesc-pac \ + # tests +modules-names += \ + tst-tlsdesc-pac-mod \ + # modules-names + +LDFLAGS-tst-tlsdesc-pac = -rdynamic + +$(objpfx)tst-tlsdesc-pac.out: $(objpfx)tst-tlsdesc-pac-mod.so +endif + ifeq ($(subdir),misc) sysdep_headers += sys/elf.h tests += \ diff --git a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h index 89aced0..ba4a461 100644 --- a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h @@ -175,6 +175,7 @@ #define __NR_nfsservctl 42 #define __NR_open_by_handle_at 265 #define __NR_open_tree 428 +#define __NR_open_tree_attr 467 #define __NR_openat 56 #define __NR_openat2 437 #define __NR_perf_event_open 241 diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c index 6d63c8a..1acc82d 100644 --- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c +++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c @@ -23,6 +23,7 @@ #include <sys/prctl.h> #include <sys/utsname.h> #include <dl-tunables-parse.h> +#include <dl-symbol-redir-ifunc.h> #define DCZID_DZP_MASK (1 << 4) #define DCZID_BS_MASK (0xf) diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist index 41f8f39..a22e651 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist @@ -2752,4 +2752,18 @@ GLIBC_2.41 sched_getattr F GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F +GLIBC_2.42 cfgetibaud F +GLIBC_2.42 cfgetispeed F +GLIBC_2.42 cfgetobaud F +GLIBC_2.42 cfgetospeed F +GLIBC_2.42 cfsetbaud F +GLIBC_2.42 cfsetibaud F +GLIBC_2.42 cfsetispeed F +GLIBC_2.42 cfsetobaud F +GLIBC_2.42 cfsetospeed F +GLIBC_2.42 cfsetspeed F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F diff --git a/sysdeps/unix/sysv/linux/aarch64/libm.abilist b/sysdeps/unix/sysv/linux/aarch64/libm.abilist index 75ae168..bb8114b 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libm.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libm.abilist @@ -1245,6 +1245,22 @@ GLIBC_2.41 tanpif32x F GLIBC_2.41 tanpif64 F GLIBC_2.41 tanpif64x F GLIBC_2.41 tanpil F +GLIBC_2.42 compoundn F +GLIBC_2.42 compoundnf F +GLIBC_2.42 compoundnf128 F +GLIBC_2.42 compoundnf32 F +GLIBC_2.42 compoundnf32x F +GLIBC_2.42 compoundnf64 F +GLIBC_2.42 compoundnf64x F +GLIBC_2.42 compoundnl F +GLIBC_2.42 pown F +GLIBC_2.42 pownf F +GLIBC_2.42 pownf128 F +GLIBC_2.42 pownf32 F +GLIBC_2.42 pownf32x F +GLIBC_2.42 pownf64 F +GLIBC_2.42 pownf64x F +GLIBC_2.42 pownl F GLIBC_2.42 powr F GLIBC_2.42 powrf F GLIBC_2.42 powrf128 F @@ -1253,6 +1269,14 @@ GLIBC_2.42 powrf32x F GLIBC_2.42 powrf64 F GLIBC_2.42 powrf64x F GLIBC_2.42 powrl F +GLIBC_2.42 rootn F +GLIBC_2.42 rootnf F +GLIBC_2.42 rootnf128 F +GLIBC_2.42 rootnf32 F +GLIBC_2.42 rootnf32x F +GLIBC_2.42 rootnf64 F +GLIBC_2.42 rootnf64x F +GLIBC_2.42 rootnl F GLIBC_2.42 rsqrt F GLIBC_2.42 rsqrtf F GLIBC_2.42 rsqrtf128 F diff --git a/sysdeps/unix/sysv/linux/aarch64/libmvec.abilist b/sysdeps/unix/sysv/linux/aarch64/libmvec.abilist index a56ce7f..f7f72b6 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libmvec.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libmvec.abilist @@ -148,3 +148,23 @@ GLIBC_2.41 _ZGVsMxv_sinpi F GLIBC_2.41 _ZGVsMxv_sinpif F GLIBC_2.41 _ZGVsMxv_tanpi F GLIBC_2.41 _ZGVsMxv_tanpif F +GLIBC_2.42 _ZGVnN2v_acospi F +GLIBC_2.42 _ZGVnN2v_acospif F +GLIBC_2.42 _ZGVnN2v_asinpi F +GLIBC_2.42 _ZGVnN2v_asinpif F +GLIBC_2.42 _ZGVnN2v_atanpi F +GLIBC_2.42 _ZGVnN2v_atanpif F +GLIBC_2.42 _ZGVnN2vv_atan2pi F +GLIBC_2.42 _ZGVnN2vv_atan2pif F +GLIBC_2.42 _ZGVnN4v_acospif F +GLIBC_2.42 _ZGVnN4v_asinpif F +GLIBC_2.42 _ZGVnN4v_atanpif F +GLIBC_2.42 _ZGVnN4vv_atan2pif F +GLIBC_2.42 _ZGVsMxv_acospi F +GLIBC_2.42 _ZGVsMxv_acospif F +GLIBC_2.42 _ZGVsMxv_asinpi F +GLIBC_2.42 _ZGVsMxv_asinpif F +GLIBC_2.42 _ZGVsMxv_atanpi F +GLIBC_2.42 _ZGVsMxv_atanpif F +GLIBC_2.42 _ZGVsMxvv_atan2pi F +GLIBC_2.42 _ZGVsMxvv_atan2pif F diff --git a/sysdeps/unix/sysv/linux/aarch64/makecontext.c b/sysdeps/unix/sysv/linux/aarch64/makecontext.c index a2eab9e..4485723 100644 --- a/sysdeps/unix/sysv/linux/aarch64/makecontext.c +++ b/sysdeps/unix/sysv/linux/aarch64/makecontext.c @@ -36,9 +36,7 @@ static struct _aarch64_ctx *extension (void *p) static void * alloc_makecontext_gcs (size_t stack_size) { - void *base; - size_t size; - void *gcsp = __alloc_gcs (stack_size, &base, &size); + void *gcsp = __alloc_gcs (stack_size, NULL); if (gcsp == NULL) /* ENOSYS, bad size or OOM. */ abort (); diff --git a/sysdeps/unix/sysv/linux/aarch64/setcontext.S b/sysdeps/unix/sysv/linux/aarch64/setcontext.S index 022a263..d9716f0 100644 --- a/sysdeps/unix/sysv/linux/aarch64/setcontext.S +++ b/sysdeps/unix/sysv/linux/aarch64/setcontext.S @@ -48,25 +48,16 @@ ENTRY (__setcontext) cbz x0, 1f b C_SYMBOL_NAME (__syscall_error) 1: - /* Disable ZA of SME. */ -#if HAVE_AARCH64_PAC_RET - PACIASP - cfi_window_save -#endif - stp x29, x30, [sp, -16]! - cfi_adjust_cfa_offset (16) - cfi_rel_offset (x29, 0) - cfi_rel_offset (x30, 8) - mov x29, sp + /* Clear ZA state of SME. */ + /* The calling convention of __libc_arm_za_disable allows to do + this thus allowing to avoid saving to and reading from stack. + As a result we also don't need to sign the return address and + check it after returning because it is not stored to stack. */ + mov x13, x30 + cfi_register (x30, x13) bl __libc_arm_za_disable - ldp x29, x30, [sp], 16 - cfi_adjust_cfa_offset (-16) - cfi_restore (x29) - cfi_restore (x30) -#if HAVE_AARCH64_PAC_RET - AUTIASP - cfi_window_save -#endif + mov x30, x13 + cfi_register (x13, x30) /* Restore the general purpose registers. */ mov x0, x9 cfi_def_cfa (x0, 0) diff --git a/sysdeps/unix/sysv/linux/aarch64/swapcontext.S b/sysdeps/unix/sysv/linux/aarch64/swapcontext.S index cc41253..58ddb95 100644 --- a/sysdeps/unix/sysv/linux/aarch64/swapcontext.S +++ b/sysdeps/unix/sysv/linux/aarch64/swapcontext.S @@ -119,7 +119,7 @@ L(gcs_done): 2: /* The oucp context is restored here via an indirect branch, x1 must be restored too which has the real return address. */ - BTI_J + bti j mov x30, x1 RET PSEUDO_END (__swapcontext) diff --git a/sysdeps/unix/sysv/linux/aarch64/tst-tlsdesc-pac-mod.c b/sysdeps/unix/sysv/linux/aarch64/tst-tlsdesc-pac-mod.c new file mode 100644 index 0000000..d34c8be --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/tst-tlsdesc-pac-mod.c @@ -0,0 +1,27 @@ +/* AArch64 tests for unwinding TLSDESC (BZ 32612) + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +_Thread_local int foo; +/* Make the TLS segment large enough to trigger _dl_tlsdesc_dynamic. */ +_Thread_local int foobar[1000]; + +void +bar (void) +{ + foo = 1; +} diff --git a/sysdeps/unix/sysv/linux/aarch64/tst-tlsdesc-pac.c b/sysdeps/unix/sysv/linux/aarch64/tst-tlsdesc-pac.c new file mode 100644 index 0000000..24d656a --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/tst-tlsdesc-pac.c @@ -0,0 +1,48 @@ +/* AArch64 tests for unwinding TLSDESC (BZ 32612) + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdlib.h> +#include <unwind.h> +#include <support/xdlfcn.h> + +static _Unwind_Reason_Code +unwind_callback (struct _Unwind_Context* context, void* closure) +{ + return _URC_NO_REASON; +} + +/* Assume that TLS variable from tst-tlsdesc-pac-mod.so will trigger + the slow-path that allocates the required memory with malloc. */ +void * +malloc (size_t s) +{ + _Unwind_Backtrace (unwind_callback, NULL); + return calloc (1, s); +} + +static int +do_test (void) +{ + void *h = xdlopen ("tst-tlsdesc-pac-mod.so", RTLD_LAZY); + void (*func)(void) = xdlsym (h, "bar"); + func (); + + return 0; +} + +#include <support/test-driver.c> |