Message ID | 20210104144723.32148-1-wangshuo47@huawei.com |
---|---|
State | New |
Headers | show |
Series | aarch64: push the set of rules before falling into slow path | expand |
The 01/04/2021 22:47, Shuo Wang wrote: > It is supposed to save the rules for the instructions before falling into slow path. ... > (gdb) bt > #0 _dl_tlsdesc_dynamic () at ../sysdeps/aarch64/dl-tlsdesc.S:169 > #1 0x0000ffffbe4fbb44 in OurFunction (threadId=4294967295) > at /home/test/test_function.c:30 > #2 0x0000000000400c08 in initaaa () at thread.c:58 > #3 0x0000000000400c50 in thread_proc (param=0x0) at thread.c:71 > #4 0x0000ffffbf6918bc in start_thread (arg=0xfffffffff29f) at pthread_create.c:486 > #5 0x0000ffffbf5669ec in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:78 > (gdb) ni > _dl_tlsdesc_dynamic () at ../sysdeps/aarch64/dl-tlsdesc.S:184 > 184 stp x29, x30, [sp,#-16*NSAVEXREGPAIRS]! > (gdb) bt > #0 _dl_tlsdesc_dynamic () at ../sysdeps/aarch64/dl-tlsdesc.S:184 > #1 0x0000ffffbe4fbb44 in OurFunction (threadId=4294967295) > at /home/test/test_function.c:30 > #2 0x0000000000000000 in ?? () > Backtrace stopped: previous frame identical to this frame (corrupt stack?) > > Signed-off-by: liqingqing <liqingqing3@huawei.com> > Signed-off-by: Shuo Wang <wangshuo47@huawei.com> > --- > sysdeps/aarch64/dl-tlsdesc.S | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S > index 425e45a50f..aee63cc561 100644 > --- a/sysdeps/aarch64/dl-tlsdesc.S > +++ b/sysdeps/aarch64/dl-tlsdesc.S > @@ -170,6 +170,7 @@ _dl_tlsdesc_dynamic: > ldr PTR_REG (0), [x0] /* Load val member of DTV entry. */ > cmp PTR_REG (0), #TLS_DTV_UNALLOCATED > b.eq 2f > + cfi_remember_state > sub PTR_REG (3), PTR_REG (3), PTR_REG (4) > add PTR_REG (0), PTR_REG (0), PTR_REG (3) > 1: > @@ -188,6 +189,7 @@ _dl_tlsdesc_dynamic: > cfi_window_save > # endif > # define NSAVEXREGPAIRS 8 > + cfi_restore_state this should be before the cfi_window_save otherwise the PAC signing state is restored which we dont want. just move this cfi above the PAC bits. the patch looks good otherwise. note that we dont use Signed-off-by: in glibc (which linux uses for copyright purposes). if you have coauthors then use Co-authored-by: > stp x29, x30, [sp,#-16*NSAVEXREGPAIRS]! > cfi_adjust_cfa_offset (16*NSAVEXREGPAIRS) > cfi_rel_offset (x29, 0) > -- > 2.23.0 >
diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S index 425e45a50f..aee63cc561 100644 --- a/sysdeps/aarch64/dl-tlsdesc.S +++ b/sysdeps/aarch64/dl-tlsdesc.S @@ -170,6 +170,7 @@ _dl_tlsdesc_dynamic: ldr PTR_REG (0), [x0] /* Load val member of DTV entry. */ cmp PTR_REG (0), #TLS_DTV_UNALLOCATED b.eq 2f + cfi_remember_state sub PTR_REG (3), PTR_REG (3), PTR_REG (4) add PTR_REG (0), PTR_REG (0), PTR_REG (3) 1: @@ -188,6 +189,7 @@ _dl_tlsdesc_dynamic: cfi_window_save # endif # define NSAVEXREGPAIRS 8 + cfi_restore_state stp x29, x30, [sp,#-16*NSAVEXREGPAIRS]! cfi_adjust_cfa_offset (16*NSAVEXREGPAIRS) cfi_rel_offset (x29, 0)