summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into portableupstream/portableMark Wielaard2015-06-112-0/+7
|\
| * elfutils.spec.in (devel): Include known-dwarf.h and version.h.elfutils-0.162Mark Wielaard2015-06-112-0/+7
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
* | Merge branch 'master' into portableMark Wielaard2015-06-1011-4285/+4931
|\|
| * Prepare 0.162 release.Mark Wielaard2015-06-1011-4285/+4931
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
* | Merge branch 'master' into portableMark Wielaard2015-06-10174-1277/+6853
|\| | | | | | | 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]>
| * libdw: Initialize dirarray early in read_srclines.Mark Wielaard2015-06-102-10/+14
| | | | | | | | | | | | | | We might jump to "out" early on error. Help gcc see that isn't an issue by initializing dirarray to dirstack early. Signed-off-by: Mark Wielaard <[email protected]>
| * configure: Add check for gcc -Wstack-usage.Mark Wielaard2015-06-104-1/+25
| | | | | | | | | | | | | | Some older gcc versions don't support -Wstack-usage. Only use it when accepted by the compiler. Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: Fix memory leak in find_debuginfo_in_path.Mark Wielaard2015-06-092-10/+13
| | | | | | | | | | | | | | | | | | commit c4f133 libdwfl: find_debuginfo_in_patch don't alloca/strdupa strings of unknown size. Introduced a memory leak in the case nothing was found. Make sure before returning all temporary strings are all freed. Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: Fix memory leak in cache_sections.Mark Wielaard2015-06-092-0/+5
| | | | | | | | | | | | | | | | commit be1778 libdwfl: Fix possible unbounded stack usage in cache_sections. introduced a memory leak. The refs pointers were copied to the sortrefs array but never freed. Only the array was freed. Also free the elements. Signed-off-by: Mark Wielaard <[email protected]>
| * libelf: Make sure elf_getdata_rawchunk returns aligned data.Mark Wielaard2015-06-093-3/+34
| | | | | | | | | | | | | | | | | | | | elf_getdata_rawchunk might return an unaligned buffer for the requested ELF data type. Make sure the data is also correctly aligned when using an mmapped file. Also add some missing alignments for ELF data types for __libelf_type_align (the missing types could also make elf_getdata to return unaligned data). Signed-off-by: Mark Wielaard <[email protected]>
| * libelf: Make sure conversion functions work on aligned data for type.Mark Wielaard2015-06-092-2/+29
| | | | | | | | | | | | | | | | | | | | | | The gelf_xlate conversion functions work on properly aligned ELF data types. If elf_get data needs to do conversion and ! ALLOW_UNALIGNED and the rawdata_base isn't aligned properly for the section type, then provide an aligned copy of the data. Found with --enable-sanitize-undefined in run-test-archive64.sh on x86_64. Signed-off-by: Mark Wielaard <[email protected]>
| * Ukrainian translation updateYuri Chornoivan2015-06-081-8/+8
| | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1139815 Signed-off-by: Yuri Chornoivan <[email protected]>
| * Ukrainian translation updateYuri Chornoivan2015-06-081-22/+19
| | | | | | | | Signed-off-by: Yuri Chornoivan <[email protected]>
| * libdw: Initialize filelist early in read_srclines.Mark Wielaard2015-06-082-11/+16
| | | | | | | | | | | | | | We might jump to "out" early on error. Then filelist might not be set yet and we might try to free garbage. Set it to the null_file early. Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: Report core module segment even when NT_FILE build-id doesn't match.Mark Wielaard2015-06-082-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dwfl_segment_report_module can take the NT_FILE note contents to find the matching file for the module on the file system from the core file. If the file exists but the build-id didn't match we would not report the module. But we should just report the module anyway, ignore the file, and try to match the ELF image another way. This issue can be replicated by building and running make check in /tmp/elfutils with run-backtrace-core-aarch64.sh since that core file includes a NT_FILE note pointing to /tmp/elfutils/tests/backtrace-child. Which won't match if it was just recompiled. Signed-off-by: Mark Wielaard <[email protected]>
| * libelf: Check e_shoff alignment before direct access of Elf(32|64)_Shdr.Mark Wielaard2015-06-082-4/+9
| | | | | | | | | | | | | | | | In get_shnum the check was whether the Elf(32|64)_Ehdr was correctly aligned, but to access the Shdr directly we need to check whether the address that points to the Elf(32|64)_Shdr structure is correctly aligned. Signed-off-by: Mark Wielaard <[email protected]>
| * libelf: Split checks for ehdr and shdr, drop phdr check in file_read_elf.Mark Wielaard2015-06-082-65/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are various places in the code that check whether mmapped structures are correctly aligned (or ALLOW_UNALIGNED is set). Some of these checks are asserts. Like the one in elf(32|64)_getshdr. We should not get into that part of the code if the shdr scn structure was cached in elf_begin because it was mmapped in and properly aligned. These asserts could trigger because in elf_begin.c file_read_elf () all alignment checks were combined. So even though only one of the ehdr, shdr or phdr structures were not properly aligned all structures would be copied. Also the phdr structure was not even read in elf_begin, so the alignment check was unnecessary. This patch splits the alignment checks and reading of ehdr and shdr structures into separate code paths. It also drops the phdr alignment checks in elf_begin. Those phdr checks are done in elf(32|64)_getphdr already. Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: Fix memory leak in __libdwfl_open_by_build_id.Mark Wielaard2015-06-052-1/+7
| | | | | | | | | | | | | | | | | | commit c57829 introduced a memory leak by passing the path string to strsep. strsep will change the given pointer and set it to NULL eventually. Causing the original pointer to leak. Fix by passing a copy of the pointer to strsep. Signed-off-by: Mark Wielaard <[email protected]>
| * Define MODVERSION in a more reproducable way.Mark Wielaard2015-06-052-6/+11
| | | | | | | | | | | | | | | | | | We define MODVERSION to make sure the libebl backend modules match the elfutils build when we dlopen them. Using hostname and date makes it very hard to create reproducable builds. Define them a little more reproducable using LIBEBL_SUBDIR, eu_version and ac_cv_build. Signed-off-by: Mark Wielaard <[email protected]>
| * Fix sanitize-undefined config check. Don't ALLOW_UNALIGNED when checking.Mark Wielaard2015-06-054-4/+20
| | | | | | | | | | | | | | | | | | The -fsanitize=undefined check need to use AC_LINK_IFELSE to make sure libubsan is installed. When doing undefined checking we should disable ALLOW_UNALIGNED memory accesses to catch issues where we do unaligned accesses by accident. Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: Don't assume auxv or r_debug data is properly aligned in link_map.Mark Wielaard2015-06-052-10/+22
| | | | | | | | | | | | | | core file data isn't guaranteed to be alligned properly. Use read_(4|8)ubyte_unaligned_noncvt to read values, types and addresses. Signed-off-by: Mark Wielaard <[email protected]>
| * libelf: Fix possible unbounded stack usage in load_shdr_wrlock.Mark Wielaard2015-06-052-4/+19
| | | | | | | | | | | | | | When a copy needs to be made of the shdrs, allocate with malloc and free after conversion instead of calling alloca. Signed-off-by: Mark Wielaard <[email protected]>
| * libelf: Fix possible unbounded stack usage in getphdr_wrlock.Mark Wielaard2015-06-052-4/+19
| | | | | | | | | | | | | | When a copy needs to be made of the phdrs, allocate with malloc and free after conversion instead of calling alloca. Signed-off-by: Mark Wielaard <[email protected]>
| * libelf: Fix unbounded stack usage in elf_getarsym for !ALLOW_UNALIGNED case.Mark Wielaard2015-06-052-1/+14
| | | | | | | | | | | | | | The number of entries in the index can be large, don't use alloca to read in temporary data, use malloc (which is freed after out). 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]>
| * libelf: Don't call memmove with possible NULL buffer.Mark Wielaard2015-06-052-2/+7
| | | | | | | | | | | | When size is zero the buffer src and dest buffers might be NULL. Signed-off-by: Mark Wielaard <[email protected]>
| * libelf: Don't call mempcpy with possible NULL d_buf.Mark Wielaard2015-06-052-1/+6
| | | | | | | | | | | | | | When d_size is zero d_buf might be NULL. last_position doesn't need to be updated in that case. Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: Check file_name is not NULL before calling canonicalize_file_name.Mark Wielaard2015-06-052-1/+6
| | | | | | | | | | | | canonicalize_file_name is marked as taking a nonnull argument. Signed-off-by: Mark Wielaard <[email protected]>
| * tests: Always print reason when skipping test.Mark Wielaard2015-06-058-7/+25
| | | | | | | | | | | | Make sure the reason a test is SKIPPED is added to the test-suite.log. Signed-off-by: Mark Wielaard <[email protected]>
| * configure: Add check for bunzip2 and maintainer-mode tools.Mark Wielaard2015-06-052-0/+30
| | | | | | | | | | | | | | | | Without bunzip2 make check cannot be run. To generate all files in maintainer-mode flex and bison are needed. Otherwise check that libdw/known-dwarf.h is already generated. Signed-off-by: Mark Wielaard <[email protected]>
| * libdw: Fix overflow in read_encoded_value for the DW_EH_PE_indirect case.Mark Wielaard2015-06-050-0/+0
| | | | | | | | | | | | | | If we are going to dereference a pointer there should be at least enough data to hold a pointer. Found by afl-fuzz. Signed-off-by: Mark Wielaard <[email protected]>
| * libdw: Fix overflow in read_encoded_value for the DW_EH_PE_indirect case.Mark Wielaard2015-06-012-3/+9
| | | | | | | | | | | | | | If we are going to dereference a pointer there should be at least enough data to hold a pointer. Found by afl-fuzz. Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: Check mod is not NULL in check_module.Mark Wielaard2015-05-272-0/+7
| | | | | | | | | | | | | | | | | | check_module is called from dwfl_module_relocate_address and from dwfl_module_address_section. Both could take a NULL Dwfl_Module if an earlier error had occured. Make check_module return immediately indicating an issue in that case. Signed-off-by: Mark Wielaard <[email protected]>
| * config: Add -Wstack-usage=262144 (256K) warning check.Mark Wielaard2015-05-274-0/+26
| | | | | | | | | | | | | | | | 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]>
| * libdw: Limit stack usage of temporary dir, file and line lists.Mark Wielaard2015-05-272-60/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Limit stack usage of lines with MAX_STACK_LINES, files with MAX_STACK_LINES and dirs with MAX_STACK_DIRS. Calculate number of dirs needed first, then create dirarray directly, without needing the next field. Free not stack allocated lines and files at the end. Use preallocated stack arrays for all instead of calling alloca to help compiler see actual stack usage. The current stack allocation limits are 4096 lines, 1024 files in 256 dirs per CU. For GCC 4.8 libstdc++.so has on average 512 lines per CU. With these settings read_srclines uses max 228K of stack on x86_64. Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: Don't allocate phdrs and dyn on stack in link_map.Mark Wielaard2015-05-272-10/+29
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: Don't allocate phdrs and dyn on stack in dwfl_segment_report_module.Mark Wielaard2015-05-272-26/+47
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: find_debuginfo_in_patch don't alloca/strdupa strings of unknown size.Mark Wielaard2015-05-272-7/+37
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: Reject very short or really large build-ids.Mark Wielaard2015-05-272-4/+25
| | | | | | | | | | | | | | | | We cannot handle build-ids less than at least 3 or more than 64 bytes. Very big build-ids, or very large debug search paths might have blown up the stack. Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: Don't allocate all phdrs on the stack in elf_from_remote_memory.Mark Wielaard2015-05-272-19/+45
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: Don't stack allocate alternate_name in dwfl_linux_kernel_find_elf.Mark Wielaard2015-05-272-1/+13
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: Minimize stack usage in dwfl_linux_kernel_report_offline.Mark Wielaard2015-05-272-8/+22
| | | | | | | | | | | | | | | | Don't stack allocate module name. Also fixes a latent bug (if the module file didn't have a suffix - which is very unlikely) and an inefficiency. We only need to substitue chars up to the suffix. Signed-off-by: Mark Wielaard <[email protected]>
| * libdw: Fix possibly unbounded stack usage in __libdw_intern_expression.Mark Wielaard2015-05-272-15/+36
| | | | | | | | | | | | | | Create a stack allocated array to hold locs. Allocate locs bigger than the array with malloc and free them when done. Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: Fix unbounded stack usage in find_prelink_address_sync.Mark Wielaard2015-05-272-19/+47
| | | | | | | | | | | | Allocate phdr and shdr unions with malloc, not alloca. Free after use. Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: Fix possible unbounded stack usage in cache_sections.Mark Wielaard2015-05-272-9/+33
| | | | | | | | | | | | | | For modules with lots of sections cache_sections could blow up the stack theoretically. Don't use alloca, but use malloc with explicit free. Signed-off-by: Mark Wielaard <[email protected]>
| * libebl: Don't blow up stack when processing large NT_GNU_ABI_TAG.Mark Wielaard2015-05-272-2/+22
| | | | | | | | | | | | | | Normally an NT_GNU_ABI_TAG is large, just 4 words (16 bytes). Only use stack allocated conversion buf for small (max 16 words) notes. Signed-off-by: Mark Wielaard <[email protected]>
| * libebl: Use static number for array stack allocation in openbackend.Mark Wielaard2015-05-272-2/+13
| | | | | | | | | | | | | | | | | | Help the compiler see we stack allocate a small array. Add assert to check no machine prefix is ever larger than 16. Current maximum number is 7. This prevents gcc warning about possible unbounded stack usage with -Wstack-usage. Signed-off-by: Mark Wielaard <[email protected]>
| * libelf: Fix possible unbounded stack usage in updatefile.Mark Wielaard2015-05-272-3/+26
| | | | | | | | | | | | | | Allocate shdr_data and scns with malloc, not alloca. Free after writing section headers. Signed-off-by: Mark Wielaard <[email protected]>