1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-22 07:37:38 +01:00
Commit graph

493 commits

Author SHA1 Message Date
Alex Arslan
2be1c2754a tests: Include wait-related headers for Ltest-mem-validate (#74)
Without these, I was getting errors from this test set claiming that
wait, WIFCONTINUED, et al. were undefined on FreeBSD 11.1.
2018-04-12 09:46:15 -07:00
Romain Geissler @ Amadeus
54c1afdd51 Fix crasher test for gcc >= 8 when using -O2 or -O3. (#67) 2018-03-06 08:06:44 -08:00
Michael Munday
441adc46ff Add port to Linux on IBM Z (s390x)
This adds a port to Linux on the IBM Z platform (a.k.a s390x). It only
supports the 64-bit ABI. Most functionality is working and all the tests
pass with the exception of the coredump tests*.

Unwinding is only supported if DWARF unwind information is present.
libunwind can't currently make use of the backchain (if present).

The getcontext/setcontext functions only preserve/restore a subset of
registers. Currently this only consists of callee-saved registers and
some parameter registers.

Vector registers and access registers are not saved (and aren't callee-
saved) by getcontext and cannot currently be modified. They will however
be restored unmodified after resuming a context from a signal handler.

There is no special libunwind support for setjmp, the functionality is
emulated using glibc (I think all the ports do this for modern Linux
kernels).

* Unwinding on s390x requires floating point register access which the
coredump library doesn't currently support.
2018-01-09 07:37:55 -08:00
Dave Watson
e287b69068 Remove unw_handle_signal_frame from public API. 2017-12-28 09:07:08 -08:00
Yichao Yu
4238fa55c8 Fix intermittent test failure in test-resume-sig (#51)
(At least on x86(_32),) `unw_resume` will call `setcontext` which will modify the signal masks
based on the value in the context. Since the signal mask is not being initialized by
`unw_getcontext`, this cause the signal mask to be set to a random (uninitialized) value after
`unw_resume` which cause the test to fail since it relies on the signal mask for SIGUSR2 being
cleared.

The proper fix is likely to either make `unw_resume` not touch the signal mask if the context
wasn't initialized with a signal ucontext, or to make `unw_getcontext` record the signal mask too.
It's unclear to me which approach should be taken...

In the mean time, the intermittent failure can be fixed simply by zero initialing the context first
which would clear all the signal masks.
When siginfo is available, a more reliable way is to use the `ucontext` passed in
to the signal handler directly and rely on `sigreturn` to reset it.
Unfortunately, this is currently not implemented on all archs either.
2017-10-31 08:47:34 -07:00
Yichao Yu
26c99a3a3e Fix init-local-signal test (#50)
* Add `SA_SIGINFO` flag

  This is needed to guarantee the availability of the `ucontext` argument

* Mark the `NULL` pointer load as `volatile`

  Further prevent any compiler optimization on the load.
2017-10-31 08:41:51 -07:00
Bert Wesarg
60ddc67196 check: Fix run-coredump-unwind-mdi when in a out-of-tree build. 2017-09-21 08:37:08 -07:00
Konstantin Belousov
fd02fd59e7 arm: FreeBSD/ARMv6 port
Sponsored by:	The FreeBSD Foundation
2017-08-24 09:08:58 -07:00
Dave Watson
60663c8f69 multilib: XFAIL some tests
Ptrace interface doesn't understand multilib registers, so tests all fail.
2017-08-24 08:51:39 -07:00
Johannes Ziegenbalg
836c91c43d x86_64: fix mincore_validate and msync_validate
The calls to mincore() or msync() are not checking for actual accessibility
this could lead to SIGSEGV if the address from a mapped page with the
PROT_NONE property occurs on the stack.
Hence an attempt to write one byte from the checked address to a pipe will
fail if the address is not readable.
2017-08-24 08:50:07 -07:00
Dave Watson
bd3fb89e11 Change unw_init_local_signal to unw_init_local2(..., UNW_INIT_SIGNAL_FRAME)
Add unw_init_local2 with a flag for better extensibility in the future
2017-08-16 13:11:24 -07:00
Dave Watson
644cce3d72 half finished unw_local_init2 2017-08-16 11:27:43 -07:00
Bert Wesarg
57257060c9 Bring back support for UNW_CACHE_PER_THREAD.
Needs to be build with --enable-per-thread-cache. Default caching policy
is also UNW_CACHE_PER_THREAD than.
2017-08-15 10:34:28 -07:00
Paul Pluzhnikov
cc0c170f53 tests: Fix heap overflow in coredump-unwind test
We've tried to run slightly modified test-coredump-unwind.c built with
tcmalloc, and it promptly crashed.  Attached patch fixes the heap buffer
overflow bug which caused it.
2017-08-07 09:07:20 -07:00
Doug Moore
5c0e619f84 test: Add a test like test-mem, but using reg_states_iterate to find the state and
apply_reg_state to use it to complete the unw_step.
2017-06-07 08:36:23 -07:00
Doug Moore
27f5f9fa0b Leave ret_addr_column out of the data that gets copied when pushing/popping
data on/off the register state stack.
2017-05-20 14:36:25 -05:00
Doug Moore
bfb246a499 Add new names to check-namespace. 2017-05-12 22:24:00 -05:00
Dave Watson
982e934951 travis: run unittests for x86_64
some tests are failing with clang currently.
2017-04-04 12:41:03 -07:00
Dave Watson
ab868ece1a tests: unw_init_local_signal test 2017-04-03 14:44:43 -07:00
Doug Moore
14c48b3d51 unw_init_local_signal
init_local, but *not* setting use_prev_instr.
This is necessary to correctly unwind using ucontext argument to signal handlers.
2017-04-03 14:44:40 -07:00
Konstantin Belousov
9e97c9b17a dwarf: Make binary path calculation os-specific.
/proc/self/exe only works on Linux, move path computation to os-* files
2017-01-19 10:07:13 -08:00
Konstantin Belousov
09a598a3da Make the code compile on FreeBSD. 2017-01-18 09:18:29 -08:00
Dave Watson
a51cf49031 dwarf: Configurable cache size
Add interface for configurable dwarf cache size

* Use item size and round up to nearest power of 2.
* Initial cache still exists in BSS.  Without this, it means we would fail
  backtrace when out of memory.  The test-mem test fails without this
2017-01-13 08:36:33 -08:00
Dave Watson
29483327be x86_64: Use sigprocmask from signal frames
Currently setcontext for x86_64 restores the signal mask, even
though it is never saved anywhere.  This means the signal mask
is often garbage after an unw_resume.

(changed in commit f8a15e9679)

It looks like this was a fix for the Gtest-resume-sig function -
testing if signal masks are restored across signal frames.  The
root issue looks like that x86_64 only uses sigreturn for the exact
signal frame, and not for any decedant frames as well (as i64 does).

Instead, modify Gresume to use sigreturn if *any* frame on the stack
is a signal frame, so that we correct fixup the signal mask and any
sigaltstacks.  The sigreturn os-specific functions are changed slightly
to copy in the saved ucontext structure if we are jumping farther
up the stack.

This should fix sigprocmask reported issues such as
https://github.com/dropbox/pyston/blob/master/libunwind_patches/0002-pyston-stop-x86_64-setcontext-restoring-uninitialize.patch

Tests pass on freebsd, linux
2017-01-13 08:28:22 -08:00
Petr Malat
b707e13ca0 tests: Use strtoul in test-coredump-unwind.c
Read the address using strtoul(). If strtol() is used and the number is
bigger than LONG_MAX, LONG_MAX is returned instead, which leads to a failure
if the mapping address is 0x80000000 or larger on 32-bit platforms (and
similarly for 64-bit platforms).
2017-01-13 08:28:21 -08:00
Dave Watson
32e3e93b01 tests: Walk default test arguments to ensure child process has visibility 2017-01-13 08:28:21 -08:00
Tony Kelman
5dcb7cd3cb Fix compilation of tests on alpine linux (musl libc)
If we don't link to libexecinfo, as detected by the
AC_SEARCH_LIBS(backtrace, execinfo) configure probe, we get

```
test-coredump-unwind.o: In function `handle_sigsegv':
/home/libunwind/tests/test-coredump-unwind.c:246: undefined reference to
`backtrace_symbols_fd'
collect2: error: ld returned 1 exit status
Makefile:1187: recipe for target 'test-coredump-unwind' failed
```

and

```
Gtest-init.o: In function `do_backtrace()':
Gtest-init.cxx:(.text+0x2f): undefined reference to `_Ux86_64_getcontext'
Gtest-init.cxx:(.text+0x48): undefined reference to `_Ux86_64_init_local'
Gtest-init.cxx:(.text+0x63): undefined reference to `_Ux86_64_get_reg'
Gtest-init.cxx:(.text+0x96): undefined reference to `_Ux86_64_get_proc_name'
Gtest-init.cxx:(.text+0x171): undefined reference to `_Ux86_64_step'
collect2: error: ld returned 1 exit status
Makefile:1063: recipe for target 'Gtest-init' failed
```

There are 2 XFAIL and 6 FAIL tests, but it's a start
2017-01-13 08:28:21 -08:00
Mike Frysinger
67d4137ba7 tests: simplify make variables a bit
Add dummy assign statements at the top so we don't have to trace all
the different if paths to see where the value is initially assigned.
Now all code paths just append it.
2017-01-13 08:27:40 -08:00
Dave Watson
7d30e028a2 Don't build dyn tests on non-ia64
It looks like the dynamic frame support isn't fully baked on
non-ia64, leading to lots of mailing list comments about broken
tests (even though they're marked as supposed to fail, it's still
confusing).
2017-01-06 15:43:35 -08:00
Andreas Schwab
544cdb3b43 tests/Gtest-trace.c: show differing addresses 2015-03-22 00:05:14 -07:00
Gregory Fong
0bed10aa21 Mark run-ptrace-mapper and run-ptrace-misc as XFAIL on ARM
This is similar to commit c90a2e02b3
"Mark run-ptrace-mapper and run-ptrace-misc as XFAIL on MIPS".
Starting with 2.6.39, ARM Linux returns -EIO for PTRACE_SINGLESTEP, so
we need to mark this as XFAIL for ARM too.

The Linux commit that changed this is

   commit 425fc47adb5bb69f76285be77a09a3341a30799e
   Author: Will Deacon <will.deacon@arm.com>
   Date:   Mon Feb 14 14:31:09 2011 +0100

       ARM: 6668/1: ptrace: remove single-step emulation code

see: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=425fc47adb5bb69f76285be77a09a3341a30799e

Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com>
2015-02-21 13:00:34 -08:00
Simon Atanasyan
c90a2e02b3 Mark run-ptrace-mapper and run-ptrace-misc as XFAIL on MIPS
Though PTRACE_SINGLESTEP is defined on MIPS Linux, the kernel does
not support that kind of request. The ptrace call failed and sets
errno to EIO and paused process is not resumed. In case of
run-ptrace-mapper and run-ptrace-misc this leads to hanged execution
because next call to wait4 never returns.

This change adds run-ptrace-mapper and run-ptrace-misc to the list
of 'expected failed' tests on MIPS targets.

Signed-off-by: Simon Atanasyan <simon@atanasyan.com>
2014-10-24 22:31:05 -07:00
Zhi-Gang Liu
790be1e40d Add TileGx platform support to libunwind.
"make check" passed.
======================================================
All 34 tests behaved as expected (2 expected failures)
======================================================
Zhi-Gang Liu @ Tilera
2014-09-08 16:21:53 -04:00
Ulrich Weigand
4c62c4a955 Fix test case link failure on PowerPC systems with Altivec
On systems where the system compiler supports Altivec by default,
the libunwind Makefile will attempt to build an extra test case
ppc64-test-altivec.  Unfortunately, the link step will fail since
the Makefile does not actually link against the libunwind library.

Fixed by adding the appropriate LDADD macro.

Signed-off-by: Ulrich Weigand <uweigand@de.ibm.com>
2013-12-27 07:08:50 -08:00
Matt Fischer
61fad17d29 Build crasher test only when coredump support is enabled
The crasher test is used as part of the coredump test suite,
but is being built regardless of whether that support has been
configured or not.  This patch changes the build so that it is
only built when coredump support is enabled.
2013-04-19 17:08:09 -05:00
Matt Fischer
563b0ff314 Added --enable-setjmp
Currently, libunwind-setjmp is built whenever local unwinding is
built.  This patch adds an explicit flag to control it instead.
The default if not specified is to follow the old behavior.
2013-04-19 17:08:03 -05:00
Matt Fischer
abb0957198 Added --enable-ptrace
This change adds a manual override to control building of the ptrace
library, similar to the existing --enable-coredump option.  The
default is set based on the existence of sys/ptrace.h, allowing it
to be automatically disabled for platforms that do not have ptrace.
2013-04-19 16:46:24 -05:00
Arun Sharma
ae3dd9417a Add known test failures to XFAIL_TESTS 2012-10-27 19:37:45 -07:00
Tommi Rantala
6456da2dc1 Assign `func' just once in Ltest-nocalloc glibc case 2012-09-28 14:51:22 +03:00
Tommi Rantala
65f936402d Add arguments to malloc and calloc prototypes in Ltest-nocalloc 2012-09-28 14:51:22 +03:00
Tommi Rantala
249ff2f840 Remove unused variable in Ltest-nocalloc 2012-09-28 14:51:22 +03:00
Tommi Rantala
e9f161a677 Replace empty argument lists with `void' in tests 2012-09-28 14:51:22 +03:00
Tommi Rantala
890e23eb9d Prefer NULL over zero 2012-09-28 14:51:21 +03:00
Tommi Rantala
2fbbf276b3 Use shared `ARRAY_SIZE' in IA64 tests 2012-09-28 14:51:21 +03:00
Tommi Rantala
6b55e0ab51 Use `UNUSED' in tests 2012-09-28 14:51:21 +03:00
Tommi Rantala
5e7e890a0b Plug in `ALIAS' attribute 2012-09-28 14:51:21 +03:00
Tommi Rantala
e3e49dc28a Define and use `NOINLINE' 2012-09-28 14:51:19 +03:00
Tommi Rantala
ded94b98ff Stop including `memory.h'
I am unable to find any reference to `memory.h' in the C99 and C11
committee drafts, so include `string.h' instead when we need memset() or
similar.
2012-09-28 14:50:03 +03:00
Tommi Rantala
58354c94d7 Nuke HAVE_BACKTRACE
We do not really need to care if the system provides `backtrace()',
since we will want to test the one provided in libunwind, not the one
that is provided by the system. The `backtrace()' calls should already
be aliased to `unw_backtrace()', but if that is not working for whatever
reason, we can call `unw_backtrace()' explicitly.
2012-09-28 14:50:03 +03:00
Tommi Rantala
848ad53a47 Call snprintf() from signal handler only if required in test-async-sig
snprintf() is not guaranteed to be safely callable from a signal
handler, so avoid calling it in the default non-verbose case.
2012-09-28 14:50:03 +03:00