unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] aarch64: fix stack missing after sp is updated
@ 2021-01-04 12:42 Shuo Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Shuo Wang @ 2021-01-04 12:42 UTC (permalink / raw
  To: libc-alpha, szabolcs.nagy, carlos; +Cc: hushiyuan

After sp is updated, the CFA offset should be set before next instruction.
Tested in glibc-2.28:
Thread 2 "xxxxxxx" hit Breakpoint 1, _dl_tlsdesc_dynamic () at ../sysdeps/aarch64/dl-tlsdesc.S:149
149		stp	x1,  x2, [sp, #-32]!
Missing separate debuginfos, use: dnf debuginfo-install libgcc-7.3.0-20190804.h24.aarch64
(gdb) bt
#0  _dl_tlsdesc_dynamic () at ../sysdeps/aarch64/dl-tlsdesc.S:149
#1  0x0000ffffbe4fbb44 in OurFunction (threadId=3194870184)
    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:150
150		stp	x3,  x4, [sp, #16]
(gdb) bt
#0  _dl_tlsdesc_dynamic () at ../sysdeps/aarch64/dl-tlsdesc.S:150
#1  0x0000ffffbe4fbb44 in OurFunction (threadId=3194870184)
    at /home/test/test_function.c:30
#2  0x0000000000000000 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) ni
_dl_tlsdesc_dynamic () at ../sysdeps/aarch64/dl-tlsdesc.S:157
157		mrs	x4, tpidr_el0
(gdb) bt
#0  _dl_tlsdesc_dynamic () at ../sysdeps/aarch64/dl-tlsdesc.S:157
#1  0x0000ffffbe4fbb44 in OurFunction (threadId=3194870184)
    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

Signed-off-by: liqingqing <liqingqing3@huawei.com>
Signed-off-by: Shuo Wang <wangshuo47@huawei.com>
---
 sysdeps/aarch64/dl-tlsdesc.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
index 0046d29f9b..425e45a50f 100644
--- a/sysdeps/aarch64/dl-tlsdesc.S
+++ b/sysdeps/aarch64/dl-tlsdesc.S
@@ -150,8 +150,8 @@ _dl_tlsdesc_dynamic:
 	/* Save just enough registers to support fast path, if we fall
 	   into slow path we will save additional registers.  */
 	stp	x1,  x2, [sp, #-32]!
-	stp	x3,  x4, [sp, #16]
 	cfi_adjust_cfa_offset (32)
+	stp	x3,  x4, [sp, #16]
 	cfi_rel_offset (x1, 0)
 	cfi_rel_offset (x2, 8)
 	cfi_rel_offset (x3, 16)
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] aarch64: fix stack missing after sp is updated
@ 2021-01-05  1:59 Shuo Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Shuo Wang @ 2021-01-05  1:59 UTC (permalink / raw
  To: libc-alpha, szabolcs.nagy, carlos; +Cc: hushiyuan

After sp is updated, the CFA offset should be set before next instruction.
Tested in glibc-2.28:
Thread 2 "xxxxxxx" hit Breakpoint 1, _dl_tlsdesc_dynamic () at ../sysdeps/aarch64/dl-tlsdesc.S:149
149		stp	x1,  x2, [sp, #-32]!
Missing separate debuginfos, use: dnf debuginfo-install libgcc-7.3.0-20190804.h24.aarch64
(gdb) bt
#0  _dl_tlsdesc_dynamic () at ../sysdeps/aarch64/dl-tlsdesc.S:149
#1  0x0000ffffbe4fbb44 in OurFunction (threadId=3194870184)
    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:150
150		stp	x3,  x4, [sp, #16]
(gdb) bt
#0  _dl_tlsdesc_dynamic () at ../sysdeps/aarch64/dl-tlsdesc.S:150
#1  0x0000ffffbe4fbb44 in OurFunction (threadId=3194870184)
    at /home/test/test_function.c:30
#2  0x0000000000000000 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) ni
_dl_tlsdesc_dynamic () at ../sysdeps/aarch64/dl-tlsdesc.S:157
157		mrs	x4, tpidr_el0
(gdb) bt
#0  _dl_tlsdesc_dynamic () at ../sysdeps/aarch64/dl-tlsdesc.S:157
#1  0x0000ffffbe4fbb44 in OurFunction (threadId=3194870184)
    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

Co-authored-by: liqingqing <liqingqing3@huawei.com>
---
 sysdeps/aarch64/dl-tlsdesc.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
index 0046d29f9b..425e45a50f 100644
--- a/sysdeps/aarch64/dl-tlsdesc.S
+++ b/sysdeps/aarch64/dl-tlsdesc.S
@@ -150,8 +150,8 @@ _dl_tlsdesc_dynamic:
 	/* Save just enough registers to support fast path, if we fall
 	   into slow path we will save additional registers.  */
 	stp	x1,  x2, [sp, #-32]!
-	stp	x3,  x4, [sp, #16]
 	cfi_adjust_cfa_offset (32)
+	stp	x3,  x4, [sp, #16]
 	cfi_rel_offset (x1, 0)
 	cfi_rel_offset (x2, 8)
 	cfi_rel_offset (x3, 16)
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] aarch64: fix stack missing after sp is updated
@ 2021-01-05  2:02 Shuo Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Shuo Wang @ 2021-01-05  2:02 UTC (permalink / raw
  To: libc-alpha, szabolcs.nagy, carlos; +Cc: hushiyuan

	Dear Szabolcs,

Thanks for your reply. 'aarch64: ' prefix has been added to subject,
and signature has been replaced by Co-authored-by. This is the new patch:
https://sourceware.org/pipermail/libc-alpha/2021-January/121328.html

Best regards,
Shuo
>please add 'aarch64: ' prefix to the subject.
>
>i think it's enough to have the before the fix gdb
>session in the commit message.
>
>with those changes this is ok to commit.
>(if you don't have commit rights then send
>an updated patch and i'll commit it for you)
>
>> ---
>>  sysdeps/aarch64/dl-tlsdesc.S | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
>> index 0046d29f9b..425e45a50f 100644
>> --- a/sysdeps/aarch64/dl-tlsdesc.S
>> +++ b/sysdeps/aarch64/dl-tlsdesc.S
>> @@ -150,8 +150,8 @@ _dl_tlsdesc_dynamic:
>>  	/* Save just enough registers to support fast path, if we fall
>>  	   into slow path we will save additional registers.  */
>>  	stp	x1,  x2, [sp, #-32]!
>> -	stp	x3,  x4, [sp, #16]
>>  	cfi_adjust_cfa_offset (32)
>> +	stp	x3,  x4, [sp, #16]
>>  	cfi_rel_offset (x1, 0)
>>  	cfi_rel_offset (x2, 8)
>>  	cfi_rel_offset (x3, 16)
>> -- 
>> 2.23.0
>> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] aarch64: fix stack missing after sp is updated
@ 2021-01-05  2:22 Shuo Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Shuo Wang @ 2021-01-05  2:22 UTC (permalink / raw
  To: libc-alpha, szabolcs.nagy, carlos; +Cc: hushiyuan

Just ignore this mail.
>
>	Dear Szabolcs,
>
>Thanks for your reply. 'aarch64: ' prefix has been added to subject,
>and signature has been replaced by Co-authored-by. This is the new patch:
>https://sourceware.org/pipermail/libc-alpha/2021-January/121328.html
>
>Best regards,
>Shuo
>>please add 'aarch64: ' prefix to the subject.
>>
>>i think it's enough to have the before the fix gdb
>>session in the commit message.
>>
>>with those changes this is ok to commit.
>>(if you don't have commit rights then send
>>an updated patch and i'll commit it for you)
>>
>>> ---
>>>  sysdeps/aarch64/dl-tlsdesc.S | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>> 
>>> diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
>>> index 0046d29f9b..425e45a50f 100644
>>> --- a/sysdeps/aarch64/dl-tlsdesc.S
>>> +++ b/sysdeps/aarch64/dl-tlsdesc.S
>>> @@ -150,8 +150,8 @@ _dl_tlsdesc_dynamic:
>>>  	/* Save just enough registers to support fast path, if we fall
>>>  	   into slow path we will save additional registers.  */
>>>  	stp	x1,  x2, [sp, #-32]!
>>> -	stp	x3,  x4, [sp, #16]
>>>  	cfi_adjust_cfa_offset (32)
>>> +	stp	x3,  x4, [sp, #16]
>>>  	cfi_rel_offset (x1, 0)
>>>  	cfi_rel_offset (x2, 8)
>>>  	cfi_rel_offset (x3, 16)
>>> -- 
>>> 2.23.0
>>> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] aarch64: fix stack missing after sp is updated
@ 2021-01-05 10:39 Shuo Wang
  2021-01-05 11:21 ` Florian Weimer via Libc-alpha
  0 siblings, 1 reply; 6+ messages in thread
From: Shuo Wang @ 2021-01-05 10:39 UTC (permalink / raw
  To: libc-alpha, szabolcs.nagy, carlos; +Cc: hushiyuan

	Dear Szabolcs,

The Signed-off-by in commit cd6274089f has not been removed before being merged,
I was wondering if I am supposed to re-submit it?

Best regards,
Shuo
>please add 'aarch64: ' prefix to the subject.
>
>i think it's enough to have the before the fix gdb
>session in the commit message.
>
>with those changes this is ok to commit.
>(if you don't have commit rights then send
>an updated patch and i'll commit it for you)
>
>> ---
>>  sysdeps/aarch64/dl-tlsdesc.S | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
>> index 0046d29f9b..425e45a50f 100644
>> --- a/sysdeps/aarch64/dl-tlsdesc.S
>> +++ b/sysdeps/aarch64/dl-tlsdesc.S
>> @@ -150,8 +150,8 @@ _dl_tlsdesc_dynamic:
>>  	/* Save just enough registers to support fast path, if we fall
>>  	   into slow path we will save additional registers.  */
>>  	stp	x1,  x2, [sp, #-32]!
>> -	stp	x3,  x4, [sp, #16]
>>  	cfi_adjust_cfa_offset (32)
>> +	stp	x3,  x4, [sp, #16]
>>  	cfi_rel_offset (x1, 0)
>>  	cfi_rel_offset (x2, 8)
>>  	cfi_rel_offset (x3, 16)
>> -- 
>> 2.23.0
>> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] aarch64: fix stack missing after sp is updated
  2021-01-05 10:39 Shuo Wang
@ 2021-01-05 11:21 ` Florian Weimer via Libc-alpha
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Weimer via Libc-alpha @ 2021-01-05 11:21 UTC (permalink / raw
  To: Shuo Wang; +Cc: libc-alpha, hushiyuan

* Shuo Wang:

> The Signed-off-by in commit cd6274089f has not been removed before
> being merged, I was wondering if I am supposed to re-submit it?

It's too late, we can't remove it from the history now.  We will just
assume it's covered by Huawei's copyright assignment.

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-05 11:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-04 12:42 [PATCH] aarch64: fix stack missing after sp is updated Shuo Wang
  -- strict thread matches above, loose matches on Subject: below --
2021-01-05  1:59 Shuo Wang
2021-01-05  2:02 Shuo Wang
2021-01-05  2:22 Shuo Wang
2021-01-05 10:39 Shuo Wang
2021-01-05 11:21 ` Florian Weimer via Libc-alpha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).