libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libunwind-devel] [RFC][patch] Fix crash in _ULx86_64_tdep_trace whe


From: Lassi Tuura
Subject: Re: [Libunwind-devel] [RFC][patch] Fix crash in _ULx86_64_tdep_trace when sigaltstack is too far away
Date: Tue, 22 Nov 2011 14:12:08 -0600

Hi Paul, Arun,

The new patch looks good. I've tested on RHEL5-derived x86_64 system with
GCC 4.6.1 build, and things look good in a couple of test applications I
tried on.

There's one new compilation warning in release mode, because 'uc' is only
used in assert() in the new tdep_stash_frame(). Maybe protect the entire
signal frame 'else if' body in tdep_stash_frame() #if UNW_DEBUG?

../../../libunwind/src/x86_64/Gstash_frame.c: In function 
'_ULx86_64_stash_frame':
../../../libunwind/src/x86_64/Gstash_frame.c:84:22: warning: unused variable 
'uc' [-Wunused-variable]

Thanks Paul.

Regards,
Lassi

On Nov 14, 2011, at 19:02 , Paul Pluzhnikov wrote:

> On Fri, Nov 11, 2011 at 1:41 PM, Lassi Tuura <address@hidden> wrote:
> 
>> Yes, you are right, I noticed the same. But we probably shouldn't store
>> the difference to the original stack but to the ucontext_t which should
>> be in nearby offset, on the signal stack.
> 
> In fact, AFAICT for Linux ucontext_t is the very last thing copied onto
> the stack before invoking the signal handler. That is, when signal handler
> start running, the stack layout is:
> 
>  ... higher addresses ...
>         ucontext
>  CFA->
>         __restore_rt (== pretcode in rt_sigframe from
>                       linux-2.6/arch/x86/include/asm/sigframe.h)
>  SP ->
>        ... sighandler runs on this stack.
> 
>  ... lower addresses ...
> 
> This makes it very convenient to find ucontext from the CFA.
> 
> Attached patch re-tested on Linux/x86_64, no new failures.
> 
> Thanks,
> 
> P.S. test-setjmp is failing for me (before or after the patch).
> When I enable assertions (to confirm my new assertions are correct), I see:
> 
>  lt-test-setjmp: ../../src/dwarf/Gparser.c:754: apply_reg_state: \
>    Assertion `rs->reg[17].where == DWARF_WHERE_EXPR' failed.
> 
> which likely explains that failure.
> 
> -- 
> Paul Pluzhnikov
> <libunwind-crash-in-fasttrace-20111114.txt>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]