summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Changelog updated, test case finished to ensure --regex-groom worksnsanci/p27711Noah2021-07-015-8/+75
| | | | | | Updated man pages and beginning confirming tests. Doc file update
* debuginfod test: fix groom/stale race conditionFrank Ch. Eigler2021-06-162-2/+20
| | | | | | | | | | | | | | | | Additional tracing, and use of "% make check VERBOSE=1" in a .spec file allowed tracking down of this intermittent problem. The race was between a SIGUSR1 or two to a debuginfod server (triggering two traverse/scan phases), followed shortly by a SIGUSR2 (triggering a groom). If those signals were received too close together, the groom phase could be stopped early, and the rm'd files not noticed. New testsuite code adds metric polls after SIGUSR1 & SIGUSR2 to ensure the respective processing phases are complete. It also turns on "set -x" tracing, so as to avoid pulling out quite as much hair next time. "make check VERBOSE=1" is also important for spec files. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod tests: tolerate 000-perm files in cache-copy testFrank Ch. Eigler2021-06-161-1/+3
| | | | | | | | It appears possible for 000-permission files to sneak into the test debuginfod-cache, which cp (or find|cpio) refuse to copy. These files are OK not to copy, so ignore the error and proceed. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod tests: try to generate diagnostics more reliably on errorFrank Ch. Eigler2021-06-152-18/+25
| | | | Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* libdwfl: fix potential NULL pointer dereference when reading link mapOmar Sandoval2021-06-102-1/+5
| | | | | | | | | | | | When read_addrs() was moved into file scope, there was a mistake in converting "buffer" from a closure variable to a parameter: we are checking whether the pointer argument is NULL, not whether the buffer itself is NULL. This causes a NULL pointer dereference when we try to use the NULL buffer later. Fixes: 3bf41d458fb6 ("link_map: Pull read_addrs() into file scope") Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* PR27863: debuginfod optimization for concurrent requestsFrank Ch. Eigler2021-06-094-1/+100
| | | | | | | | | | | | | | | | | | | | | | | | Sometimes, due to configuration error, mishap, or DoS misadventure, a debuginfod server may receive near-concurrent requests for the exact same data from multiple clients. In practically all cases, it is beneficial to the clients, as well as the server, to serialize these requests. This way, debuginfod does not waste CPU in repeatedly & concurrently decompressing large archives or querying upstream servers. Second and later requesters can benefit from the fdcache / client-cache and get their results, probably earlier! This patch adds an "after-you" queueing phase to servicing http-buildid requests, whereby thereads serialize themselves on each query URL being serviced at the moment. Prometheus metrics are added, and the http GET trace line is modified to print the queue+service times separately. Hand-tested on large kernel-debuginfo's, and shows host CPU refusing to multiply in the face of concurrent identical queries. The automated test tries a hundred concurrent curls, at least some of which are slow enough to trigger the "after-you" wait here. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* elflint: fix undefined 'buffer_left' referenceSergei Trofimovich2021-06-072-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Link failure is reproducible on gcc-11.1.0 target: ``` $ autoreconf -i -f $ ./configure --enable-maintainer-mode --disable-debuginfod \ --host=x86_64-pc-linux-gnu \ CFLAGS=-march=znver3 \ CXXFLAGS=-march=znver3 \ LDFLAGS=" " $ make CCLD elflint ld: elflint.o: in function `check_attributes': elflint.c:(.text+0xdcff): undefined reference to `buffer_left' ld: elflint.c:(.text+0xe557): undefined reference to `buffer_left' ``` It happens due to possible external linkage of `buffer_left()`. The change forces local linkage to always use local definition (either inline or out-of-line). Reported-by: Toralf Förster Bug: https://bugs.gentoo.org/794601 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Fixes: e95d1fbb ("elflint: Pull left() in file scope") Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* Prepare for 0.185elfutils-0.185Mark Wielaard2021-05-2211-386/+414
| | | | | | | | Set version to 0.185 Update NEWS and elfutils.spec.in Regenerate po/*.po files Signed-off-by: Mark Wielaard <mark@klomp.org>
* PR27859: correct 404-latch bug in debuginfod client reuseFrank Ch. Eigler2021-05-164-61/+61
| | | | | | | | | | | | | | | | | | | | | PR27701 implemented curl handle reuse in debuginfod_client objects, but with an unexpected bug. Server responses returning an error "latched" because the curl_easy handles for error cases weren't all systematically removed from the curl multi handle. This prevented their proper re-addition the next time. This version of the code simplfies matters by making only the curl curl_multi handle long-lived. This turns out to be enough, because it can maintain a pool of long-lived http/https connections and related data, and lend them out to short-lived curl_easy handles. This mode handles errors or hung downloads even better, because the easy handles don't undergo complex state transitions between reuse. A new test case confirms this correction via the federating debuginfod instance (cleaning caches between subtests to make sure http* is being used and reused). Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* elfcompress: fix exit status in case of an errorDmitry V. Levin2021-05-122-1/+4
| | | | | | | | Exit status of 255 in case of an error is probably not what elfcompress users expect, change it to 1. Reported-by: Vitaly Chikunov <vt@altlinux.org> Fixes: 92acb57eb046 ("elfcompress: New utility.")
* elfcompress: remove redundant assignmentDmitry V. Levin2021-05-122-1/+3
| | | | | | | | | At the point of "Nothing to do" fnew variable has not been assigned after initialization, so it does not have to be reset to NULL. Note that any reset of fnew to NULL has to preceded with free(fnew). Fixes: ed62996defc6 ("elfcompress: Don't rewrite file if no section data needs to be updated.")
* elfcompress: fix exit status regression in case of "Nothing to do"Dmitry V. Levin2021-05-122-0/+5
| | | | | | | | | When elfcompress decides that no section data needs to be updated and therefore the file does not have to be rewritten, it still has to exit with a zero status indicating success. Resolves: https://sourceware.org/bugzilla/show_bug.cgi?id=27856 Fixes: c497478390de ("elfcompress: Replace cleanup() with label")
* Come up with startswith function.Martin Liska2021-05-1233-59/+144
| | | | | | | New function in system.h that returns true if a string has a given prefix, false otherwise. Use it in place of strncmp. Signed-off-by: Martin Liška <mliska@suse.cz>
* elfutils.spec: Add procps as a %check BuildRequires:.Frank Ch. Eigler2021-05-112-1/+6
| | | | | | On Fedora rawhide, we can no longer just assume ps(1) is there. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* Prepare for 0.184elfutils-0.184Mark Wielaard2021-05-1011-2245/+3683
| | | | | | | | Set version to 0.184 Update NEWS and elfutils.spec.in Regenerate po/*.po files Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw: Document and handle DW_FORM_indirect in __libdw_form_val_compute_lenMark Wielaard2021-05-062-1/+10
| | | | | | | | Update the documentation in __libdw_form_val_compute_len for handling DW_FORM_indirect and make sure the indirect form isn't DW_FORM_indirect itself or DW_FORM_implicit_const. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: debuginfod client should cache negative results.Alice Zhang via Elfutils-devel2021-05-065-37/+141
| | | | | | | | | | | | | | | | | | | | | Add debuginfod_config_cache for reading and writing to cache configuration files, make use of the function within debuginfod_clean_cache and debuginfod_query_server. In debuginfod_query_server, create 000-permission file on failed queries. Before querying each BUILDID, if corresponding 000 file detected, compare its stat mtime with parameter from .cache/cache_miss_s. If mtime is fresher, then return ENOENT and exit; otherwise unlink the 000 file and proceed to a new query. tests: add test in run-debuginfod-find.sh test if the 000 file is created on failed query; if querying the same failed BUILDID, whether the query should proceed without going through server; set the cache_miss_s to 0 and query the same buildid, and this time should go through the server. Signed-off-by: Alice Zhang <alizhang@redhat.com>
* PR27571: debuginfod client cache - file permissionsFrank Ch. Eigler2021-05-014-1/+19
| | | | | | Files in the download cache should be read-only. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* PR26125: debuginfod client cache - rmdir harderFrank Ch. Eigler2021-05-014-20/+43
| | | | | | | | | With PR25365, we accidentally lost the ability to rmdir client-cache directories corresponding to buildids. Bring this back, with some attention to a possible race between a client doing cleanup and another client doing lookups at the same time. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* libdw: handle DW_FORM_indirect when reading attributesOmar Sandoval2021-05-018-2/+746
| | | | | | | | | | | | | Whenever we encounter an attribute with DW_FORM_indirect, we need to read its true form from the DIE data. Then, we can continue normally. This adds support to the most obvious places: __libdw_find_attr() and dwarf_getattrs(). There may be more places that need to be updated. I encountered this when inspecting a file that was processed by our BOLT tool: https://github.com/facebookincubator/BOLT. This also adds a couple of test cases using a file generated by that tool. Signed-off-by: Omar Sandoval <osandov@fb.com>
* PR27701: debuginfod client: encourage reused debuginfod_client objectsFrank Ch. Eigler2021-04-307-45/+204
| | | | | | | | | | | | | | | | | Client objects now carry long-lived curl handles for outgoing connections. This makes it more efficient for multiple sequential queries, because the TCP connections and/or TLS state info are kept around awhile, avoiding O(100ms) setup latencies. debuginfod is adjusted to take advantage of this for federation. Other clients should gradually do this too, perhaps including elfutils itself (in the libdwfl->debuginfod_client hooks). A large gdb session with 117 debuginfo downloads was observed to run twice as fast (45s vs. 1m30s wall-clock time), just in nuking this extra setup latency. This was tested via a debuginfod intermediary: it should be even faster once gdb reuses its own debuginfod_client. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* po: update XGETTEXT_OPTIONSDmitry V. Levin2021-04-262-2/+13
| | | | | | | | | | | Recognize sgettext as a macro which is used for translations. Flag _, N_, and sgettext with pass-c-format. The effect of this specification is that xgettext will propagate format string requirements for _, N_, and sgettext calls to their first arguments, and thus mark them as format strings. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* debuginfod: only update database stats once per groomFrank Ch. Eigler2021-04-152-2/+4
| | | | | | | | | On very large servers, each database-stat counting pass can take tens of minutes (!), and doing it twice per groom pass does not seriously improve data quality. Just do it once, after stale data removal & basic sqlite vacuum. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod: Recognize .debug_*-less symtab-laden files as debuginfoFrank Ch. Eigler2021-04-152-0/+24
| | | | | | | Borrow logic from elfclassify for is_debug_only() for our own debuginfo identification. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* nm: Fix file descriptor leak on dwfl_begin failure.Mark Wielaard2021-04-132-0/+6
| | | | | | | If dwfl_begin fails we won't use the dwfl_fd descriptor we just dupped. Make sure to close on dwfl_begin failure to avoid the leak. Signed-off-by: Mark Wielaard <mark@klomp.org>
* unstrip: Fix small leak in handle_output_dir_module.Mark Wielaard2021-04-132-0/+6
| | | | | | | | eu-unstrip might leak a string for each module found when using the -d option. Make sure to free the output_file name when we are done with the module. Signed-off-by: Mark Wielaard <mark@klomp.org>
* ar: Always close newfd in do_oper_insert.Mark Wielaard2021-04-132-0/+7
| | | | | | | | | newfd is normally created by mkstemp given the original fd exists. Otherwise it will created by open from arfname. In the second case newfd might not get closed. Preventd this by always trying to close it after errout. Signed-off-by: Mark Wielaard <mark@klomp.org>
* doc/debuginfod.8: fix wrong parameter name for .deb files in descriptionFrank Ch. Eigler2021-04-041-1/+1
| | | | | | | One place in the description referred to the parameter for .deb/.ddeb files as "-D" as opposed to the correct "-U". Signed-off-by: Andreas Ziegler <andreas.ziegler@fau.de>
* debuginfod: Set child thread names via pthread_setname_np()Frank Ch. Eigler2021-03-306-3/+35
| | | | | | | | | In order to assist problem diagnosis / monitoring, use this gnu-flavoured pthread function to set purpose names to the various child threads debuginfod starts. libmicrohttpd already sets this for its threads. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod-client: Don't compare a double to a longTimm Bäder2021-03-072-2/+7
| | | | | | | | | | | | | | | | Clang warns about this: ../../debuginfod/debuginfod-client.c:899:28: error: implicit conversion from 'long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion] pa = (dl > LONG_MAX ? LONG_MAX : (long)dl); ~ ^~~~~~~~ /usr/lib64/clang/10.0.1/include/limits.h:47:19: note: expanded from macro 'LONG_MAX' ^~~~~~~~~~~~ <built-in>:38:22: note: expanded from here ^~~~~~~~~~~~~~~~~~~~ Modified for jakub's observation about LONG_MAX overflow. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* Update Polish translationPiotr Drąg2021-03-062-581/+798
| | | | | | https://sourceware.org/bugzilla/show_bug.cgi?id=27450 Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
* Update POTFILES.inPiotr Drąg2021-03-062-0/+11
| | | | | | https://sourceware.org/bugzilla/show_bug.cgi?id=27450 Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
* build: Check for -Wno-packed-not-aligned supportTimm Bäder2021-03-064-2/+27
| | | | | | | Clang does not support this warning, so check for compiler support before using it. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* build: Check for -Wtrampolines supportTimm Bäder2021-03-064-2/+27
| | | | | | | Clang does not support -Wtrampolines, so check if the compiler supports it before using it. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* debuginfod-client: Fix typo in curl feature detectionTimm Bäder2021-03-051-1/+1
| | | | | | CURLINFO_CURLINFO_CONTENT_LENGTH_DOWNLOAD_T is one CURLINFO_ too much. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* readelf: Sanity check verneed and verdef offsets in handle_symtab.Mark Wielaard2021-03-032-1/+14
| | | | | | | | | | We are going through vna_next, vn_next and vd_next in a while loop. Make sure that all offsets are sane. We don't want things to wrap around so we go in cycles. https://sourceware.org/bugzilla/show_bug.cgi?id=27501 Signed-off-by: Mark Wielaard <mark@klomp.org>
* elfcompress: Replace cleanup() with labelTimm Bäder2021-03-022-109/+112
| | | | | | | This unifies the error handling with the rest of the code base and gets rid of a nested function. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* build: Check for -Wimplicit-fallthrough=5 separatelyTimm Bäder2021-03-012-0/+16
| | | | | | | | | | | | GCC accepts the =5, which means it doesn't try to parse any comments and only accepts the fallthrough attribute in code. Clang does not ever parse any comments and always wants the fallthrough attribute anyway. Clang also doesn't accept the =n parameter for -Wimplicit-fallthrough. Test for =5 separately and use it if supported and fall back to just -Wimplicit-fallthrough otherwise. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* tests: Pull new_data_buf() into file scope for elfstrmerge.Timm Bäder2021-03-012-15/+23
| | | | | | Get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* tests: Pull newsecndx() info file scope for elfstrmergeTimm Bäder2021-03-012-34/+48
| | | | | | Get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* elfcompress: Pull get_sections() into file scopeTimm Bäder2021-03-012-10/+17
| | | | | | Get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* elfcompress: Pull get_section() into file scopeTimm Bäder2021-03-012-6/+13
| | | | | | Get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* elfcompress: Pull set_section() into file scopeTimm Bäder2021-03-012-7/+15
| | | | | | Get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* unstrip: Remove nested next() functionTimm Bäder2021-03-012-8/+12
| | | | | | | This is a simple one-liner, so inline this into the few callers. Get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* unstrip: Pull warn() into file scopeTimm Bäder2021-03-012-15/+26
| | | | | | Get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* unstrip: Inline find_unalloc_section() into only callerTimm Bäder2021-03-012-26/+27
| | | | | | Get rid of an unnecessary nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* unstrip: Pull check_match() into file scopeTimm Bäder2021-03-012-12/+23
| | | | | | Get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* unstrip: Pull adjust_reloc() into file scopeTimm Bäder2021-03-012-13/+21
| | | | | | Get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* elflint: Pull left() in file scopeTimm Bäder2021-03-012-8/+15
| | | | | | And rename it to buffer_left() to be a bit more descriptive Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* elflint: Pull pos() info file scopeTimm Bäder2021-03-012-19/+26
| | | | | | | Rename it to buffer_pos() to be a bit more descriptive and get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>