This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] S390: Fix backtrace in vdso functions.



On 04/12/2017 05:59, Stefan Liebler wrote:
> On 11/28/2017 02:09 PM, Adhemerval Zanella wrote:
>>
>>
>> On 28/11/2017 10:44, Stefan Liebler wrote:
>>> Hi,
>>>
>>> On s390, GDB fails to show the complete backtrace from within vdso functions. The macro INTERNAL_VSYSCALL_CALL saves the return address in r14 to r10 before branching to the vdso function. The branch-instruction updates r14 in order to let the vdso function return. Then the original address in r14 is restored from r10. Unfortunately, there are no cfi-rules and GDB fails.
>>>
>>> Furthermore the call of the vdso function does not comply with the s390 ABI as no stack-frame for the vdso-function is generated.
>>>
>>> This patch removes the s390 specific macro INTERNAL_VSYSCALL_CALL and the common implementation in sysdeps/unix/sysv/linux/sysdep-vdso.h is used. Then the vdso function is called via function-pointer and GCC generates a new stack-frame and emits all needed cfi-rules.
>>>
>>> The defines CLOBBER_[0-6] are removed as they  were only used in macro INTERNAL_VSYSCALL_CALL.
>>>
>>> The macro INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK is not used on s390. The only user is power. Thus it is removed from s390 sysdep.h.
>>
>> I am almost sure we can remove it for powerpc as well (I can't see
>> no immediate gain on doing a function call using inline assembly
>> as for INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK on powerpc).
>>
>>
>>>
>>> ChangeLog:
>>>
>>>      * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
>>>      (INTERNAL_VSYSCALL_CALL, CLOBBER_0, CLOBBER_1, CLOBBER_2,
>>>       CLOBBER_3, CLOBBER_4, CLOBBER_5, CLOBBER_6,
>>>      INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK): Remove.
>>>      * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise.
>>
>> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
>>
> 
> If there are no objections regarding the s390 patch, I'll commit.
> 
> Adhemerval: Do you keep working on removing INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK on powerpc?

Different than s390 where the an error is indicate through a negative value,
powerpc signals an error through CR0.SO.  And __kernel_clock_getres and 
__kernel_clock_gettime fallback to a syscall call in case the timers are
not supported through vDSO, which requires we check CR0.SO value.  I do
not a reliable way to check it after a function call on GCC (we can issue
a volatile assembly after it, but I think it is still fragile and it
would require a arch-specific wrapper anyway).

There is also the issue with __kernel_get_tbfreq which returns a 64 bit
value for powercp32, so we need another wrapper that does expect the return
code as long int.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]