summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* bump version to 1.3.1v1.3.1v1.3-stableDave Watson2019-01-091-1/+1
|
* dwarf: clang doesn't respect the static alias (#102)Dave Watson2019-01-091-0/+5
| | | | | Clang doesn't respect the static alias, resulting in global instead of local symbols, and name collisions. Work around for clang by always going through the PLT (at a small perf hit)
* bump release to 1.3.0v1.3.0Dave Watson2019-01-071-2/+2
|
* dwarf: make dwarf_find_debug_frame publicDave Watson2018-04-031-1/+1
| | | | | | | linux kernel's perf tool depends on this being public. reported-by: Luke Diamand <luke@diamand.org> blame: b56e4cb88989f82988a6a70acb32e187e88b5cac ("ALIAS dwarf symbols")
* Use syscall directly in write_validate to avoid ASAN errorsDave Watson2018-01-171-1/+3
| | | | | | | | | | | ASAN will complain about this write call with the following error: ERROR: AddressSanitizer: stack-buffer-underflow on address HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext This is similar to what google's abseil does to work around the issue. Reported-by: qiwang@fb.com
* ALIAS unwind_get_accessorsDave Watson2018-01-0326-32/+40
|
* ALIAS dwarf symbolsDave Watson2018-01-033-6/+14
|
* Remove unw_handle_signal_frame from public API.Dave Watson2018-01-0320-31/+38
|
* Remove PROTECTED visibilityDave Watson2018-01-03185-235/+232
| | | | This only works on bfd ld, not lld or gold.
* dwarf: Fix size of state to avoid corrupting rs_stackMichael Munday2017-11-282-3/+3
| | | | | | | | | | DW_CFA_remember_state used memcpy to overwrite state with the value of rs_current. Unfortunately rs_current was slightly larger than state, possibly resulting in rs_stack->next being overwritten. Fix this by making the type of state match the type of rs_current and using an assigment to perform the copy rather than memcpy. This should ensure that the types match in future.
* Bump version to 1.3-rc1v1.3-rc1Dave Watson2017-11-223-6/+24
|
* Default to --enable-debug-frame also on aarch64Adrian Bunk2017-11-211-0/+1
| | | | This is required for perf to show call graphs.
* elfxx: store elf image pointer and size after mapping imageHans-Christian Noren Egtvedt2017-11-091-2/+5
| | | | | | | | | | | If loading debug link is not successful, the initial NULL pointer for ei->image will eventually be restored, causing segfault during a later call to valid_object. Move populating the prev_image and prev_size to after elf_map_image() to fix this. Signed-off-by: Hans-Christian Noren Egtvedt <hegtvedt@cisco.com>
* dwarf: Fix incorrect cfi execution (#54)Yichao Yu2017-11-011-42/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During unwinding/resuming execution of a normal call frame, it is not only necessary to use the previous instruction to lookup the unwind info but also when executing the cfi program. Although the call usually don't modify any unwinding state, it can happen for noreturn call or when the callee cleanup the stack. In these cases, the next instruction after the call may have a cfi adjusting the state (e.g. stack pointer) and such instruction should be executed. 3d9a694de85f2ba10368b4fbc2aff1c6b8b76f58 worked around this issue by treating `cfi_restore_state` specially. It works when the compiler use that instruction to restore the state, i.e. ``` .cfi_remember_state je .L0 push ... .cfi_def_cfi_offset <new_value> call noreturn .L0 .cfi_restore_state ``` which is what GCC ususally does. However, it is not necessarily the case and clang/LLVM doesn't do that. Instead LLVM emits the following unwind info which is also perfectly valid but is not handled by the special case. ``` je .L0 push ... .cfi_def_cfi_offset <new_value> call noreturn .L0 .cfi_def_cfi_offset <old_value> ``` e9e8ed73e34a2d65c7ec71c296156637763ffd5c also worked around this issue for another special case. This patch fix this issue for all cfi types by adjusting the `end_ip` based on the type of the current frame instead, similar to what's done in `fetch_proc_info`. Since this requires using the same `use_prev_instr` value after `fetch_proc_info` returns, the patch also remove the `need_unwind_info` parameter to the function and move the code updating `use_prev_instr` after all use of the old value are done.
* dwarf: Allow DWARF version both 3 and 4 (#56)Yichao Yu2017-10-312-4/+6
|
* arm: Handle non-signal frame unwind info lookup in ARM exidx unwinder (#55)Yichao Yu2017-10-311-2/+5
|
* Fix intermittent test failure in test-resume-sig (#51)Yichao Yu2017-10-311-0/+8
| | | | | | | | | | | | | | | | | (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.
* Ignore tests/Ltest-mem-validate (#52)Yichao Yu2017-10-311-0/+1
|
* Fix init-local-signal test (#50)Yichao Yu2017-10-312-2/+3
| | | | | | | | | * 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.
* Use `ucontext_t` instead of `struct ucontext` (#49)Yichao Yu2017-10-311-1/+1
| | | | Ref https://github.com/libunwind/libunwind/pull/40. I didn't caught it last time since I don't have a 32bits buildbot.
* Fix local unwind compilation on ARM (#48)Yichao Yu2017-10-231-0/+1
| | | This was broken by fd02fd59e7462f49311d4e0d6547aacf48fe072b.
* dwarf/Gparser: fix crash during unwinding (#46)Konstantin Baladurin2017-10-171-6/+11
| | | | | | | | | | | | | | | | | | We should update locations of the registers after all of them will be restored. Otherwise some locations will be incorrect. For example if function stores ebp, edi, esi and ebx registers on stack in its prologue, compiler can generate following unwind info: DW_CFA_expression: r5 (ebp) (DW_OP_breg5 (ebp): 0) DW_CFA_expression: r7 (edi) (DW_OP_breg5 (ebp): -4) DW_CFA_expression: r6 (esi) (DW_OP_breg5 (ebp): -8) DW_CFA_expression: r3 (ebx) (DW_OP_breg5 (ebp): -12) In this case locations of the ebx and ebp will be calculated using current ebp but locations of the esi and edi will be calculated using previous (restored) one. Due to it their locations will be incorrect and it could lead to crash if we will try to get esi or edi value. This patch fixes this problem.
* x86: Fix build (#45)Konstantin Baladurin2017-10-171-0/+2
| | | We should include <sys/syscall.h> for SYS_rt_sigreturn in x86/Gos-linux.c
* check: Fix run-coredump-unwind-mdi when in a out-of-tree build.Bert Wesarg2017-09-211-1/+1
|
* arm: FreeBSD/ARMv6 portKonstantin Belousov2017-08-2421-201/+479
| | | | Sponsored by: The FreeBSD Foundation
* multilib: XFAIL some testsDave Watson2017-08-242-0/+9
| | | | Ptrace interface doesn't understand multilib registers, so tests all fail.
* x86: Add sigreturn asm stubDave Watson2017-08-242-2/+26
| | | | | | | glibc no longer defines sigreturn, but we want to use it when unwinding through signal stacks to resture the signal mask, without forcing all uses of getcontext/setcontext to save and restore the signal mask
* dwarf: Fix incorrect application of restore_stateDave Watson2017-08-241-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | Repro for a multilib binary on host x86_64: CFLAGS="-m32" LDFLAGS="-m32" ./configure --enable-debug -- host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --libdur=/usr/lib32 --prefix=/usr --disable-documentation make check Gtest-init function fails trying to step through libc_start_main. The CFA function is: DW_CFA_def_cfa_offset: 112 DW_CFA_advance_loc: 5 to ...643 DW_CFA_restore state Where the return address is 643. Generally, it appears we apply all ip <= end_ip, which is incorrect in some circumstances. libgcc only applies ip < end_ip + is_signal_frame, but that seems to break async signal handling tests in libunwind for unknown reasons. This is somewhat simlar to the fix in e9e8ed73e for GNU_args_size, where the same ip check was added.
* x86_64: fix mincore_validate and msync_validateJohannes Ziegenbalg2017-08-243-2/+197
| | | | | | | | 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.
* x86_64: Use `ucontext_t` instead of `struct ucontext`Yichao Yu2017-08-221-1/+1
| | | | | Ref https://sourceware.org/git/?p=glibc.git;a=commit;h=251287734e89a52da3db682a8241eb6bccc050c9 And this is what other part of the code uses.
* arm: argument type for unw_init_local2Guillaume Blanc2017-08-221-1/+1
| | | | | | | | | | | I tried to build libunwind for arm target and got a build error. Type for "uc" argument is inconsistent between unw_init_local2 and unw_init_local_common. From 54fb6483e47916836c314a38715e8e0ce8c3da44 Mon Sep 17 00:00:00 2001 From: Guillaume Blanc <guillaume.blanc@parrot.com> Date: Tue, 22 Aug 2017 16:46:20 +0200 Subject: [PATCH] arm: Fix unw_init_local2 argument type
* arm64: Support for restore of ARM64 Neon callee-saved registers during unwindLeonid Chistov2017-08-184-7/+27
|
* aarch64: PLT entry recognition & fixesJonathan Byrd2017-08-183-9/+67
| | | | | | | | | Attached is a corrected version of my previous patch for aarch64 PLT entry recognition. The comparison in the is_plt_entry function should have been: ret = (((w0 & 0xff0000009f000000) == 0xf900000090000000) && ((w1 & 0xffffffffff000000) == 0xd61f022091000000));
* dwarf: Fix uninitialized variable c->dwarf.eh_valid_mask.Felipe Cerqueira2017-08-171-0/+1
| | | | | | | We were testing libunwind-coredump and got some warnings about uninitialized eh_valid_mask. The code was working fine because the default value of the mask was 0, but it could potentially take a wrong branch if there's garbage in memory.
* doc: Add generated doc files apply_reg_state and reg_states_iterateDave Watson2017-08-163-0/+228
|
* Change unw_init_local_signal to unw_init_local2(..., UNW_INIT_SIGNAL_FRAME)Dave Watson2017-08-1613-29/+119
| | | | Add unw_init_local2 with a flag for better extensibility in the future
* half finished unw_local_init2Dave Watson2017-08-163-6/+23
|
* configure: Fix dangling link when --disable-static is specifiedDave Watson2017-08-161-1/+3
| | | | | | | | | | If I configure with ./configure --prefix= --enable-shared --disable-static, a broken symlink lib/libunwind-generic.a is installed that points to a missing architecture-specific version of that library (e.g. lib/libunwind-x86_64.a). I suppose that not installing that library is the intended behavior with these configuration settings, so the symlink should not be there in the first place. Reported-by: MarcoKoch
* elf: Don't use .gnu_debuglink if it doesn't existDave Watson2017-08-161-1/+15
| | | | | | Some binaries contain a gnu_debuglink, even though the actual file it points to doesn't exist. In those cases, continue to use the existing binary instead of trying to load the debuglink file.
* Bring back support for UNW_CACHE_PER_THREAD.Bert Wesarg2017-08-1521-31/+50
| | | | | Needs to be build with --enable-per-thread-cache. Default caching policy is also UNW_CACHE_PER_THREAD than.
* Support dynamic unwind info on ARMYichao Yu2017-08-152-2/+9
|
* arm: getcontext switches back to thumb modeBernhard Rosenkraenzer2017-08-151-1/+2
| | | | | | | | | | | The ARM Thumb implementation of unw_tdep_getcontext switches to ARM mode (".code 32"), but doesn't switch back to Thumb mode. In gcc, this is fine (it automatically switches back to Thumb mode at the end of an asm block), but in clang, this causes bad assembly output (thumb instructions generated by C/C++ code later on are interpreted as ARM mode assembly, which can't work). Switching back to Thumb mode manually fixes clang, and is a no-op for gcc.
* arm: Fix is_signal_frame bug for Thumb/Thumb2 modeMyungJoo Ham2017-08-151-3/+12
| | | | | | | | | | | | | | If Thumb is used, the least bit of the retrived IP value is set, which makes the retrived opcode based on the IP invalid. This patch fixes such behavior and adds a missed condition found with glibc built for recent ARMv7l with Thumb2. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> CC: Yvan Roux CC: Arun Sharma CC: David Mosberger
* Fix ARM jmpbuf header include bug.credmon2017-08-151-1/+1
| | | | tdep/jmpbuf.h was not including arm-tdep/jmpbuf.h.
* arm: Return code correction for unw_step()MyungJoo Ham2017-08-151-1/+1
| | | | | | | | | | Let's not drop error code or zero-return unconditionally. This has been incurring occasional indefinite loop in dotnet core when it already had hit the bottom by continously returning 1 from unw_step(); Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
* arm: Expand memory validationMyungJoo Ham2017-08-151-5/+5
| | | | | | Prevent SIGSEGV for write as well as read. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
* dwarf: Fix cache size calculationDave Watson2017-08-151-5/+5
| | | | | | | | | | The and mask trick only works for power-of-two sized things, but must be computed using the full size. This incorrectly resulted in a very small cache size. Found using bisect and 'make perf' in tests directory. blame rev: 0b51f5892df0691fc7b3b947647222ab8e57dd54
* core: Fix memory leak in libunwind-coredump.Felipe Cerqueira2017-08-141-0/+2
| | | | _UCD_destroy() was not freeing all variables from UCD_info.
* aarch64: Use PTRACE_GETREGSET if availableStephen Chen2017-08-072-2/+45
| | | | | | | | | In remote ptrace mode, we currently use PTRACE_PEEKUSER to read the registers. PTRACE_PEEKUSER only works on x86 or arm 32 bit compatibility mode on linux. On aarch64 system, it always return -EIO. https://github.com/torvalds/linux/blob/master/kernel/ptrace.c#L885-L1102 PTRACE_GETREGSET is the newer and more supported way of reading registers. Use that if it's available.
* tests: Fix heap overflow in coredump-unwind testPaul Pluzhnikov2017-08-071-1/+1
| | | | | | 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.