A new release of elfutils is available now at:
When building and packaging this release please look at the improved
configure output which will show all features detected/enabled and the
recommended settings (and which features can be enabled, but are not
All known ways to crash the elfutils tools and libraries caused by bogus
ELF files or DWARF data have been fixed. This release is Valgrind
memcheck clean, GCC -fsanitizer=undefined clean and the libelf and libdw
libraries don't have unbounded stack usage anymore as checked by GCC
Please do report issues if there are still ways a bad ELF file or bad
DWARF data can crash the libraries or tools. Ideally it is safe to
process any data and bad input should only results in an error being
* NEWS *
Install new header elfutils/known-dwarf.h.
dwarf.h Add preliminary DWARF5 constants DW_TAG_atomic_type,
DW_LANG_Fortran03, DW_LANG_Fortran08. dwarf_peel_type now also
Input addresses are now always interpreted as hexadecimal
numbers, never as octal or decimal numbers.
New option -a, --addresses to print address before each entry.
New option -C, --demangle to show demangled symbols.
New option --pretty-print to print all information on one line.
CVE-2014-9447 Directory traversal vulnerability in ar extraction.
* GIT SHORTLOG *
Alexander Cherepanov (1):
libelf: Fix dir traversal vuln in ar extraction.
Anthony G. Basile (1):
Link against standalone argp library
H.J. Lu (8):
tests: Use PTRACE_GETREGS/PTRACE_SETREGS to update rip
backends: Add x32_corenote.c
tests: Add testfile-x32-core.bz2 to run-readelf-mixed-corenote.sh
tests: Add testfile-x32-core to run-allregs.sh
tests: Add testfile-x32 to run-addrcfi.sh
tests: Add run-backtrace-core-x32.sh
tests: Add run-strip-test9.sh
tests: Add run-strip-test10.sh
Jan Kratochvil (1):
libelf: Consider sh_addralign 0 as 1
Jason P. Leasure (1):
libdw: fix offset for sig8 lookup in dwarf_formref_die
Jonathan Lebon (2):
dwarf_begin_elf: decouple section searching from reading
dwarf_begin_elf: new error for compression failure
Josh Stone (2):
libdw: ensure read_encoded_value's value is set
tests: ensure backtrace.c exec_dump sets jmp
Mark Wielaard (122):
libdw: Prevent infinite recursion when processing DW_TAG_imported_unit.
readelf: Add more sanity checks to print_debug_exception_table.
readelf: Don't try to read macinfo cus sentinel or beyond.
libelf: ar_size cannot be negative. Fix max ar size.
nm: Stop processing ar members on first invalid offset.
nm: Handle/Skip /SYM64/ index entries.
nm: Guard against divide by zero in error check.
strings: Produce error when section data falls outside file.
libdw: Check sibling attribute offset still falls inside CU data.
tests: Add testfile-debug-types test case.
elflint: Add various low-level checks.
backends: Check sh_entsize is not zero in ppc_symbol.c (find_dyn_got).
libelf: gelf_getphdr should check phdr index is valid.
libdw: Handle NULL dbg for call_ref, GNU_implicit_pointer and addr DW_OPs.
libdw: Add missing size check to parse_eh_frame_hdr.
elfcmp: Add some NULL and zero checks.
libdw: Check register number in CFI isn't insanely large.
libdw: Check DW_AT_sibling attribute offset is after current DIE.
libdwfl: Handle seeing CU EOF marker without any other (real) CU.
libdw: Robustify eh_frame_hdr and encoded-values reading.
libdwfl: dwfl_module_getsrc should never match end_sequence line.
libdw: Search for the last matching address with dwarf_getsrc_die.
tests: Make deleted and vdsosyms testcases work with "restricted ptrace".
libebl.h: Add comment from README that this is completely UNSUPPORTED.
s/Really, not guarantee/Really, no guarantee/g
libelf: elf_strptr should fetch the shdr for the section if not yet known.
libelf: Fix elf_newdata when raw ELF file/image data is available.
libelf: elf_strptr should use datalist when data has been added to section.
libelf: Make sure string returned by elf_strptr is NUL terminated.
libdwfl: Clear symtab result on error before using find_dynsym fallback.
libdw: Add support for DWARF5/GCC5 DW_TAG_atomic_type.
libdw: Add DWARF5/GCC5 DW_LANG_Fortran03 and DW_LANG_Fortran08 support.
tests: Use PRId64 for printing loff_t.
libelf: Make __libelf_set_data_list_rdlock an internal_function.
elflint: Correct gnu_symbias usage in compare_hash_gnu_hash.
backends: COPY relocations can also happen in ET_DYN.
Fix -Wimplicit warnings.
backends: aarch64 can have _GLOBAL_OFFSET_TABLE_ point anywhere in .got.
libelf: Don't extend ELF file size with SHT_NOBITS sh_offset.
libdwfl: Special case core_file_read_eagerly for small ELF images.
libdwfl: Correct off-by-one check in segment.c insert.
configure: Add explicit checks for all GNU99 extensions used.
src: Remove __DATE__ from internal error messages.
libdw: Don't overflow stack with user defined macro attributes array.
readelf: Add overflow checking to print_gdb_index_section dataend checks.
readelf: Always try to print some debug section information.
readelf: Check all offsets used in print_gdb_index_section against d_size.
libdw: Undefined behavior in get_sleb128_step.
readelf: Fix cie_offset calculation comparison on 32bit.
Update elf.h from glibc.
configure: print feature settings overview
tests: Split run-stack tests to support missing demangler.
libelf: Make sure version xlate dest buffer is fully defined.
libdwfl: Bounds check Dwarf_Fileinfo file number in dwfl_lineinfo.
libdw: dwarf_getaranges check there is enough data before reading.
nm: Handle dwarf_linesrc returning NULL.
libdw: Detect line number overflow in dwarf_getsrclines on 32bit.
elflint: Stop checking section when 2nd hash function shift too big.
elflint: Use Use Elf64_Word for shdr->sh_info cnt.
elflint: Add sanity checks to check_attributes.
elflint: Check gnu_hash has enough data and bitmask_words is not zero.
libdwfl: Only intern CU when not EOF marker and cuoff points to a DIE.
Always call gelf_fsize with EV_CURRENT as argument.
libelf: Make sure shdrs are valid before storing extended phnum in newphdr.
libelf: More checking of valid sh_addralign values.
strip: Harden against bogus input files. Don't leak tmp debug file on error.
libelf: If e_phnum is zero then set e_phoff also to zero.
configure: Add --enable-sanitize-undefined.
libelf: Use posix_fallocate instead of ftruncate to extend ELF file.
addr2line: Split options in input and output format groups.
addr2line: Always parse addresses as hex numbers.
addr2line: Add -a, --address. Print address before for each entry.
addr2line: Add demangler support.
addr2line: Add --pretty-print option to show all information on one line.
addr2line: Set scopes to NULL after free in handle_address.
libelf: Fix possible unbounded stack usage in elf_getarsym.
libelf: Fix possible unbounded stack usage in updatemmap.
libelf: Fix possible unbounded stack usage in updatefile.
libebl: Use static number for array stack allocation in openbackend.
libebl: Don't blow up stack when processing large NT_GNU_ABI_TAG.
libdwfl: Fix possible unbounded stack usage in cache_sections.
libdwfl: Fix unbounded stack usage in find_prelink_address_sync.
libdw: Fix possibly unbounded stack usage in __libdw_intern_expression.
libdwfl: Minimize stack usage in dwfl_linux_kernel_report_offline.
libdwfl: Don't stack allocate alternate_name in dwfl_linux_kernel_find_elf.
libdwfl: Don't allocate all phdrs on the stack in elf_from_remote_memory.
libdwfl: Reject very short or really large build-ids.
libdwfl: find_debuginfo_in_patch don't alloca/strdupa strings of unknown size.
libdwfl: Don't allocate phdrs and dyn on stack in dwfl_segment_report_module.
libdwfl: Don't allocate phdrs and dyn on stack in link_map.
libdw: Limit stack usage of temporary dir, file and line lists.
config: Add -Wstack-usage=262144 (256K) warning check.
libdwfl: Check mod is not NULL in check_module.
libdw: Fix overflow in read_encoded_value for the DW_EH_PE_indirect case.
libdw: Fix overflow in read_encoded_value for the DW_EH_PE_indirect case.
configure: Add check for bunzip2 and maintainer-mode tools.
tests: Always print reason when skipping test.
libdwfl: Check file_name is not NULL before calling canonicalize_file_name.
libelf: Don't call mempcpy with possible NULL d_buf.
libelf: Don't call memmove with possible NULL buffer.
elfcmp: Don't call memcmp with possible NULL d_buf.
libelf: Fix unbounded stack usage in elf_getarsym for !ALLOW_UNALIGNED case.
libelf: Fix possible unbounded stack usage in getphdr_wrlock.
libelf: Fix possible unbounded stack usage in load_shdr_wrlock.
libdwfl: Don't assume auxv or r_debug data is properly aligned in link_map.
Fix sanitize-undefined config check. Don't ALLOW_UNALIGNED when checking.
Define MODVERSION in a more reproducable way.
libdwfl: Fix memory leak in __libdwfl_open_by_build_id.
libelf: Split checks for ehdr and shdr, drop phdr check in file_read_elf.
libelf: Check e_shoff alignment before direct access of Elf(32|64)_Shdr.
libdwfl: Report core module segment even when NT_FILE build-id doesn't match.
libdw: Initialize filelist early in read_srclines.
libelf: Make sure conversion functions work on aligned data for type.
libelf: Make sure elf_getdata_rawchunk returns aligned data.
libdwfl: Fix memory leak in cache_sections.
libdwfl: Fix memory leak in find_debuginfo_in_path.
configure: Add check for gcc -Wstack-usage.
libdw: Initialize dirarray early in read_srclines.
strip: Just admit we don't support stripping ar archives for now.
addr2line: Fix memory leak in print_dwarf_function.
Prepare 0.162 release.
elfutils.spec.in (devel): Include known-dwarf.h and version.h.
Max Filippov (5):
Allow disabling symbol versioning at configure time
configure: fix enable_demangler setting
Drop mtrace calls.
Replace futimes with futimens.
Replace assert_perror with assert
Petr Machata (6):
dwarf_ranges: do not request base address attributes if not necessary
Support STT_ARM_TFUNC symbol type in ebl_symbol_type_name hook
Drop two useless variables from known-dwarf.awk
Add forgotten files to EXTRA_DIST
Do not reject type units in dwarf_getsrcfiles and dwarf_getsrclines
Roland McGrath (1):
libdwfl: Make dwfl_error.c C99-kosher.
Yuri Chornoivan (2):
Ukrainian translation update
Ukrainian translation update
It has been 6 months since 0.161 and it really is time for a new
release. There have been more than 120 commits since 0.161. x32 backend
support, eu-addr2line improvements, elfutils/known-dwarf.h header,
better uclibc support, various bug fixes, making the code base gcc
-fsanitize=undefined clean plus lots of hardening patches (I hope we are
now free from any known crashes on bad ELF file or DWARF data input).
There are still some patches pending and some not completely finished
projects (c++ iterators, detailed libdwfl errors). Lets see how much of
that we can finish this week and postpone the rest till the next
I would like to get any pending work in this week and then stabilize,
test and release next week. Please let me know if you really want to
land something before 0.162.
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.
Signed-off-by: Mark Wielaard <mjw(a)redhat.com>
src/ChangeLog | 5 +++++
src/strip.c | 14 ++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 59d87c8..35c68c7 100644
@@ -1,3 +1,8 @@
+2015-06-09 Mark Wielaard <mjw(a)redhat.com>
+ * strip.c (handle_ar): Mark as unused.
+ (process_file): Produce an error when trying to handle an ar.
2015-05-30 Mark Wielaard <mjw(a)redhat.com>
* elfcmp.c (main): Only call memcmp when d_size != 0.
diff --git a/src/strip.c b/src/strip.c
index d63b6a8..5e69334 100644
@@ -113,7 +113,7 @@ static int handle_elf (int fd, Elf *elf, const char *prefix,
/* Handle all files contained in the archive. */
static int handle_ar (int fd, Elf *elf, const char *prefix, const char *fname,
- struct timespec tvp);
+ struct timespec tvp) __attribute__ ((unused));
static int debug_fd = -1;
static char *tmp_debug_fname = NULL;
@@ -374,7 +374,17 @@ process_file (const char *fname)
result = 1;
- result = handle_ar (fd, elf, NULL, fname, preserve_dates ? tv : NULL);
+ /* We would like to support ar archives, but currently it just
+ doesn't work at all since we call elf_clone on the members
+ which doesn't really support ar members.
+ result = handle_ar (fd, elf, NULL, fname,
+ preserve_dates ? tv : NULL);
+ error (0, 0, gettext ("%s: no support for stripping archive"),
+ result = 1;