summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* readelf: convert up to a target long in buf_read_ulong.Mark Wielaard2014-04-146-3/+78
| | | | | | | Add a i686 corefile test. Reported-by: Markus Engel <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* backends: Add aarch64 native and core unwind support.Mark Wielaard2014-04-1410-2/+137
| | | | | | | | Add aarch64 backend functions frame_nregs and set_initial_registers_tid. Mark pc_register in aarch64 prstatus_regs as pc_register. Add backtrace-core-aarch64 testcase. Signed-off-by: Mark Wielaard <[email protected]>
* CVE-2014-0172 Check for overflow before calling malloc to uncompress data.Mark Wielaard2014-04-092-1/+12
| | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1085663 Reported-by: Florian Weimer <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* backends: add ARM compatible mode to AARCH64Jean Pihet2014-03-302-2/+37
| | | | | | | | | Add the initial register setup for AARCH64 running ARM code (so called compat mode). This makes 'eu-stack -p' happy on ARM binaries while running on a AARCH64 kernel. Signed-off-by: Jean Pihet <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* backends: AARCH64_ABS32 and AARCH64_ABS64 are also valid in ET_REL.Mark Wielaard2014-03-192-3/+8
| | | | | | | This is tested now in a native aarch64 build by tests/run-elflint-self.sh since we added some .o files to the self tests. Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: elf_from_remote_memory only trust shdrs of last file-only segment.Mark Wielaard2014-03-172-5/+19
| | | | | | | | | If the last PT_LOAD segment that contains the whole shdrs also extends the segment in memory beyond the end of file the program might be reusing the memory space that we expect the shdrs to be in. Don't trust the shdrs are valid in that case. Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: test dwflsyms on ET_EXEC with minisymtabJosh Stone2014-03-115-1/+133
| | | | | | | | | | | | | | | | | | | | This adds testfilebaxmin, an ET_EXEC binary with .gnu_debugdata that doesn't match the load address of the main file. A previous bug made this trigger a kernel heuristic that forces the module to act like ET_DYN, which makes things like dwfl_module_relocate_address report relative addresses rather than proper absolute addresses. For example, before the fix dwflsyms would print: deregister_tm_clones (0) 0x400430, rel: 0x430 (.text) Now it properly prints: deregister_tm_clones (0) 0x400430, rel: 0x400430 (.text) These new test additions confirm that it's fixed. Signed-off-by: Josh Stone <[email protected]>
* libdwfl: dwfl_module_getdwarf.c (open_elf) only (re)set mod->e_type once.Josh Stone2014-03-112-6/+24
| | | | | | | | | As noted in https://sourceware.org/bugzilla/show_bug.cgi?id=16676#c2 for systemtap, the heuristic used by open_elf to set the kernel Dwfl_Module type to ET_DYN, even if the underlying ELF file e_type was set to ET_EXEC, could trigger erroneously for non-kernel/non-main (debug or aux) files. Make sure we only set the e_type of the module once when processing the main file (when the phdrs can be trusted).
* libdwfl: dwfl_linux_proc_find_elf use elf_from_remote_memory for (deleted).Mark Wielaard2014-03-105-48/+143
| | | | | | | | If a module has a "(deleted)" main ELF file, then try to read it from remote memory if the Dwfl has process state attached by reusing the ptrace mechanism from linux-pid-attach. Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: elf_from_remote_memory should use pagesize, not p_align.Mark Wielaard2014-03-103-19/+50
| | | | | | | | | | elf_from_remote_memory would use the actual p_align of the PT_LOAD segments to calculate the loadbase, end and start of a segment. But the dynamic loader aligns the segments using the pagesize and only sanity checks the p_align values. So we should do the same to get accurate segment addresses. Also fixes a small memory leak in case the ELF image appears to be bad. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Print DW_FORM_sdata values as signed numbers.Mark Wielaard2014-03-102-7/+32
| | | | | | Printing DW_FORM_sdata numbers as unsigned values is misleading. Signed-off-by: Mark Wielaard <[email protected]>
* Fix abort() on missing section headers.Jan Kratochvil2014-03-042-3/+10
| | | | | | | | | | | libdw/ 2014-03-03 Jan Kratochvil <[email protected]> Fix abort() on missing section headers. * dwarf_begin_elf.c (check_section): Replace abort call by goto err. New label err to return NULL. Signed-off-by: Jan Kratochvil <[email protected]>
* libdwfl: linux-proc-maps.c (proc_maps_report): Don't assert on bad input.Mark Wielaard2014-03-032-1/+6
| | | | | | | | | | If ino == last_ino && dmajor == last_dmajor && dminor == last_dminor then we expect the file names to be the same as well. Which is reasonable if the input came from the /proc file system. But there could be bad user input if the file was supplied through dwfl_linux_proc_maps_report. Instead of asserting on the bad input, just signal a bad_report. Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: elf-from-memory.c (elf_from_remote_memory): Check against p64 p_type.Mark Wielaard2014-02-262-1/+6
| | | | | | | There was a type in the case of parsing ELFCLASS64 phdrs. Check against p64 p_type, not the p32 p_type which at a different location in the union. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: More sanity checks before trying to display interpreter string.Mark Wielaard2014-02-242-2/+22
| | | | | | | Check there is a SHT_PROGBITS section at the offset given by p_offsets for a PT_INTERP segment before trying to display the interpreter string. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Robustify print_phdr program interpreter printing.Mark Wielaard2014-02-072-1/+9
| | | | | | | | Check phdr->p_filesz and make sure interpreter string is zero terminated before calling printf. Reported-by: Florian Weimer <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Read DW_AT_decl_file/line/column as unsignedJosh Stone2014-02-053-6/+17
| | | | | | | | | | | | Section 2.14 of the DWARF v3 & v4 standards specifies that all three declaration coordinates are unsigned integer constants. DWARF v2 did not specify signedness. Now dwarf_decl_* use dwarf_formudata to read these values. Also, an assertion on the range of line/column is now a handled error, setting DWARF_E_INVALID_DWARF for values greater than INT_MAX. Signed-off-by: Josh Stone <[email protected]>
* backends: Make aarch64_regs.c checkable by -WprintfPetr Machata2014-01-302-22/+21
|
* backends: Add arm frame_nregs and set_initial_registers_tid.Mark Wielaard2014-01-306-2/+87
| | | | | | | | | | | | | This allows CFI unwinding for ARM. It relies on having .debug_frame around which is always the case in our testsuite. All native backtrace tests PASS on arm if debuginfo (for glibc) is installed on the system. Otherwise the tests SKIP. For non-debug unwinding ARM uses EXIDX tables, not .eh_frames, which would have to be translated to CFI to do unwinding without .debug_frame available. Signed-off-by: Mark Wielaard <[email protected]>
* backends: arm_cfi SP (r13) is restored from CFA by default.Mark Wielaard2014-01-304-1/+13
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* backends: Update arm_reloc.def.Mark Wielaard2014-01-302-2/+83
| | | | | | | | | The elflint self test now also checks ET_REL files. Update the list of relocation types to include all known relocations from elf.h. R_ARM_SWI24 was obsolete and is now named R_ARM_TLS_DESC. The only other relocation used in the dynamic linker is R_ARM_IRELATIVE. Signed-off-by: Mark Wielaard <[email protected]>
* Use -Wformat=2 by default for all files.Mark Wielaard2014-01-3012-92/+145
| | | | | | | | This just makes sure that all format strings are given as literals to printf like functions so the compiler can see and check them. Remove all no_Wformat, add -Wformat=2 unconditionally to AM_CFLAGS. Signed-off-by: Mark Wielaard <[email protected]>
* stack: Add -i, --inlines. Show inlined call frames using DWARF debuginfo.Mark Wielaard2014-01-277-79/+271
| | | | | | | | | | Using dwarf_getscopes_die we can get all scopes that make up the current subprogram representing an address. Using the call_file/line/column attributes we can also show the source locations of these "inlined" calls. Includes a test that shows that when DWARF debuginfo is available all inlined function call frames and their source location can be shown. Signed-off-by: Mark Wielaard <[email protected]>
* stack: Initialize -n maxframes to 256 by default.Mark Wielaard2014-01-272-2/+10
| | | | | | | Make -n default just 256 frames, 2048 was too big. Also Document magic number used in frames.allocated initialization. Signed-off-by: Mark Wielaard <[email protected]>
* stack: Add -d, --debugname. Lookup DWARF debuginfo name for frame address.Mark Wielaard2014-01-279-5/+196
| | | | | | | Includes test that shows -d matches the function name that corresponds to the actual source line we report with -s for a frame address. Signed-off-by: Mark Wielaard <[email protected]>
* addr2line: handle_address initialize scopes to NULL.Mark Wielaard2014-01-242-1/+5
| | | | | | | | | dwarf_getscopes returns the number of scope DIEs containing a PC address. It returns -1 for errors or 0 if no scopes match PC. If dwarf_getscopes returned 0, then scopes will not be allocated and handle_address might free the uninitialized scopes pointer. Make sure it always has a defined value. Signed-off-by: Mark Wielaard <[email protected]>
* robustify: libelf gelf define INVALID_NDX macro.Jakub Jelinek2014-01-2320-103/+74
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* robustify: libelf.Jakub Jelinek2014-01-239-18/+139
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* robustify: strip.Roland McGrath2014-01-232-31/+63
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* robustify: readelf.Roland McGrath2014-01-232-26/+60
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* robustify: elflint.Jakub Jelinek2014-01-232-28/+86
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* robustify: Use gelf_fsize instead of relying on shdr->sh_entsize.Petr Machata2014-01-234-13/+46
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* tests: Reduce the total number of self-test files and add ET_REL files.Mark Wielaard2014-01-203-6/+26
| | | | | | | | | | | | | | Some self tests would run for a really long time (especially under valgrind) because we included all libebl backends in the list (there are 12 backends). Now only test two explicitly. Also there were no ET_REL files in the self test file list. So add two ET_REL files. The total number of self test files is now 12. run-nm-self.sh would run 4 * 3 * 3 * 22 = 792 tests (on all self test files). Reduce the number of different files to test to 3 (one ET_EXEC, one ET_DYN and one ET_REL file). Reducing the number of test runs to 99. Signed-off-by: Mark Wielaard <[email protected]>
* tests: run-backtrace-demangle.sh check exitcode and max number of frames.Mark Wielaard2014-01-202-2/+15
| | | | | | | | | | There can be more than 3 frames, but depending on the system/installed glibc we might not be able to unwind fully till the end. cxxfunc -> f -> main Expect to see the top two and a warning that there are more frames (exit code 1) Signed-off-by: Mark Wielaard <[email protected]>
* Fix false FAILs on testsuite with ulimit -c unlimited.Jan Kratochvil2014-01-182-3/+11
| | | | Signed-off-by: Jan Kratochvil <[email protected]>
* backends: aarch64_check_special_symbol check shdr is not NULL before usage.Mark Wielaard2014-01-172-3/+11
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* readelf: print_debug_macro_section clear vendor array before use.Mark Wielaard2014-01-172-0/+6
| | | | | | | | Not setting a vendor code before use would be invalid which we tried to catch. But to detect that we do need to initialize the vendor array to zero first. Signed-off-by: Mark Wielaard <[email protected]>
* lib: Add missing config.h #include to crc32_file.c.Lei Zhang2014-01-172-0/+8
| | | | | | Without config.h, there is no possibility of large file support. Signed-off-by: Mark Wielaard <[email protected]>
* Fix corruption of non-C++ symbols by the demangler.Jan Kratochvil2014-01-159-13/+127
| | | | Signed-off-by: Jan Kratochvil <[email protected]>
* tests: backtrace-subr.sh (check_native_core) should check core file name.Matthias Klose2014-01-072-0/+11
| | | | | | | Needed when /proc/sys/kernel/core_uses_pid is set to 0. Try to rename the core file, and if it does still fail, skip the test. Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: Only skip reset of return register for non-CIE-return regno (ppc64).elfutils-0.158Mark Wielaard2014-01-052-2/+8
| | | | | | | | | | | | | For PPC64 we skip resetting the return register if it is already set. This is because on PPC64 there are two DWARF registers numbers that can represent the same register. Setting the return address again confuses the unwinder. But we do want to reset it if the register number (non-translated by the ppc64 ebl) is equal to the actual register number as set in the CIE as return address. This happens on older toolchains in .debug_frame where the return address is set to 108, but the ebl abi_cfi also sets register number 65. Signed-off-by: Mark Wielaard <[email protected]>
* tests: Don't use ptrace detach stopped trick. Raise can return.Mark Wielaard2014-01-044-25/+15
| | | | | | | | | | On older kernels the ptrace detach stop trick doesn't work reliably. Just keep the child processes attached and stopped during the tests, dwfl_linux_proc_attach will handle that fine now. Also on older kernels raise would sometimes return anyway and cause a spurious assert. Just ignore it. Signed-off-by: Mark Wielaard <[email protected]>
* backends: Add PPC64 machine_flag_check.Mark Wielaard2014-01-043-2/+18
| | | | | | | | | | To distinguish between the current PPC64 ELF ABI and the revised ELFv2 ABI that will not use function descriptors binutils started to emit the version (currently 1) in the ehdr e_flags. Recognize all valid versions (0, 1 or 2) in elflint by adding the hook ppc64_machine_flag_check. Signed-off-by: Mark Wielaard <[email protected]>
* tests: backtrace-subr.sh skip check_native_core test if core ulimit fails.Mark Wielaard2014-01-042-1/+7
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* tests: Simplify backtrace-dwarf (gcc cleanup-13.c) testcase.Mark Wielaard2014-01-042-21/+9
| | | | | | | | The testcase originally came from GCC which was testing the runtime unwinder using _Unwind_ForcedUnwind. Since we are using our own external unwinder we can just abort at the right place and unwind from there. Signed-off-by: Mark Wielaard <[email protected]>
* Prepare 0.158 release.Mark Wielaard2014-01-0311-383/+762
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* backends: Add aarch64 abi_cfi.Mark Wielaard2014-01-039-3/+175
| | | | | | | | Setup initial CIE values for aarch64 for use with dwarf_frame functions. Register info prefix should be the empty string (not NULL) when not used. Add an EM_AARCH64 testcase to tests/run-addrcfi.sh to check both issues. Signed-off-by: Mark Wielaard <[email protected]>
* stack: Show and handle -r,--raw even without USE_DEMANGLE.Mark Wielaard2014-01-032-6/+6
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* stack.c (print_frames): Print 0x before build-id hex-offset.Mark Wielaard2014-01-022-1/+6
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* stack: Allow -n 0 for unlimited frames. Make default 2048 frames.Mark Wielaard2014-01-022-15/+41
| | | | Signed-off-by: Mark Wielaard <[email protected]>