[compiler-rt] r297995 - [PowerPC] Fix sanitizer frame unwind on 32-bit ABIs
Evgenii Stepanov via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 16 18:12:00 PDT 2017
I can confirm that this breaks many sanitizer tests on i686 and x86_64.
On Thu, Mar 16, 2017 at 4:16 PM, Juergen Ributzka via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Looks like this broke our bot:
> http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/29210/
>
> Could you please take a look?
>
> Thanks
>
> Cheers,
> Juergen
>
>
> On Thu, Mar 16, 2017 at 2:38 PM, Kostya Serebryany via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>>
>> Hi Bill,
>>
>> * Has this been code-reviewed? In general, please do pre-commit code
>> reviews for any code that is common between Power and other platforms.
>> Even if (or: especially if) there are #ifdefs involved. (I hate #ifdefs)
>> * Is there any chance to get rid of #ifdefs and replace them with if()? Or
>> maybe just a separate implementation for Power?
>> * do the existing tests cover the problems that this change solves?
>>
>>
>> Thanks,
>> --kcc
>>
>> On Thu, Mar 16, 2017 at 2:14 PM, Bill Seurer via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>>>
>>> Author: seurer
>>> Date: Thu Mar 16 16:14:13 2017
>>> New Revision: 297995
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=297995&view=rev
>>> Log:
>>> [PowerPC] Fix sanitizer frame unwind on 32-bit ABIs
>>>
>>> This fixes many sanitizer problems with -m32. It is really intended
>>> for gcc but patches to the sanitizers make their way through llvm
>>> first.
>>>
>>> ref: https://gcc.gnu.org/ml/gcc-patches/2017-02/msg00855.html
>>>
>>> Modified:
>>> compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
>>>
>>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc?rev=297995&r1=297994&r2=297995&view=diff
>>>
>>> ==============================================================================
>>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
>>> (original)
>>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc Thu
>>> Mar 16 16:14:13 2017
>>> @@ -79,15 +79,22 @@ void BufferedStackTrace::FastUnwindStack
>>> while (IsValidFrame((uptr)frame, stack_top, bottom) &&
>>> IsAligned((uptr)frame, sizeof(*frame)) &&
>>> size < max_depth) {
>>> + // PowerPC ABIs specify that the return address is saved on the
>>> + // *caller's* stack frame. Thus we must dereference the back chain
>>> + // to find the caller frame before extracting it.
>>> + uhwptr *caller_frame = (uhwptr*)frame[0];
>>> + if (!IsValidFrame((uptr)caller_frame, stack_top, bottom) ||
>>> + !IsAligned((uptr)caller_frame, sizeof(uhwptr)))
>>> + break;
>>> #ifdef __powerpc__
>>> - // PowerPC ABIs specify that the return address is saved at offset
>>> - // 16 of the *caller's* stack frame. Thus we must dereference the
>>> - // back chain to find the caller frame before extracting it.
>>> - uhwptr *caller_frame = (uhwptr*)frame[0];
>>> - if (!IsValidFrame((uptr)caller_frame, stack_top, bottom) ||
>>> - !IsAligned((uptr)caller_frame, sizeof(uhwptr)))
>>> - break;
>>> + // For most ABIs the offset where the return address is saved is two
>>> + // register sizes. The exception is the SVR4 ABI, which uses an
>>> + // offset of only one register size.
>>> +#ifdef _CALL_SYSV
>>> + uhwptr pc1 = caller_frame[1];
>>> +#else
>>> uhwptr pc1 = caller_frame[2];
>>> +#endif
>>> #elif defined(__s390__)
>>> uhwptr pc1 = frame[14];
>>> #else
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list