summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Make sure to always build with build-ids.Mark Wielaard2019-12-114-2/+19
| | | | | | | | We really need build-ids for various things. If the system compiler doesn't generate build-ids warn and generate them anyway for both the binaries and the tests. Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Run strip under testrun in run-debuginfod-find.shMark Wielaard2019-12-112-1/+5
| | | | | | | Otherwise strip might run against the system libelf which might be too old or missing. Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Add break to avoid implicit-fallthrough warningMark Wielaard2019-12-112-0/+5
| | | | | | | | For some reason gcc might fail to recognize the assert (0) will never return and emit an implicit-fallthrough warning. Just add a break to silence it. Signed-off-by: Mark Wielaard <mark@klomp.org>
* config: Update elfutils.spec with explicit sub-package requires.Mark Wielaard2019-12-112-9/+15
| | | | | | | | | | | | Consistently require version-release subpackages so that everything is updated together. Technically this isn't always required (it is for elfutils-libelf and elfutils-libs). But this makes things more consistent and prevents multilib version mismatches. Also update a Summary and description to match the current Fedora text. Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Run elfcompress under testrun in run-elfclassify.shMark Wielaard2019-12-112-2/+6
| | | | | | | Otherwise elfcompress might run against the system libelf which might be too old or missing. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: Fix implicit conversion from 'CURLcode' to 'CURLMcode'Mark Wielaard2019-12-092-5/+9
| | | | | | | | | | | | | | GCC10 warns when converting the value of one enum type into another: debuginfod-client.c:530:24: error: implicit conversion from ‘CURLcode’ to ‘CURLMcode’ [-Werror=enum-conversion] 530 | curl_res = curl_easy_getinfo(target_handle, | ^ libcurl has different error code enums. The "easy" interfaces return a CURLcode error. The "multi" interface functions return a CURLMcode. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdwfl: Find and handle compressed vmlinuz image.Mark Wielaard2019-12-092-0/+28
| | | | | | | | | | | | | | | | | Both the dwfl_linux_kernel_find_elf callback and the dwfl_linux_kernel_report_offline reporting function only handled vmlinix images possibly compressed with .gz, .bz2 or .xz extension. They did not find or handle the much more common vmlinuz compressed images. It is not completely clear why we didn't up to now. Support for compressed ELF files was added in 2009 and the code was updated to to try to find the .gz, .bz2 or .xz extension variants in 2011. But not the vmlinuz named variant. Reported-by: Aaron Merey <amerey@redhat.com> Tested-by: Frank Ch. Eigler <fche@redhat.com> Signed-off-by: Mark Wielaard <mark@klomp.org>
* config: Add an explicit Requires elfutils-debuginfod-client for debuginfod.Mark Wielaard2019-11-282-0/+6
| | | | | | | | elfutils-debuginfod depends indirectly already on the client library. Make that explicit so they are always updated in sync. Which isn't technically required, but makes things clearer and simpler on updates. Signed-off-by: Mark Wielaard <mark@klomp.org>
* config: versioned libdebuginfod libraries should not be in -devel package.Mark Wielaard2019-11-272-1/+7
| | | | | | | | | The versioned library (links) should be in the runtime package. The debuginfod-client-devel package should just contain the .so (symlink). This isn't fatal, just sloppy. ldconfig will correct the missing symlinks when it was missing. Signed-off-by: Mark Wielaard <mark@klomp.org>
* elfutils.spec.in: Sync with fedora spec, remove rhel/fedora specifics.elfutils-0.178Mark Wielaard2019-11-262-70/+84
| | | | | | | | | | | | | | This makes the sample elfutils.spec file more like the fedora elfutils.spec but with all fedora and rhel specifics removed. In particular it introduces a new elfutils-libs subpackage and updates the requires accordingly. Other cleanups are removal of Group tags, remove dot at end of Summary tags, add post/postun ldconfig for elfutils-libs and elfutils debuginfod-client subpackages, remove default defattr(-,root,root) for file lists and order binaries by name. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Prepare for 0.178Mark Wielaard2019-11-2610-2436/+2582
| | | | | | | | Set version to 0.178. Update NEWS and elfutils.spec.in. Regenerate po/*.po files. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Fix BUILD_STATIC build and enable gcov for debuginfod.Mark Wielaard2019-11-269-6/+26
| | | | | | | | libdw now always needs -lpthread and -ld even when BUILD_STATIC. BUILD_STATIC is only used when doing a gcov enabled build. Enable gcov coverage also for debuginfod. Signed-off-by: Mark Wielaard <mark@klomp.org>
* elfutils.spec: Add BuildRequires: curlMark Wielaard2019-11-252-0/+5
| | | | | | The run-debuginfod-find.sh now relies on curl to fetch the metrics. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: Tweak groom cycle for memory freeingFrank Ch. Eigler2019-11-252-0/+7
| | | | | | | Use the sqlite3_db_release_memory() call periodically. It should have no effect except hopefully smaller server memory usage. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* tests: Don't sleep in run-debuginfod-find.sh, but wait till ready.Mark Wielaard2019-11-254-26/+94
| | | | | | | | Wait for the debuginfod server to finish and use the metrics to see when a server is ready for the next test instead of sleeping. Also remove DEBUGINFOD_TEST_WEBAPI_SLEEP. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: Add found_{executable,debuginfo,sourcerefs}_total metrics.Mark Wielaard2019-11-242-0/+32
| | | | | | | Keeps metrics of how many executables, debuginfo and sourcerefs were found in total for file and rpm scanners. Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Use 127.0.0.1 in run-debuginfod-find.sh instead of localhost.Mark Wielaard2019-11-232-10/+14
| | | | | | | | The way curl does hostname lookups in multi_curl mode takes a very long time under valgrind. Replace all localhosti hostnames with 127.0.0.1 so no lookups are necessary. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: add client contextMark Wielaard2019-11-2314-110/+317
| | | | | | | | | | Add a mandatory debuginfod_begin()/_end() call pair to manage a client object that represents persistent but non-global state. From libdwfl, dlopen the debuginfod.so client library early on. This hopefully makes sure that the code (and the libcurl.so dependency) is loaded before the program goes into multi-threaded mode. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod 5: add /metrics endpointFrank Ch. Eigler2019-11-235-58/+214
| | | | | | | | This webapi extensions allows admins to hook up debuginfod to a prometheus-compatible monitoring system for general situational statistics. The metrics are simple enough that local curl requests can give a user a sense of what's going on. The metrics are documented as unstable with respect to future versions.
* debuginfod 4: symbolic link traversal modeFrank Ch. Eigler2019-11-225-12/+50
| | | | | | In order to support file/rpm archives that are organized via symlink trees, add an "-L" option to debuginfod, meaning about the same as for find(1) or ls(1): to traverse rather than ignore symlinks.
* debuginfod 3/3: client interruptabilityFrank Ch. Eigler2019-11-2212-148/+326
| | | | | | | | For interactive clients such as gdb, interruptibility is important for usability during longer downloads. This patchset adds a download-progress callback function to the debuginfod client library, with which a caller app can interrupt a download as well as be notified of its quantitative progress.
* debuginfod 2/2: server sideFrank Ch. Eigler2019-11-2231-27/+3446
| | | | | | | | | | Add the server to the debuginfod/ subdirectory. This is a highly multithreaded c++11 program (still buildable on rhel7's gcc 4.8, which is only partly c++11 compliant). Includes an initial suite of tests, man pages, and a sample systemd service. Signed-off-by: Frank Ch. Eigler <fche@redhat.com> Signed-off-by: Aaron Merey <amerey@redhat.com>
* debuginfod 1/2: client sideAaron Merey2019-11-2226-11/+2048
| | | | | | | | | | | | Introduce the debuginfod/ subdirectory, containing the client for a new debuginfo-over-http service, in shared-library and command-line forms. Two functions in libdwfl make calls into the client library to fetch elf/dwarf files by buildid, as a fallback. Instead of normal dynamic linking (thus pulling in a variety of curl dependencies), the libdwfl hooks use dlopen/dlsym. Server & tests coming in patch 2. Signed-off-by: Aaron Merey <amerey@redhat.com> Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* run-large-elf-file.sh: skip if free memory information is not availableAndreas Schwab2019-11-142-2/+7
|
* dwelf_elf_e_machine_string: Clear errno before calling strtolAndreas Schwab2019-11-142-0/+6
| | | | | | | Avoid spurious failure if errno is modified by any other library call in the test. Signed-off-by: Andreas Schwab <schwab@suse.de>
* libdw: Introduce libdw_unalloc to stop Dwarf_Abbrev leaks.Mark Wielaard2019-11-124-1/+43
| | | | | | | | | In the case of reading an invalid abbrev or when reading an abbrev concurrently the Dwarf_Abbrev just created might leak because it isn't needed after all. Introduce libdw_unalloc and libdw_typed_unalloc to unallocate such Dwarf_Abbrevs so they don't leak. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw: Rewrite the memory handler to be more robust.Jonathon Anderson2019-11-085-53/+122
| | | | | | | | Pthread's thread-local variables are highly limited, which makes it difficult to use many Dwarfs. This replaces that with a less efficient (or elegant) but more robust method. Signed-off-by: Jonathon Anderson <jma14@rice.edu>
* Add configure options for Valgrind annotations.Jonathon Anderson2019-11-082-0/+35
| | | | Signed-off-by: Jonathon Anderson <jma14@rice.edu>
* libdw: Add and use a concurrent version of the dynamic-size hash table.Srđan Milaković2019-11-0812-11/+632
| | | | | Signed-off-by: Srđan Milaković <sm108@rice.edu> Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw: Don't free uninitialized Dwarf_Abbrev_Hash's of "fake" CUs.Jonathon Anderson2019-11-023-12/+35
| | | | | | | | | | | fake_{loc,loclists,addr}_cu are Dwarf_CUs that are created separate from all the others, so their contents are minimal and mostly initialized by a calloc. On dwarf_end however, they are freed through the same code path as all the others, so they call DAH_free like all the others. This changes that so that these three are exempt from DAH and split-DWARF matters, and swaps the calloc for a malloc so Memcheck will catch any others. Signed-off-by: Jonathon Anderson <jma14@rice.edu>
* libdwfl: only use thread->unwound for initial frameOmar Sandoval2019-10-293-31/+25
| | | | | | | | | | | thread->unwound is only used for set_initial_registers (via dwfl_thread_state_registers, dwfl_thread_state_register_pc, and a special case in core_set_initial_registers). At that point, thread->unwound is always the initial frame, so there's no need to update it as we unwind the stack. Let's set it to NULL after we do the initial setup. This simplifies the next change. Signed-off-by: Omar Sandoval <osandov@fb.com>
* libdwfl: don't bother freeing frames outside of dwfl_thread_getframesOmar Sandoval2019-10-292-15/+9
| | | | | | | | | dwfl_thread_getframes always frees the state before returning, so dwfl_getthreads and getthread don't need to do it. The only place we allocate the state is from dwfl_thread_getframes and we always free it before returning from that function. Signed-off-by: Omar Sandoval <osandov@fb.com>
* unstrip: Check symbol strings are terminated.Mark Wielaard2019-10-292-1/+8
| | | | | | | | | | | A corrupt ELF file could contain a .strtab section that wasn't properly zero terminated. If so we could add a non-terminated string to the dwelf_strtab functions, which could then crash because they would read past the .strtab section data. https://sourceware.org/bugzilla/show_bug.cgi?id=25069 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libcpu: Fix bounds checks and replace asserts with errors.Mark Wielaard2019-10-263-5/+17
| | | | | | | | | Add a missing bounds check, fix an off-by-one bounds check and replace asserts with error messages. https://sourceware.org/bugzilla/show_bug.cgi?id=25068 Signed-off-by: Mark Wielaard <mark@klomp.org>
* unstrip: Don't try to write extra bogus versym data.Mark Wielaard2019-10-262-1/+6
| | | | | | | | | | | If the sh_entsize of the symver section was bogus (bigger than necessary) then some bogus data would be written out (except that then fails because pwrite would probably fail). Fix that by ignoring the bogus sh_entsize and use the actual symver data size. https://sourceware.org/bugzilla/show_bug.cgi?id=25077 Signed-off-by: Mark Wielaard <mark@klomp.org>
* unstrip: Add sanity check for bogus sh_offset of allocated sections.Mark Wielaard2019-10-262-0/+19
| | | | | | | | | | | | | | unstrip tries to preserve any allocated section offset in an executable or shared library. If the offset is extremely large that would cause the disk to fill up because we will write out a file with lots of padding to put the section contents at that particular offset. Add a sanity check that makes sure we just error out if there is such a bogus offset by checking that no offset is larger than the original ELF file size. https://sourceware.org/bugzilla/show_bug.cgi?id=25083 Signed-off-by: Mark Wielaard <mark@klomp.org>
* unstrip: Add various checks for bad input data.Mark Wielaard2019-10-262-18/+62
| | | | | | | | | | There were various ways to crash eu-unstrip with bad ELF input data. Add various tests against bad data and allocate some structures on the heap instead of on the stack. https://sourceware.org/bugzilla/show_bug.cgi?id=25082 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw: Rewrite the memory handler to be thread-safe.Jonathon Anderson2019-10-246-36/+68
| | | | Signed-off-by: Jonathon Anderson <jma14@rice.edu>
* Add some supporting framework for C11-style atomics.Jonathon Anderson2019-10-225-1/+499
| | | | | | | Uses the stdatomic.h provided by FreeBSD when GCC doesn't (ie. GCC < 4.9) Signed-off-by: Jonathon Anderson <jma14@rice.edu> Signed-off-by: Srđan Milaković <sm108@rice.edu>
* elflint, readelf: enhance error diagnosticsDmitry V. Levin2019-10-043-4/+10
| | | | | | | When an input file cannot be opened, include its name into the error diagnostics. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* readelf: Add --dyn-sym option.Mark Wielaard2019-09-106-3/+40
| | | | | | | | | | | It is already possible to select the symbol table to print by name, using --symbols=SECTION. This allows printing the dynamic symbol table with --symbols=.dynsym. binutils readelf allows printing just the dynamic symbol table by type using --dyn-sym. Add the same option and document it. Also add a testcase to show --symbols=.dynsym and --dyn-sym produce the same output. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libebl: Don't install libebl.a, libebl.h and remove backends from spec.Mark Wielaard2019-09-104-13/+16
| | | | | | | | All archive members from libebl.a are now in libdw.a. We don't generate separate backend shared libraries anymore. So remove them from the elfutils.spec file. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libcpu: Make sure left shifts are done in unsigned context.Mark Wielaard2019-09-072-1/+6
| | | | | | | | | | Use UINT64_C (0) instead of INT64_C (0) to make sure the calculation is done on unsigned values. Otherwise the gcc undefined sanitizer will warn: libcpu/riscv_disasm.c:457:57: runtime error: left shift of negative value -1 Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Add new riscv64 test files to EXTRA_DISTMark Wielaard2019-09-072-1/+8
| | | | Signed-off-by: Mark Wielaard <mark@klomp.org>
* Fix whitespaces in RISC-V disasm codeUlrich Drepper2019-09-071-38/+38
|
* Implement RISC-V disassemblerUlrich Drepper2019-09-0617-1738/+3782
|
* config: Fix spec file, add manpages and new GFDL license.Mark Wielaard2019-08-295-6/+23
| | | | | | | | | Now that we have manpages lets also package them. Rename COPYING to COPYING-GFDL to make it not clash with the top-level COPYING file. Also fix up the spec file so it can be used to create a srpm again. Add eu-stack to the file list. Signed-off-by: Mark Wielaard <mark@klomp.org>
* readelf: Actually dump hex or strings when -p or -x get section number.Mark Wielaard2019-08-294-0/+17
| | | | | | | | The readelf code did parse section numbers, but then failed to actually dump the section found. Fixed by actually calling the dump function (either the hex or string variant). Add testcase for readelf -x num. Signed-off-by: Mark Wielaard <mark@klomp.org>
* nm: Fix latent memory leak in show_symbols.Mark Wielaard2019-08-292-1/+7
| | | | | | | | | | | | If there are just a handful of symbols then memory for them is allocated on the stack, otherwise the memory is malloced. So before freeing the memory we need to check the number of entries to know if the memory was heap allocated or not. But since not all entries might be used we might have decreased the number of entries to the number we will actually show. Remember the original symbol entries to not have a memory leak. Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Use smaller self test files.Mark Wielaard2019-08-292-4/+10
| | | | | | Don't use the largest executables/libraries to reduce the make check time. Signed-off-by: Mark Wielaard <mark@klomp.org>