This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH][BZ #18508] S390: Fix "backtrace() returns infinitely deep stack frames with makecontext()".
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: "Carlos O'Donell" <carlos at redhat dot com>
- Cc: Stefan Liebler <stli at linux dot vnet dot ibm dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 8 Jul 2015 07:51:13 -0700
- Subject: Re: [PATCH][BZ #18508] S390: Fix "backtrace() returns infinitely deep stack frames with makecontext()".
- Authentication-results: sourceware.org; auth=none
- References: <ml71gu$et2$1 at ger dot gmane dot org> <557AA306 dot 4090208 at redhat dot com> <mleq97$5v2$1 at ger dot gmane dot org> <87eglhvsst dot fsf at igel dot home> <mlm3f3$bbu$1 at ger dot gmane dot org> <559651D0 dot 1030704 at redhat dot com> <CAMe9rOqs_DPaN=h_dnskMEyvSkG6PrVhr2vXJp7+_sejKenXBg at mail dot gmail dot com> <CAMe9rOr+tMWUN8ruaLoA9wT_bEcgJx4dfzjXSEVqSwRh-LK7ng at mail dot gmail dot com> <559C224F dot 2090600 at redhat dot com> <mnj3c8$npj$1 at ger dot gmane dot org> <CAMe9rOpy-GipOWBrKKjTJc+2owo830dtLA+0U4mL0XXK4Y4izQ at mail dot gmail dot com> <559D3801 dot 9050404 at redhat dot com>
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.