[PATCH][BZ #18508] S390: Fix "backtrace() returns infinitely deep stack frames with makecontext()".
H.J. Lu
hjl.tools@gmail.com
Wed Jul 8 14:51:00 GMT 2015
On Wed, Jul 8, 2015 at 7:47 AM, Carlos O'Donell <carlos@redhat.com> wrote:
> On 07/08/2015 10:44 AM, H.J. Lu wrote:
>>> For a quick test, I extracted the exitcode-block to a new function with
>>> ENTRY/END-macros and undefined cfi_start/end_proc, like it is done in
>>> s390-makecontext_ret - see attached patch. Afterwards _Unwind_backtrace does
>>> not segfault anymore.
>>>
>>> Please test/comment.
>>
>> It works.
>
> But we don't really know why...
>
The hand-written frame info in i386/makecontext.S is wrong as
shown in
https://sourceware.org/bugzilla/show_bug.cgi?id=18635
Program received signal SIGSEGV, Segmentation fault.
uw_frame_state_for (context=context@entry=0x8050120 <st1+15968>,
fs=fs@entry=0x80501a0 <st1+16096>)
at /export/gnu/import/git/sources/gcc/libgcc/unwind-dw2.c:1249
1249 return MD_FALLBACK_FRAME_STATE_FOR (context, fs);
(gdb) bt
#0 uw_frame_state_for (context=context@entry=0x8050120 <st1+15968>,
fs=fs@entry=0x80501a0 <st1+16096>)
at /export/gnu/import/git/sources/gcc/libgcc/unwind-dw2.c:1249
#1 0xf7e102a8 in _Unwind_Backtrace (trace=0x8049420 <backtrace_helper>,
trace_argument=0x8050298 <st1+16344>)
at /export/gnu/import/git/sources/gcc/libgcc/unwind.inc:290
#2 0x080494a6 in cf (i=-78) at tst-makecontext.c:72
#3 0xf7e55d1b in makecontext ()
at ../sysdeps/unix/sysv/linux/i386/makecontext.S:87
#4 0xffffffb2 in ?? () <<<<<<<< Bogus return address
#5 0x00000000 in ?? ()
(gdb)
--
H.J.
More information about the Libc-alpha
mailing list