1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-06-28 12:11:45 +02:00
Commit graph

14 commits

Author SHA1 Message Date
Arun Sharma 1010880548 Address x86_64 crashes when using sigaltstack
The crashes were tracked down to f->rpb_cfa_offset being incorrect.

The problem is that {rsp,rbp}_cfa_offset only have 15 bits, but for
SIGRETURN frame they are filled with:

// src/x86_64/Gstash_frame.c

   f->cfa_reg_offset = d->cfa - c->sigcontext_addr;
   f->rbp_cfa_offset = DWARF_GET_LOC(d->loc[RBP]) - d->cfa;
   f->rsp_cfa_offset = DWARF_GET_LOC(d->loc[RSP]) - d->cfa;

The problem is that the delta here can be arbitrarily large when
sigaltstack is used, and can easily overflow the 15 and 30-bit fields.

When signal handler starts 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.

Signed-off-by: Paul Pluzhnikov <ppluzhnikov@google.com>
Reviwed-by: Lassi Tuura <lat@cern.ch>
2011-11-27 18:34:38 -08:00
Lassi Tuura ae5c1f2adf Performance optimisations for fast trace.
Insert static branch prediction predicates in useful places and avoid
unnecessary code in the hottest paths. Bypass unnecessary indirect
calls, in particular to access_mem(), when known to be safe.
2011-04-17 20:34:38 -07:00
Lassi Tuura 9e98f15e9a Fast back-trace for x86_64 for only collecting the call stack.
Adds new function to perform a pure stack walk without unwinding,
functionally similar to backtrace() but accelerated by an address
attribute cache the caller maintains across calls.
2011-03-24 22:33:17 -07:00
Arun Sharma aa3bb307a3 Fix merge errors 2010-05-03 07:47:41 -07:00
Arun Sharma 0176c4f723 Merge commit 'fdc534ccb05d1e6c0438345d292203343a811701' 2010-04-28 17:27:38 -07:00
Arun Sharma fdc534ccb0 Silence a compiler warning 2010-04-28 16:38:27 -07:00
Arun Sharma d3c4bc4295 Fix a compiler warning 2010-04-25 09:24:40 -07:00
Lassi Tuura 92cc7fd78a Remove obsolete code for 'old way' of handling x86-64 signal frames. 2010-04-24 19:21:52 -07:00
Lassi Tuura dac2d001af Identify signal frames by augmentation attribute. 2010-04-24 17:18:26 -07:00
Arun Sharma 1d9c5a356d Fix compiler warnings on x86_64 Linux 2010-04-14 12:01:37 -07:00
Arun Sharma caa6095aec Fix compile errors on Linux 2010-04-07 19:59:06 -07:00
Konstantin Belousov 979af4502f Move local_resume to os-specific file. 2010-04-05 23:00:27 +03:00
Konstantin Belousov 0dbeeeb08d Move uc_addr to os-specific file 2010-04-05 22:42:23 +03:00
Arun Sharma 8e53e62db9 Refactor os specific code for x86 (both 32 and 64 bit).
Move Linux specific code into ${arch}/Gos-linux.c
2010-04-04 16:46:13 -07:00
Renamed from src/x86_64/Gis_signal_frame.c (Browse further)