| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
We only include them where we actually need them and only on linux.
Change-Id: Ic3065ffab67ba1177f63204fb91a92c5f4336dbb
Reviewed-by: Christian Kandeler <[email protected]>
|
| |
|
|
|
|
|
|
| |
The bad fts not only needs to be included before config.h, but also
requires various special types without including sys/types.h.
Change-Id: I31ac8d2aadcf7ffb3efb63583b2745991bfd6f90
Reviewed-by: Christian Kandeler <[email protected]>
|
| |\
| |
| |
| | |
Change-Id: Ifefd8ffeadb4e7d6df59cdc606323999eedc9adb
|
| | |
| |
| |
| | |
Signed-off-by: Mark Wielaard <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
Simply unconditionally uncompress any section to make sure indexes between
sections check out. Add some testcases with various compressed sections.
https://sourceware.org/bugzilla/show_bug.cgi?id=21332
Signed-off-by: Mark Wielaard <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We were calling dwarf_attr_integrate () in the die in the loop instead of
on the result. Which would cause an infinite loop when die != result.
Add a testcase that explicitly checks this case.
https://sourceware.org/bugzilla/show_bug.cgi?id=21330
Signed-off-by: Mark Wielaard <[email protected]>
|
| |\|
| |
| |
| | |
Change-Id: Ie20a924c8a6bd83cf404f236dd288a489ace62a0
|
| | |
| |
| |
| |
| |
| | |
https://sourceware.org/bugzilla/show_bug.cgi?id=21320
Signed-off-by: Mark Wielaard <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
Make sure we can at least read the shnum sections or phnum segments.
Limit the number we do check to those we can actually read.
https://sourceware.org/bugzilla/show_bug.cgi?id=21312
Signed-off-by: Mark Wielaard <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Calculate and use the expected entsize instead of relying on the one
given by the ELF file section header. Return early if there isn't enough
data in the section to check the full hash table.
https://sourceware.org/bugzilla/show_bug.cgi?id=21311
Signed-off-by: Mark Wielaard <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
Before checking symbol index zero we should make sure the data size
is big enough.
https://sourceware.org/bugzilla/show_bug.cgi?id=21310
Signed-off-by: Mark Wielaard <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When ELF section data was used, but not updated or marked as dirty and
there also existed non-dirty sections and some padding was needed between
the sections (possibly because of alignment) then elf_update might write
"fill" over some of the existing data. This happened because in that case
the last_position was not updated correctly.
Includes a new testcase fillfile that fails before this patch by showing
fill instead of the expected data in some section data. It succeeds with
this patch.
https://sourceware.org/bugzilla/show_bug.cgi?id=21199
Signed-off-by: Mark Wielaard <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The maximum compression factor (http://www.zlib.net/zlib_tech.html) is
1032:1. Add a sanity check for that before trying to allocate lots of
memory and trying to decompress lots of bogus data.
https://sourceware.org/bugzilla/show_bug.cgi?id=21301
Signed-off-by: Mark Wielaard <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
ELF notes can have a zero sized name. In which case there is no data at
all (so also no zero terminator). Make sure to use the empty string for
such notes if the code does not otherwise explicitly check n_namesz.
https://sourceware.org/bugzilla/show_bug.cgi?id=21300
Signed-off-by: Mark Wielaard <[email protected]>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We sanity check to make sure we don't index outside the chain array
by testing inner > max_nsyms. But inner is a zero-based index, while
max_nsyms is the maximum number. Change the check to inner >= max_nsyms.
https://sourceware.org/bugzilla/show_bug.cgi?id=21299
Signed-off-by: Mark Wielaard <[email protected]>
|
| |\|
| |
| |
| | |
Change-Id: I7874d814ddf7e5887fd720c899cb9e7499d5fbb8
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Make sure that if we have really lots of labels the tempsym doesn't get
truncated because it is too small to hold the whole name.
This doesn't enable -Wformat-truncation=2 or fix other "issues" pointed
out by enabling this warning because there are currently some issues
with it. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79448
Signed-off-by: Mark Wielaard <[email protected]>
|
| |/
|
|
|
|
|
|
| |
ppc64 and ppc64le ELF files can also contain a power specific
.gnu.attributes section. Add support for those and recognize the new
GNU_Power_ABI_FP Single-precision hard float value.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
| |
Rename version.c so that the implementation is called after the header
and the header doesn't clash with the toplevel version.h. print_version
depends on argp and is only used in the tools.
Signed-off-by: Ulf Hermann <[email protected]>
|
| |
|
|
|
|
| |
If it doesn't exist, provide a definition based on memcpy.
Signed-off-by: Ulf Hermann <[email protected]>
|
| |
|
|
|
|
|
| |
This makes it easier to write a replacement for it on systems where
sysconf(3) doesn't exist.
Signed-off-by: Ulf Hermann <[email protected]>
|
| |
|
|
|
|
|
|
| |
We only need it in nm.c and objdump.c, but it pulls in argp as
dependency. By dropping it from libeu.h, the libraries can be
compiled without argp.
Signed-off-by: Ulf Hermann <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
Some distros now add -D_FORTIFY_SOURCE=2 by default and we have missed
some issues in the past caught by it. Add it to CFLAGS if possible.
The configure check will make sure that it doesn't conflict with any
other CFLAGS already defined.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
| |
This is useful to test unwinding without debug information. The
binaries being examined might still have frame pointers that allow
us to bridge the unknown symbols.
Signed-off-by: Ulf Hermann <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
When unwinding by frame pointer the unwinder might ask for invalid
addresses. We don't have to fail the test in this case. In fact
any broken dwarf information can lead to requests for invalid
addresses, also without frame pointer unwinding.
Signed-off-by: Ulf Hermann <[email protected]>
|
| |
|
|
|
|
| |
Some test binaries were missing and showed up in "git status".
Signed-off-by: Ulf Hermann <[email protected]>
|
| |
|
|
|
|
|
| |
autoconf < 2.64 doesn't define PACKAGE_URL through AC_INIT.
Define it ourselves if needed.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
| |
https://sourceware.org/bugzilla/show_bug.cgi?id=21001
Signed-off-by: Luiz Angelo Daros de Luca <[email protected]>
|
| |
|
|
|
|
| |
https://sourceware.org/bugzilla/show_bug.cgi?id=20999
Signed-off-by: Piotr Drąg <[email protected]>
|
| |
|
|
|
|
| |
https://sourceware.org/bugzilla/show_bug.cgi?id=20999
Signed-off-by: Piotr Drąg <[email protected]>
|
| |
|
|
|
|
| |
https://sourceware.org/bugzilla/show_bug.cgi?id=20999
Signed-off-by: Piotr Drąg <[email protected]>
|
| |
|
|
| |
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fedorahosted used to be our home, but we are now hosted at sourceware.
Change the elfutils project home to http://elfutils.org/
Point hosted services (email, release, git, bug tracker and web pages)
to https://sourceware.org/elfutils/
Move design notes from README to NOTES.
Add URLs for home, releases, bugs, git and mailinglist to README.
Make the --version output of all tools the same by using a common
print_version function and update the publicly shown copyright holder
to the elfutils developers.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
unsigned long int is not always capable to have pointer in some cases
(LLP64, for example). Return a void pointer instead. Other libelf
implementations will also make this change (or already have).
Also update the documentation to state what is created and that NULL
is returned on error (don't document that the returned value is a
pointer to the actual header created).
Signed-off-by: Akihiko Odaki <[email protected]>
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
Older versions of glibc included an fts implementation that didn't have
Large File System support. We worked around that in linux-kernel-modules.c
by including it early before config.h and then redefining some symbols
to get the 64-bit versions. This is somewhat fragile and not necessary
with newer glibc. If possible we want the 64bit fts version always.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
Make it possible to display just the symbols from a named symbol section
instead of always displaying all symbol sections.
https://bugzilla.redhat.com/show_bug.cgi?id=1396092
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
GCC7 adds warnings for snprintf formatting into too small buffers.
Fix the two issues pointed out by the new warning. The ar header
fields are fixed length containing left-justified strings without
zero terminator. snprintf always adds a '\0' char at the end (which
we then don't copy into the ar header field) and numbers are decimal
strings of fixed 10 chars (-Wformat-length thinks formatting
them as size_t might overflow the buffer on 64bit arches).
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
Bad sh_off or sh_size could trigger a bad malloc or read. Sanity check
the header values first before trying to malloc a huge buffer or reading
any data that will certainly fail.
https://bugzilla.redhat.com/show_bug.cgi?id=1387584
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are various sanity checks that depend on knowing the file size
of the underlying ELF file which we only used when mmapping the ELF file.
Although we probably won't crash if we use pread to try to read from
the file, we still might return completely bogus data structures. This
could cause us to malloc insane amounts of memory.
Always try to get the maxsize when unknown in elf_begin.c (read_file).
https://bugzilla.redhat.com/show_bug.cgi?id=1388057
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
The name used in the standard and other DWARF implementations for
Programming Language One, PL/I, is DW_LANG_PLI (not DW_LANG_PL1).
Fix usage in dwarf_aggregate_size.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
GCC7 will have a new -Wimplicit-fallthrough warning. It did catch one
small buglet in elflint option procession. So it seems useful to enable
to make sure all swatch case fallthroughs are deliberate.
Add configure check to detect whether gcc support -Wimplicit-fallthrough
and enable it. Add fixes and explicit fallthrough comments where necessary.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
Current unstrip test cases either have no .symtab/.strtab in the
stripped binary, or .strtab sections that are identical between the
stripped and debuginfo binaries. Add a test case where .symtab/.strtab
in the stripped binary contains a small subset of the full unstripped
data.
Signed-off-by: Kevin Cernekee <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Prematurely matching up the stripped and unstripped .strtab sections
in the "Match each debuginfo" loop can lead to a case where sec->outscn
gets populated for the stripped .strtab, which we normally want to
ignore. This causes the .strtab override in the "Make sure each main
file section" loop to be skipped, so the code winds up using indices
from the unstripped .symtab to look up strings in the stripped .strtab.
This returns incorrect strings for a little while, and then fails
catastrophically when it tries to read past the end of the (smaller)
stripped file's .strtab section:
eu-unstrip: invalid string offset in symbol [1589]
Fix this by adding logic to the "Match each debuginfo" loop to
treat the unstripped .strtab, .shstrtab, and .symtab sections
essentially the same way.
The new logic will break if the .strtab section shows up earlier than
the .symtab section. We will assume this never happens in practice.
Signed-off-by: Kevin Cernekee <[email protected]>
|
| |
|
|
|
|
|
|
| |
Define/open code memrchr, rawmemchr, powerof2 and TEMP_FAILURE_RETRY if
not available through system headers.
Signed-off-by: Akihiko Odaki <[email protected]>
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
This change also creates a new header file libeu.h to provide the
prototypes for the function of libeu. That hides the definition of function
crc32, which can conflict with zlib, from libelf. It also prevents mistakes
to refer those functions from a component which doesn't link with libeu,
such as libelf.
Signed-off-by: Akihiko Odaki <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Having a symbol in an allocated symbol table (like .dynsym) that
points to an unallocated section is wrong. Traditionally strip
has removed such symbols if they are section or group symbols.
But removing a real symbol from an allocate symbol table is hard
and probably a mistake. Really removing it means rewriting the
dynamic segment and hash sections. Since we don't do that, don't
remove the symbol (and corrupt the ELF file). Do warn and set
the symbol section to SHN_UNDEF.
https://bugzilla.redhat.com/show_bug.cgi?id=1380961
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
| |
Before linux 3.20 the BPF_PSEUDO_MAP_FD constant wasn't defined.
Reported-by: Julian Ospald <[email protected]>
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
| |
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
| |
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The backtrace-native[-biarch] testcase was a little too clever in places
making it unreliable.
On x86_64 we tried to make an interesting backtrace by catching the
first signal and then replacing the pc with the address of the first
instruction of a function. Then we would raise a new signal, through
ptrace, to create a backtrace that went from a signal frame into a
frame at the start of a function. That way we could check that we were
trying to fetch the correct CFI for the (jmp) function even at the
first instruction (normally we would substract one from the return
address to get at the call address).
This works as long as the CFI for the jmp() function is identical to
the CFI for the raise() function that we "patched away". Unfortunately
on Fedora rawhide glibc has a rewritten raise() implementation that has
different CFI, in particular the CFA is calculated differently. Making
the testcase fail because we cannot properly unwind from jmp().
So this special x86_64 case has been disabled (the code is still there
in case we find another way to test this in a more reliable way).
On Ubuntu there have been spurious testcase failures because
see_exec_module found two Dwfl_Modules with the same path. This would
trigger an assert. Although this might indicate some issue (maybe we
are not parsing the proc/pid/map correctly?) it isn't clear that it
really is a bug. Since the assert is not very helpful finding any
actual bug and for the testcase it is only necessary that the first
Dwfl_Module that represents the executable is found we just pick that
Dwfl_Module and don't iterate through any of the others.
Signed-off-by: Mark Wielaard <[email protected]>
|