summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* debuginfod: Fix concurrent request leading to a same .rpm file [PR29474]users/marxin/try-PR29474-fix-debuginfod-concurrencyMartin Liska2022-08-151-26/+43
| | | | | | | As explained in detail in the PR, the problem happens when multiple requests lead to a single RPM and one of the threads does prefetching. In that case, the requested file is added to fdcache and thus skip as interned.
* readelf: Handle SHT_RISCV_ATTRIBUTES like SHT_GNU_ATTRIBUTESAndreas Schwab2022-08-132-1/+7
| | | | Signed-off-by: Andreas Schwab <schwab@suse.de>
* Fill in fde_augmentation_data_size in dwarf_next_cfiUlrich Drepper2022-08-112-20/+46
| | | | | (dwarf_next_cfi): Don't skip processing the augmentation string. Be more stringent what to accept.
* elflint: Allow zero p_memsz for PT_RISCV_ATTRIBUTESAndreas Schwab2022-08-092-1/+9
| | | | | | The RISCV_ATTRIBUTES segment is not meant to be loaded. Signed-off-by: Andreas Schwab <schwab@suse.de>
* backends: Handle new RISC-V specific definitionsAndreas Schwab2022-08-093-0/+58
| | | | | | Handle PT_RISCV_ATTRIBUTES, SHT_RISCV_ATTRIBUTES, DT_RISCV_VARIANT_CC. Signed-off-by: Andreas Schwab <schwab@suse.de>
* libelf: Sync elf.h from glibcAndreas Schwab2022-08-086-4/+113
| | | | | | | | | | Adds PT_RISCV_ATTRIBUTES, SHT_RISCV_ATTRIBUTES, PT_AARCH64_MEMTAG_MTE, RELR definitions, LoongArch relocations. dwelf_elf_e_machine_string was updated to handle EM_LOONGARCH, and ebl_dynamic_tag_name was updated to handle the new RELR dynamic tags. Signed-off-by: Andreas Schwab <schwab@suse.de>
* lib: Add documentation to explain concurrent htab resizing.Mark Wielaard2022-08-082-6/+28
| | | | | | | Document which lock is held by which thread and how moving the htab data is coordinated. Signed-off-by: Mark Wielaard <mark@klomp.org>
* po: standardize Project-Id-Version to just elfutilsMark Wielaard2022-08-085-6/+13
| | | | | | | | The po/pl.po file already just said Project-Id-Version: elfutils\n Do the same for the other po files which had somewhat odd names. The generated pot file will still include the version number too. Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: run-low_high_pc.sh: drop redundant 'lx' suffixSergei Trofimovich via Elfutils-devel2022-08-082-1/+5
| | | | | | | | | Noticed when debugged test failure: lowpc: 8049000, highpc: 8049000lx ../sysdeps/i386/crti.S: [2def] '_init' highpc <= lowpc Signed-off-by: Sergei Trofimovich <slyich@gmail.com>
* debuginfod: optimize regular expressions in groom()Josef Cejka2022-08-032-3/+13
| | | | | | | Check if applying of -I and -X during grooming is enabled before the regular expressions are matched. Signed-off-by: Josef Cejka <jcejka@suse.de>
* tests: Add initial scan wait_ready in run-debuginfod-percent-escape.shMark Wielaard2022-08-012-2/+7
| | | | | | | | | Otherwise wait_ready for thread_work_total{role="traverse"} after the kill -USR1 can be either zero, one or two. We want to see it change to one first, then after the kill -USR1 it should change to two to be sure the scan happened after the new binary was created. Signed-off-by: Mark Wielaard <mark@klomp.org>
* readelf: memrchr searches backwards but takes the start buf as argumentMark Wielaard2022-08-012-4/+9
| | | | | | The bug (caught by valgrind) was giving memrchr to end of the buffer. Also as cleanup, Use d_val not d_ptr for calculating offset.
* readelf: Support --dynamic with --use-dynamicDi Chen2022-08-017-27/+280
| | | | | | | | | | | | Currently, eu-readelf is using section headers to dump the dynamic segment information (print_dynamic -> handle_dynamic). This patch adds new options to eu-readelf (-D, --use-dynamic) for (-d, --dynamic). https://sourceware.org/bugzilla/show_bug.cgi?id=28873 Signed-off-by: Di Chen <dichen@redhat.com>
* libdwfl: Add new function dwfl_frame_regDi Chen2022-07-3110-29/+66
| | | | | | | | | | | | | | Dwfl has most of the infrastructure to keep the full unwind state, including the state of unwound registers per frame using Dwfl_Thread_Callbacks. But there is no public API to access the state, except for the PC (dwfl_frame_pc). This commit adds a new function dwfl_frame_reg to get the value of the DWARF register number in the given frame. https://sourceware.org/bugzilla/show_bug.cgi?id=28579 Signed-off-by: Di Chen <dichen@redhat.com>
* libdwfl: Rewrite reading of ar_size in elf_begin_randMark Wielaard2022-07-292-10/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With GCC 12.1.1, glibc 2.35, -fsanitize=undefined and -D_FORTIFY_SOURCE=3 we get the following error message: In file included from /usr/include/ar.h:22, from ../libelf/libelfP.h:33, from core-file.c:31: In function ‘pread’, inlined from ‘pread_retry’ at ../lib/system.h:188:21, inlined from ‘elf_begin_rand’ at core-file.c:86:16, inlined from ‘core_file_read_eagerly’ at core-file.c:205:15: /usr/include/bits/unistd.h:74:10: error: ‘__pread_alias’ writing 58 or more bytes into a region of size 10 overflows the destination [-Werror=stringop-overflow=] 74 | return __glibc_fortify (pread, __nbytes, sizeof (char), | ^~~~~~~~~~~~~~~ /usr/include/ar.h: In function ‘core_file_read_eagerly’: /usr/include/ar.h:41:10: note: destination object ‘ar_size’ of size 10 41 | char ar_size[10]; /* File size, in ASCII decimal. */ | ^~~~~~~ /usr/include/bits/unistd.h:50:16: note: in a call to function ‘__pread_alias’ declared with attribute ‘access (write_only, 2, 3)’ 50 | extern ssize_t __REDIRECT (__pread_alias, | ^~~~~~~~~~ cc1: all warnings being treated as errors The warning disappears when dropping either -fsanitize=undefined or when using -D_FORTIFY_SOURCE=2. It looks like a false positive. But I haven't figured out how/why it happens. The code is a little tricky to proof correct though. The ar_size field is a not-zero terminated string ASCII decimal, right-padded with spaces. Which is then converted with strtoll. Relying on the fact that the struct ar_hdr is zero initialized, so there will be a zero byte after the ar_size field. Rewrite the code to just use a zero byte terminated char array. Which is much easier to reason about. As a bonus the error disappears. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: create indexes to speed up groomingJosef Cejka2022-07-292-0/+8
| | | | | | | | | | | | | | | Create indexes on _r_de and _f_de tables to speed up delete operations called by groom() function. Primary keys of those tables are optimalized to search rows by buildids so delete by file and mtime attributes has to scan the whole table. On large database can single delete query take minutes and grooming will be aborted before completion by time limit. New indexes are compatible with current sqlite schema. Signed-off-by: Josef Cejka <jcejka@suse.de>
* dwfl_get_debuginfod_client: add dummy parameter for --disable-libdebuginfodShahab Vahedi2022-07-182-1/+6
| | | | | | | | | | | | | | | | | | | | | Since the stub version of "dwfl_get_debuginfod_client" doesn't name its parameter, building elfuitls fails on a system with gcc 10.2.1: ----------------------------------------------------------------------------- $ ./configure ... --disable-libdebuginfod $ make Making all in libdwfl CC debuginfod-client.o /src/libdwfl/debuginfod-client.c: In function 'dwfl_get_debuginfod_client': /src/libdwfl/debuginfod-client.c:145:29: error: parameter name omitted 145 | dwfl_get_debuginfod_client (Dwfl *) | ^~~~~~ make[2]: *** [Makefile:707: debuginfod-client.o] Error 1 ----------------------------------------------------------------------------- This fixes the issue by providing a name for the unused parameter. Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
* Move dwfl_get_debuginfod_client to ELFUTILS_0.188Mark Wielaard2022-07-136-3/+22
| | | | | | | 0.187 was already released, so add new function to 0.188. Also add NEWS entry and INTUSE. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Introduce public dwfl_get_debuginfod_client APIMilian Wolff2022-07-136-9/+40
| | | | | | | | | | | | | | | | | Dwfl can use debuginfod internally, which was so far totally opaque to the outside. While the functionality is great for users of the dwfl API, the long wait times induced by downloading of data over debuginfod lead to complaints by endusers. To offer them a bit more insight into the internal ongoings, one can now use e.g. `debuginfod_set_progressfn` on the handle returned by `dwfl_get_debuginfod_client` to report download progress. Rename get_client to dwfl_get_debuginfod_client and make it public. Unconditionally compile debuginfod-client.c and stub the new public function and always return NULL when debuginfod integration was disabled. Signed-off-by: Milian Wolff <mail@milianw.de>
* doc/debuginfod.8: tiny obvious typo fixFrank Ch. Eigler2022-06-081-1/+1
| | | | Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* Arm Ehdr flag printingUlrich Drepper2022-06-0612-8/+225
| | | | | | | | | | | | | | | | | | Arm needs to decode flags and I modeled it after the binutils code. The same messages are printed. Given the requirement of the interface and the ABIs the current version of the callback function isn't sufficient unless one wants to create a stateful interface. The problem is that most flags need to be interpreted in the context of the ABI version. So I changed the API to also pass the original flag value. This shouldn't be a problem because there are no users yet. There is also a bug in ebl_machine_flag_name. When copying the string provided by the callback cp is moved past the NUL byte. It should move to the NUL byte. Otherwise one cannot anything but the first added flag description. Finally some cosmetic changes (space after each comma in the output). Signed-off-by: Mark Wielaard <mark@klomp.org>
* NEWS & ChangeLog: add debuginfod blurbsFrank Ch. Eigler2022-06-033-0/+13
| | | | Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod: add --disable-source-scan optionMichael Trapp2022-06-032-1/+14
| | | | | | | | --disable-source-scan disables scanning of the dwarf source info of debuginfo sections. The source info is not required in setups without source code access. Signed-off-by: Michael Trapp <michael.trapp@sap.com>
* PR28577: Make run-debuginfod-fd-prefetch-caches.sh test somethingNoah Sanci2022-06-032-72/+55
| | | | | | | Update to the run-debuginfod-fd-prefetch to make the test more sound. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Added debuginfod.service.8 manual page.Noah Sanci2022-06-022-1/+31
| | | | Signed-off-by: Noah Sanci <nsanci@redhat.com>
* tests: Disable run-debuginfod-federation-metrics.sh for old libmicrohttpdMark Wielaard2022-06-024-1/+17
| | | | | | | | | On really old libmicrohttpd the run-debuginfod-federation-metrics.sh test will crash debuginfod after too many file descriptors have been used. libmicrohttpd looses track of the state and aborts instead of producing an error. Just disable the testcase on these very old versions. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdwfl: Update docs and nonnull attributes for dwfl_module_addrinfoMark Wielaard2022-05-272-16/+21
| | | | | | | | Make clear that both the offset and sym arguments cannot be NULL. https://bugzilla.redhat.com/show_bug.cgi?id=1986555 Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: update mtime of interval_path as early as possibleMark Wielaard2022-05-152-2/+10
| | | | | | | | | | Call utime on interval_path file as soon as the thread is committed to cleanup the cache files. This will prevent other threads trying to also commit to cleaning the cache files. Having multiple threads try to clean the cache simultaniously doesn't improve cleanup speed because the threads will try to delete the files in the same order. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: Remove debuginfod_init_cacheMark Wielaard2022-05-152-52/+15
| | | | | | | | | | | debuginfod_init_cache would create all config files if they didn't exist yet. It always made two stat calls. Then debuginfod_clean_cache would call debuginfod_config_cache which did the same checks and created any missing config files. Just make sure the cache_path directory exists and remove debuginfod_init_cache before calling debuginfod_clean_cache. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: Make sure debuginfod_config_cache always returns valid statMark Wielaard2022-05-152-7/+20
| | | | | | | | | | | If the condig file which value was requested from debuginfod_config_cache didn't exist yet, stat would fail and no valid struct stat would be returned even when the file was correctly created. Fix this by always using O_CREAT to open the file, and reuse that file descriptor to call fstat and for either writing the default value or reading the config file value. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: Always request servname from getnameinfo for conninfo.Mark Wielaard2022-05-152-5/+14
| | | | | | | | | | | When getting the connection info getnameinfo is called getting the hostname and servname except when the sockaddr is a pure ipv6 address. In that last case only hostname is requested. Since servname is stack allocated and not initialized it might contain garbage which is then put in the log. Just always request both hostname and servname with NI_NUMERICHOST | NI_NUMERICSERV. Signed-off-by: Mark Wielaard <mark@klomp.org>
* strip: Add more NULL checkMark Wielaard2022-05-142-2/+15
| | | | | | | | When gelf_getshdr, gelf_getrela, gelf_getrel or gelf_getsymshndx return NULL it is an internal error which we want to report instead of crashing. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw: Add sanity check to store_implicit_valueMark Wielaard2022-05-142-1/+8
| | | | | | | Don't just skip the block length, but check it is equal to the op->number that we are going to use as length. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: Check all curl_easy_setopt callsMark Wielaard2022-05-142-22/+44
| | | | | | | | curl_easy_setup can fail for various reasons. Add a curl_easy_setopt_ck macro to check all curl_easy_setopt calls and provides a human readable error message in verbose mode. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: Check result of curl_easy_getinfo in debuginfod_write_callbackMark Wielaard2022-05-142-2/+8
| | | | | | | This was the only place in debuginfod-client.c where we didn't check the result of curl_easy_getinfo. Just check it to make things consistent. Signed-off-by: Mark Wielaard <mark@klomp.org>
* elfcompress: Add sanity checks to make sure to not override variableMark Wielaard2022-05-142-0/+29
| | | | | | | The process_file code is a little tricky. Add sanity checks to make sure shstrtab_name, shstrtab_newname and symstrents are only set once. Signed-off-by: Mark Wielaard <mark@klomp.org>
* PR28577: run-debuginfod-fd-prefetch-caches.sh now tests somethingNoah Sanci2022-05-131-21/+126
| | | | | | | run-debuginfod-fd-prefetch-caches.sh now tests the maximum fd and mb values of prefetch and fd (least recently used) caches. Signed-off-by: Noah Sanci <nsanci@redhat.com>
* debuginfod: Use MHD_USE_EPOLL for libmicrohttpd version 0.9.51 or higherMark Wielaard2022-05-122-5/+16
| | | | | | | | Also disable MHD_USE_THREAD_PER_CONNECTION when using MHD_USE_EPOLL. https://sourceware.org/bugzilla/show_bug.cgi?id=29123 Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: Try without MHD_USE_DUAL_STACK if MHD_start_daemon failsMark Wielaard2022-05-122-23/+58
| | | | | | | | | | | On a systems that have ipv6 disabled debuginfod doesn't start up anymore because libhttpd MHD_USE_DUAL_STACK only works if it can open an ipv6 socket. If MHD_start_daemon with MHD_USE_DUAL_STACK fails try again without that flag set. https://sourceware.org/bugzilla/show_bug.cgi?id=29122 Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod.8: Tweak wording of fdcache operation & parameters.Frank Ch. Eigler2022-05-092-17/+23
| | | | Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* PR29098: debuginfod - set default prefetch cache size to >0Noah Sanci2022-05-092-0/+11
| | | | | | | | | Added default value to fdcache_prefetch_mds and fdcache_prefetch_fds. Defaults to one half of corresponging fdcache's values. Signed-off-by: Noah Sanci <nsanci@redhat.com> foo
* PR29117: fix fd leak in debuginfod client for cache-miss filesFrank Ch. Eigler2022-05-043-8/+35
| | | | | | | | | Correct a nasty fd leak and a few less nasty leaks in the debuginfod client code. The nasty one impacts long-lived apps such as debuginfod servers. Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* config: Move the 2>/dev/null inside the sh -c '' quotes for profile.csh.Mark Wielaard2022-05-032-1/+5
| | | | | | | | | | | csh/tcsh would warn about "Ambiguous output redirect" if not done inside the sh -c command. Fix-by: наб <nabijaczleweli@nabijaczleweli.xyz> https://bugzilla.redhat.com/show_bug.cgi?id=2080957 Signed-off-by: Mark Wielaard <mark@klomp.org>
* configure: Don't use valgrind and sanitize-undefined for make distcheckMark Wielaard2022-05-032-1/+5
| | | | | | | | | | | | make distcheck would always run with --enable-valgrind and --enable-sanitize-undefined. Assuming the maintainer would run this just before doing a release. But this makes distcheck really, really, really slow. And we have various buildbots now that run various combinations of valgrind, undefined and/or address sanitizer over every commit now. This make make distcheck "fast" again. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Prepare for 0.187elfutils-0.187Mark Wielaard2022-04-2513-2839/+2823
| | | | | | | | | Set version to 0.187 Update NEWS and elfutils.spec.in Set copyright year in configure.ac and printversion. Regenerate po/*.po files. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: ensure X-DEBUGINFOD-SIZE contains file sizeAaron Merey2022-04-252-1/+9
| | | | | | | | | | For archived files X-DEBUGINFOD-SIZE currently contains the size of the archive instead of the size of the uncompressed file. Fix this. Also add testcases to verify X-DEBUGINFOD-SIZE contains uncompressed file sizes. Signed-off-by: Aaron Merey <amerey@redhat.com>
* debuginfod: Use the debuginfod-size response headerAaron Merey2022-04-251-40/+43
| | | | | | | | | | | | | In some cases the content-length header may not be available in order to pass to a progressfn. If content-length isn't available then attempt to get the size of the download from the debuginfod-size header instead. It should be mentioned that if a compressed file (ex. gzip) is being transferred, the actual transfer length will be less than debuginfod-size. In this case debuginfod-size is a best-guess upper bound on the size of the transfer. Signed-off-by: Aaron Merey <amerey@redhat.com>
* debuginfod, libdwfl: Initialize libcurl and dlopen debuginfod-client lazilyMark Wielaard2022-04-255-20/+44
| | | | | | | | | | | | | We used to go out of our way to initialize libcurl early before any other thread/code was running. But this meant that we might pay startup cost, which under FIPS is significant, even for code that never uses libdebuginfod or TLS libcurl connections. Although curl_global_init itself isn't thread-safe we can use pthread_once to make sure we don't race against ourselves. This still means we might race against any application code that might use libcurl. But we can assume they will have called curl_global_init before calling dwfl_begin or debuginfod_begin. Signed-off-by: Mark Wielaard <mark@klomp.org>
* AUTHORS: Use generator script & git mailmapFrank Ch. Eigler2022-04-244-3/+145
| | | | | | We can compute a pretty complete list of contributors. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* libelf: Check for mremap, elf_update needs it for ELF_C_RDWR_MMAPMark Wielaard2022-04-244-1/+14
| | | | | | | | | | | Add a AC_CHECK_FUNCS configure check for mremap. Some systems like KFreeBSD and the Hurd don't have it. Also add a configure warning because without mremap elf_update will often fail when ELF_C_RDWR_MMAP is used. ELF_C_RDWR_MMAP is an elfutils extension to libelf. https://sourceware.org/bugzilla/show_bug.cgi?id=27337 Signed-off-by: Mark Wielaard <mark@klomp.org>