| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
This matches how handle_relocs_rel already printed the header.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
| |
If the section sh_size of the original and undo section are equal then
match them and don't set split_bss. This is also what prelink's
undo_sections allows.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Older versions of GNU binutils strip would drop some ELF header flags.
Causing the main ELF file and the separate .debug file to have mismatched
ELF header fields. Unfortunately some distros are still shipping such files.
eu-unstrip doesn't want to recombine such files. Add a more explicit
explanation which fields don't match and provide a --force, -F flag to
force combining such files anyway (producing a warning).
https://bugzilla.redhat.com/show_bug.cgi?id=698005
https://bugzilla.redhat.com/show_bug.cgi?id=806474
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
| |
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
And implement for arm and ia64. Both have special section types that
are valid targets for a reloc. Both refer to unwind data. elflint now
just calls ebl_check_reloc_target_type instead of hard coding the
expected section types.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
Compilers and demanglers might treat local/static functions different
between versions. In particular g++ 4.1.2 and libstdc++ mangle and
demangle the static void cxxfunc (int i) function as _Z7cxxfunci.
While g++ 4.8.2 and libstdc++ mangle and demangle it as _ZL7cxxfunci.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
| |
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
| |
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
| |
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
Don't hard code the Dwarf dwz alt multi file search but allow the user
to override it through the standard Dwfl_Callbacks. Also move ownership
completely to the user of dwarf_setalt by removing free_alt from Dwarf
and adding alt, fd and elf fields to Dwfl_Module. Add a relative .dwz
file test case.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
Move internal function __libdwfl_find_build_id to libdwelf and use it to
add a public dwelf_elf_gnu_build_id function to extract the NT_GNU_BUILD_ID
from an ELF file using either the shdrs or phdrs. Adjust internal callers
and add a testcase.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
| |
Also use dwelf_dwarf_gnu_debugaltlink to locate the alternate debugging
information.
Signed-off-by: Florian Weimer <[email protected]>
|
| |
|
|
|
|
| |
This change also adds more error checking and reporting.
Signed-off-by: Florian Weimer <[email protected]>
|
| |
|
|
| |
Signed-off-by: Florian Weimer <[email protected]>
|
| |
|
|
| |
Signed-off-by: Florian Weimer <[email protected]>
|
| |
|
|
|
|
| |
And use it if DWZ mode is enabled.
Signed-off-by: Florian Weimer <[email protected]>
|
| |
|
|
|
|
|
|
| |
New public header elfutils/libdwelf.h for low-level DWARF/ELF helper
functions. The new function dwelf_elf_gnu_debuglink returns the name and
crc as found in the .gnu_debuglink section of an ELF file.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
| |
The printed array should have at least space for the terminating zero char.
Found by gcc -fsanitize=undefined while running run-readelf-vmcoreinfo.sh.
runtime error: variable length array bound evaluates to non-positive value 0
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
| |
Found by gcc -fsanitize=undefined while running the backtrace-core-ppc test.
runtime error: shift exponent 45 is too large for 32-bit type 'unsigned int'
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
| |
Found by gcc -fsanitize=undefined.
left shift of 1 by 31 places cannot be represented in type 'int'
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
| |
As pointed out by gcc -fsanitize=undefined left shifting a negative value
is undefined. Replace it with a multiplication of the signed value as
suggested by Richard Henderson and Josh Stone.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
| |
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
| |
Signed-off-by: Kurt Roeckx <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
The --enable-mudflap configure build has been broken for 2 years without
anybody apparently noticing. GCC 4.9 removed mudflap support. Before
release we now run make distcheck with valgrind support. Removal of the
mudflap configure option simplifies the build a little.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
readelf uses libdw to open the Dwarf and read some of the DWARF data.
But it also uses its own parsers to display some of the low-level
unprocessed data. If the DWARF debug section was zlib compressed it
should actually use the decompressed section data from libdw instead
of the raw section data.
Includes a testcase for those sections that couldn't be properly
displayed when compressed before.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
| |
Add a i686 corefile test.
Reported-by: Markus Engel <[email protected]>
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
| |
https://bugzilla.redhat.com/show_bug.cgi?id=1085663
Reported-by: Florian Weimer <[email protected]>
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
|
|
| |
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).
|
| |
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
| |
Printing DW_FORM_sdata numbers as unsigned values is misleading.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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]>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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]>
|
| |
|
|
| |
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
| |
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]>
|