summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into portableMark Wielaard2015-06-1015-355/+1016
|\ | | | | | | Fixup futimens issues.
| * addr2line: Fix memory leak in print_dwarf_function.Mark Wielaard2015-06-102-5/+15
| | | | | | | | | | | | Always free the scopes returned by dwarf_getscopes () when done. Signed-off-by: Mark Wielaard <[email protected]>
| * strip: Just admit we don't support stripping ar archives for now.Mark Wielaard2015-06-102-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | We try to handle (in-place) stripping of ar archives, but since elf_clone doesn't really support cloning ar members and we don't handle reducing the size of the members, moving the offsets of other members. This causes crashes or writing garbage. Better to just admit that for now we don't support stripping archives. Call error when we see an ELF_K_AR file. https://bugzilla.redhat.com/show_bug.cgi?id=766156 https://lists.fedorahosted.org/pipermail/elfutils-devel/2009-August/000567.html Signed-off-by: Mark Wielaard <[email protected]>
| * elfcmp: Don't call memcmp with possible NULL d_buf.Mark Wielaard2015-06-052-1/+6
| | | | | | | | | | | | When d_size is zero d_buf might be NULL. Signed-off-by: Mark Wielaard <[email protected]>
| * config: Add -Wstack-usage=262144 (256K) warning check.Mark Wielaard2015-05-272-0/+19
| | | | | | | | | | | | | | | | All library code now builds with this warning and -Werror enabled. Add exceptions for most of the src tools (ldgeneric, readelf, nm, size, strip, elflint, findtextrel, elfcmp objdump, ranlib, ar and unstrip). Signed-off-by: Mark Wielaard <[email protected]>
| * addr2line: Set scopes to NULL after free in handle_address.Mark Wielaard2015-05-272-0/+5
| | | | | | | | | | | | | | If dwarf_getscopes_die () fails then scopes might not be reset and we could cause a double free. Signed-off-by: Mark Wielaard <[email protected]>
| * addr2line: Add --pretty-print option to show all information on one line.Mark Wielaard2015-05-272-11/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds an option --pretty-print to eu-addr2line to show all information on one line and all inlines on a line of their own. This mimics the same option from binutils addr2line, but without the short option variant -p. Since we already use -p to select the process. Example output: eu-addr2line --pretty-print -s -i -f -C -p$(pidof firefox) 0x00007f368c6f8915 mozilla::ReentrantMonitor::Wait(unsigned int) at ReentrantMonitor.h:92 (inlined by) mozilla::ReentrantMonitorAutoEnter::Wait(unsigned int) at ReentrantMonitor.h:190 A couple of tests were added to check the output matches that of binutils addr2line. Signed-off-by: Mark Wielaard <[email protected]>
| * addr2line: Add demangler support.Mark Wielaard2015-05-273-7/+58
| | | | | | | | | | | | | | Makes the -C, --demangle option visible and implements it (ignoring the demangle style argument). Adds a new test with sample output. Signed-off-by: Mark Wielaard <[email protected]>
| * addr2line: Add -a, --address. Print address before for each entry.Mark Wielaard2015-05-272-1/+45
| | | | | | | | | | | | Adds test cases with sample output. Signed-off-by: Mark Wielaard <[email protected]>
| * addr2line: Always parse addresses as hex numbers.Mark Wielaard2015-05-272-2/+7
| | | | | | | | | | | | | | | | We would sometimes interpret input addresses as decimal or octal. That could be confusing and isn't what binutils addr2line does. Be consistent and always treat input addresses as hex. Signed-off-by: Mark Wielaard <[email protected]>
| * addr2line: Split options in input and output format groups.Mark Wielaard2015-05-272-3/+10
| | | | | | | | | | | | | | This makes it clear that -j, --section=NAME is about how input is treated, not how the output is formatted. Signed-off-by: Mark Wielaard <[email protected]>
| * strip: Harden against bogus input files. Don't leak tmp debug file on error.Mark Wielaard2015-05-182-77/+204
| | | | | | | | | | | | | | | | | | | | There were various places where a bogus/unexpected input file would cause eu-strip to crash. Also on an unexpected error eu-strip would leak the temp debug file it was writing. https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c34 Signed-off-by: Mark Wielaard <[email protected]>
| * Always call gelf_fsize with EV_CURRENT as argument.Mark Wielaard2015-05-133-13/+13
| | | | | | | | | | | | | | | | | | | | Don't trust the elf version given by the file. It could be completely bogus. In which case gelf_fsize just returns zero. Which could cause divide by zero errors. https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c34 Signed-off-by: Mark Wielaard <[email protected]>
| * elflint: Check gnu_hash has enough data and bitmask_words is not zero.Mark Wielaard2015-05-122-7/+22
| | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c31 Signed-off-by: Mark Wielaard <[email protected]>
| * elflint: Add sanity checks to check_attributes.Mark Wielaard2015-05-122-2/+6
| | | | | | | | | | | | | | | | | | | | This is similar to commit 9644aa for readelf print_attributes. Bail out when the vendor name isn't terminated and add overflow check for subsection_len. Note that readelf does handle non-gnu attributes, while elflint doesn't. Signed-off-by: Mark Wielaard <[email protected]>
| * elflint: Use Use Elf64_Word for shdr->sh_info cnt.Mark Wielaard2015-05-122-2/+8
| | | | | | | | | | | | | | On 32bit using int might overflow. https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c31 Signed-off-by: Mark Wielaard <[email protected]>
| * elflint: Stop checking section when 2nd hash function shift too big.Mark Wielaard2015-05-122-2/+10
| | | | | | | | | | | | Nothing good comes from trying to continue with a bogus hash function. https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c31
| * nm: Handle dwarf_linesrc returning NULL.Mark Wielaard2015-05-122-4/+7
| | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1170810#32 Signed-off-by: Mark Wielaard <[email protected]>
| * Replace futimes with futimens.Max Filippov2015-05-053-13/+21
| | | | | | | | | | | | | | | | futimes is not standard function, and it's not available in uClibc. Use futimens which is POSIX. Suggested-by: Mike Frysinger <[email protected]> Signed-off-by: Max Filippov <[email protected]>
| * Drop mtrace calls.Max Filippov2015-05-0410-38/+12
| | | | | | | | | | | | | | mtrace is a GNU extension not supported by uClibc and it's believed to not be really used. Drop mtrace() calls and #include <mcheck.h>. Signed-off-by: Max Filippov <[email protected]>
| * Link against standalone argp libraryAnthony G. Basile2015-05-042-15/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | argp is not part of POSIX standards and not provided by uClibc or some other standard C libraries. However, it is possible to link against a breakout argp library. One is provided at http://www.lysator.liu.se/~nisse/misc/ This patch tests if libc provides argp otherwise it adds the linker flag -largp where needed in the build system. Signed-off-by: Anthony G. Basile <[email protected]> Signed-off-by: Max Filippov <[email protected]>
| * readelf: Fix cie_offset calculation comparison on 32bit.Mark Wielaard2015-04-282-2/+8
| | | | | | | | | | | | | | | | | | gcc -fsanitize=undefined pointed out that on 32bit systems the calculation to match the cie_offset to the cie_id could be undefined because a cie_id could be an unsigned 64bit value while ptrdiff_t is only 32bits. Correct the calculation to use 64bit values. Signed-off-by: Mark Wielaard <[email protected]>
| * readelf: Check all offsets used in print_gdb_index_section against d_size.Mark Wielaard2015-04-282-2/+18
| | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c29 Signed-off-by: Mark Wielaard <[email protected]>
| * readelf: Always try to print some debug section information.Mark Wielaard2015-04-282-2/+4
| | | | | | | | | | | | | | | | Even if we cannot create a proper Dwarf dbg we can still print the information of various debug sections. All all debug print section functions already check first they can access the appropriate data. Signed-off-by: Mark Wielaard <[email protected]>
| * readelf: Add overflow checking to print_gdb_index_section dataend checks.Mark Wielaard2015-04-282-9/+20
| | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c29 Signed-off-by: Mark Wielaard <[email protected]>
| * src: Remove __DATE__ from internal error messages.Mark Wielaard2015-04-145-12/+19
| | | | | | | | | | | | | | The date didn't really add much information (it is the day on which the code happened to be compiled) and it prevents creating reproducible builds. Signed-off-by: Mark Wielaard <[email protected]>
| * Publish known-dwarf.hPetr Machata2015-03-312-47/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | - Make the macro names properly scoped (DWARF_ALL_KNOWN_* and DWARF_ONE_KNOWN_*). - Simplify the calling convention: don't keep track of the comment associated with the enumerator, always use the non-_DESC DWARF_ONE_KNOWN_* callback. - Install known-dwarf.h alongside libdw.h and others. Signed-off-by: Petr Machata <[email protected]>
| * elflint: Correct gnu_symbias usage in compare_hash_gnu_hash.Mark Wielaard2015-03-132-14/+20
| | | | | | | | | | | | | | | | | | | | | | commit 0a545e "elflint: Add various low-level checks." introduced a bug in the handling of the gnu_symbias. The symbol in the bucket should first be compared to STN_UNDEF before applying the bias. And the used symbol index should have the bias added when compared against plain hash symbol. Found on Debian wheezy with run-elflint-self.sh. Signed-off-by: Mark Wielaard <[email protected]>
| * elfcmp: Add some NULL and zero checks.Mark Wielaard2015-01-152-7/+19
| | | | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1170810#c17 Reported-by: Alexander Cherepanov <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
| * elflint: Add various low-level checks.Mark Wielaard2015-01-152-52/+236
| | | | | | | | | | | | | | | | | | elflint could crash or hang because it didn't check some low level issues. https://bugzilla.redhat.com/show_bug.cgi?id=1170810 Reported-by: Alexander Cherepanov <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
| * strings: Produce error when section data falls outside file.Mark Wielaard2015-01-122-2/+20
| | | | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1170810 Reported-by: Alexander Cherepanov <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
| * nm: Guard against divide by zero in error check.Mark Wielaard2015-01-122-5/+13
| | | | | | | | | | | | | | | | | | Also add section index number in error message. https://bugzilla.redhat.com/show_bug.cgi?id=1170810 Reported-by: Alexander Cherepanov <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
| * nm: Handle/Skip /SYM64/ index entries.Mark Wielaard2015-01-122-1/+6
| | | | | | | | | | | | Add a testcase to show eu-nm now handles archives with 64-bit symbol table. Signed-off-by: Mark Wielaard <[email protected]>
| * nm: Stop processing ar members on first invalid offset.Mark Wielaard2015-01-122-1/+5
| | | | | | | | | | | | | | | | | | Otherwise we will keep looping on that same invalid entry. https://bugzilla.redhat.com/show_bug.cgi?id=1170810 Reported-by: Alexander Cherepanov <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
| * readelf: Don't try to read macinfo cus sentinel or beyond.Mark Wielaard2015-01-122-1/+7
| | | | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1170810 Reported-by: Alexander Cherepanov <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
| * readelf: Add more sanity checks to print_debug_exception_table.Mark Wielaard2015-01-122-4/+20
| | | | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1170810 Reported-by: Alexander Cherepanov <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* | Merge branch 'master' into portableMark Wielaard2014-12-1911-252/+782
|\|
| * avoid scary command outputUlrich Drepper2014-12-182-1/+5
| | | | | | | | | | | | The commands to check for invalid text relocations in the generated DSOs shouldn't be displayed. They contain an echo which prints the text. This patch suppresses the commands from being printed.
| * readelf: Add bounds check before each CFA op that takes an argument.Mark Wielaard2014-12-172-2/+45
| | | | | | | | | | | | | | Some CFA ops don't take any arguments, for those it is valid to be at the end of the data block. Signed-off-by: Mark Wielaard <[email protected]>
| * readelf: Print dwarf_errmsg if dwarf_onesrcline or dwarf_linesrc fails.Mark Wielaard2014-12-172-1/+16
| | | | | | | | | | | | Don't just crash using the NULL result in print_decoded_line_section. Signed-off-by: Mark Wielaard <[email protected]>
| * readelf: Correct overflow check for length in print_debug_aranges_section.Mark Wielaard2014-12-172-1/+2
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
| * readelf,libdw: Correct .debug_line overflow check for unit_length.Mark Wielaard2014-12-172-2/+7
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
| * readelf: Warn, don't assert, if loclist or rangelist offset is too big.Mark Wielaard2014-12-172-16/+35
| | | | | | | | | | | | | | | | | | We use a couple of bits to keep track of the addr size, dwarf size and warning given for a loclist or rangelist offset. Normally offset won't be that big and will fit in 61-bits easily. But if not, don't assert, but just warn we don't handle such large offsets. Signed-off-by: Mark Wielaard <[email protected]>
| * readelf: Don't assert when addr_size or ref_size is not 4 or 8 in print_ops.Mark Wielaard2014-12-172-15/+13
| | | | | | | | | | | | Just report invalid data and continue. Signed-off-by: Mark Wielaard <[email protected]>
| * readelf: Add more bounds checks to print_gdb_index_section.Mark Wielaard2014-12-172-3/+9
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
| * readelf: Make sure there is enough room for reading .debug_line unit_length.Mark Wielaard2014-12-172-1/+4
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
| * readelf: Check there is enough room for the DW_LNE_set_address argumentMark Wielaard2014-12-172-0/+7
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
| * libdw: Add get_uleb128 and get_sleb128 bounds checking.Mark Wielaard2014-12-173-113/+163
| | | | | | | | | | | | | | | | | | | | | | Both get_uleb128 and get_sleb128 now take an end pointer to prevent reading too much data. Adjust all callers to provide the end pointer. There are still two exceptions. "Raw" dwarf_getabbrevattr and read_encoded_valued don't have a end pointer associated yet. They will have to be provided in the future. Signed-off-by: Mark Wielaard <[email protected]>
| * elfcmp: Make sure Elf32_Word difference doesn't wrap around in int compare.Mark Wielaard2014-12-172-2/+6
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
| * readelf: Check TType base offset and Action table are sane in exception table.Mark Wielaard2014-12-152-2/+14
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>