summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* 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]>
* 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]>
* readelf: Don't print more augmentation characters than there are.Mark Wielaard2014-12-152-3/+9
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Check count fits and doesn't overflow fptr in handle_file_note.Mark Wielaard2014-12-122-2/+11
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Report invalid data if action table doesn't follow call site table.Mark Wielaard2014-12-122-1/+7
| | | | | | Don't assert. Signed-off-by: Mark Wielaard <[email protected]>
* addr2line: Always prefer linkage_name over plain namesJosh Stone2014-12-112-20/+27
| | | | Signed-off-by: Josh Stone <[email protected]>
* addr2line: Iterate scopes for inline's parent functionJosh Stone2014-12-112-1/+21
| | | | | | | | The function which contains an inline might not be the immediate next die scope. For instance, there may be a lexical scope in between. Instead, iterate the remaining scopes until an appropriate tag is found. Signed-off-by: Josh Stone <[email protected]>
* readelf: maximum operations per instruction cannot be zero in .debug_line.Mark Wielaard2014-12-112-0/+13
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* readelf: DW_OP_call_ref and DW_OP_GNU_implicit_pointer are invalid for CFA.Mark Wielaard2014-12-112-0/+9
| | | | | | | | | print_cfa_program might call print_ops with zero offset size. We don't need (and don't know) the DWARF offset size in that case. DW_OP_call_ref and DW_OP_GNU_implicit_pointer need to know the offset size because they reference a DIE. But they are invalid when used from CFA. Signed-off-by: Mark Wielaard <[email protected]>
* objdump: Add various sanity checks to guard against corrupted data.Mark Wielaard2014-12-042-3/+16
| | | | | Reported-by: Alexander Cherepanov <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Fix overflow check in handle_sysv_hash64.Mark Wielaard2014-12-042-2/+8
| | | | | | | Since all values are 64bit, not 32bit as in other hashes, we need to explicitly check for overflow. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Don't trash destshdr for STT_SECTION in handle_relocs_rel[a].Mark Wielaard2014-12-042-14/+27
| | | | | | We might need the original destshdr for handling other relocations. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Cast Dwarf_Word length to ptrdiff_t for comparison.Mark Wielaard2014-11-272-1/+6
| | | | | | Avoids comparison between signed and unsigned integer expressions warning. Signed-off-by: Mark Wielaard <[email protected]>
* readelf, libdw: Guard against divide by zero line_range in .debug_line.Mark Wielaard2014-11-262-0/+12
| | | | | | | For DW_LNS_const_add_pc and special opcodes don't accept line_range being zero. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Check length for nexthdr overflow in print_debug_aranges_section.Mark Wielaard2014-11-262-1/+6
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* readelf: print_attributes (-A) robustify and handle non-gnu attributes.Mark Wielaard2014-11-262-8/+43
| | | | | | | | | | | print_attributes wasn't robust against empty or broken attribute sections. It also only handled GNU attributes. But the arm backend contains some none-GNU attributes. The difference is in how to handle the tag arguments. Adds a new test run-readelf-A.sh for both gnu (ppc32) and non-gnu (arm) attributes. Signed-off-by: Mark Wielaard <[email protected]>
* Use elf_getphdrnum instead of accessing ehdr->e_phnum directly.Mark Wielaard2014-11-267-27/+56
| | | | | | | Using elf_getphdrnum lets us handle ELF files that use more than PN_XNUM phdrs. And guards against some corrupt files. Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: Sanity check the symbol table before use.Mark Wielaard2014-11-181-0/+5
| | | | | | Make sure the number of symbols reported and the first global fit the data. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Fix sanity check of DW_FORM_block length in print_cfa_programMark Wielaard2014-11-181-1/+1
| | | | | | We were checking the reg nr, not the length of the block. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: When the version chain ends, stop processing the entries.Mark Wielaard2014-11-172-2/+33
| | | | | | | | | | The version definition, auxiliary version, version dependency and needed version sections chain information together through "next" fields. When the "next" field is zero there are no more information entries. Stop processing when we see zero instead of repeatedly processing the same entry (at offset zero from the current one). Signed-off-by: Mark Wielaard <[email protected]>
* Check elf_strptr didn't fail getting section name.Mark Wielaard2014-11-174-9/+15
| | | | | | | | Since elf_strptr can fail and return NULL we should always check the result before usage. Debug sections are only handled by section name, so make sure the name actually exists. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Warn if ptr_size is not 4 or 8 bytes.Mark Wielaard2014-11-172-3/+11
| | | | | | | Just warn and don't call print_cfa_program in that case. Bad things will happen and the result is mostly bogus. Signed-off-by: Mark Wielaard <[email protected]>
* libelf: Fix handling of (extended) phnum.Mark Wielaard2014-11-172-1/+12
| | | | | | | | If there is no e_phoff e_phnum cannot be trusted. Extended phnum can only be gotten if we have an actual section table and a shdr for section zero, Extended phnum can be too large to fit in the file (or a size_t). Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Robustify print_cfa_program.Mark Wielaard2014-11-162-0/+15
| | | | | | Check block len before calling print_ops. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Sanity check CIE unit_length and augmentationlen in debug_frame.Mark Wielaard2014-11-142-1/+21
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Check def == NULL before use in handle_versym.Mark Wielaard2014-11-142-1/+8
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* readelf.c (handle_versym): Initialize vername and filename array elements.Mark Wielaard2014-11-082-0/+7
| | | | | | | | We check whether the elements are set before printing their contents, but didn't make sure they were initialized. Reported-by: Hanno Böck <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Sanity check hash section contents before processing.Mark Wielaard2014-11-082-1/+54
| | | | | Reported by: Hanno Böck <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Fix typo in a check in handle_relocs_relaPetr Machata2014-09-232-1/+5
| | | | | | | | - Testing shdr makes no sense, that pointer was dereferenced several times throughout the section. destshdr on the other hand is not tested at all. Signed-off-by: Petr Machata <[email protected]>
* Rename read_ubyte_unaligned_inc to read_addr_unaligned_incPetr Machata2014-09-122-7/+15
| | | | | | | | | | | | | | - The behavior of this function has been changed to read only address-sized quantities, i.e. the size of 2 is no longer allowed. (Size of 1 never was.) The two outstanding uses, both in readelf.c, which actually do use this call to read address-sized units, were updated, rejecting fields that indicate weird address sizes. - The three related calls, read_sbyte_unaligned_inc, read_ubyte_unaligned and read_sbyte_unaligned were dropped. There are currently no uses for these calls. Signed-off-by: Petr Machata <[email protected]>
* Prevent premature @AR@ replacement in a sed expression.elfutils-0.160Josh Stone2014-08-252-1/+5
| | | | | | | | | | | | The Makefile rule for make-debug-archive has a sed expression to replace @AR@ will the installed name, but this was itself getting replaced when the Makefile was configured, for a pattern like "s,ar,/path/prefix-,g". Havoc ensued in the resulting make-debug-archive. The fix matches it using a regex bracket expression, "[@]AR[@]", so sed will still match it, but it's immune to configure's replacement. Signed-off-by: Josh Stone <[email protected]>
* Add ppc64le ELFv2 abi support to backends and elflint.Mark Wielaard2014-07-042-1/+8
| | | | | | | | | | The big endian vs little endian changes are already handled by detecting the EI_DATA data encoding. And the function descriptors are already not used when we see there is no .opd section. This change adds new checks for st_other bits, new relocations and recognizes DT_PPC64_OPT. Signed-off-by: Menanteau Guy <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* libebl: Add ebl_func_addr_mask plus ARM backend implementation.Mark Wielaard2014-06-222-7/+17
| | | | | | | | | | | | | | The ARM EABI says that the zero bit of function symbol st_value indicates whether the symbol points to a THUMB or ARM function. Also the return value address in an unwind will contain the same extra bit to indicate whether to return to a regular ARM or THUMB function. Add a new ebl function to mask off such bits and turn a function value into a function address so that we get the actual value that a function symbol or return address points to. It isn't easily possible to reuse the existing ebl_resolve_sym_value for this purpose, so we end up with another hook that can be used from dwfl_module_getsym, handle_cfi and elflint. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Skip section if name is NULL in print_debug.Mark Wielaard2014-05-272-1/+7
| | | | | | | | Don't crash and burn when a section doesn't have a name (possibly invalid ELF file string table). Just try the next section instead of calling strcmp on NULL. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Don't print 'for section' when rela section sh_info is zero.Mark Wielaard2014-05-272-1/+20
| | | | | | This matches how handle_relocs_rel already printed the header. Signed-off-by: Mark Wielaard <[email protected]>
* unstrip: Allow prelinked, but non-split .bss section.Mark Wielaard2014-05-272-2/+8
| | | | | | | | 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]>
* unstrip: Add --force to force combining files when ELF headers don't match.Mark Wielaard2014-05-272-16/+56
| | | | | | | | | | | | | | 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]>