summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* PR29472: debuginfod metadata query reworkusers/fche/try-pr29472bFrank Ch. Eigler2023-04-072-0/+15
| | | | | | | Generalize lookup to "file" vs "glob" modes, propagate through API. Add server side timeout for metadata query ops. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod-client.c: Don't treat 0 as an error code.Aaron Merey2023-04-072-2/+7
| | | | | | | Replace 'fd > 0' with 'fd >= 0' to avoid treating a possible file descriptor as an error code. Signed-off-by: Aaron Merey <amerey@redhat.com>
* debuginfod_find_section: Always update rc with most recent error codeAaron Merey2023-04-072-1/+10
| | | | | | | | | debuginfod_find_section may attempt to download both the debuginfo and executable matching the given build-id. If neither of these files can be found, update rc to ensure that we always return an accurate error code in this case. Signed-off-by: Aaron Merey <amerey@redhat.com>
* readelf: Check gelf_getdyn doesn't return NULLMark Wielaard2023-04-072-1/+6
| | | | Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw: Don't dereference and assign values we are skippingMark Wielaard2023-04-072-1/+6
| | | | | | | We don't use the FDE address encoding byte, so no reason to read and store it. Just skip past it. Signed-off-by: Mark Wielaard <mark@klomp.org>
* readelf: Check phdr != NULL or shdr != NULL in handle_dynamic.Mark Wielaard2023-04-072-5/+10
| | | | | | | | | The compiler doesn't know that when use_dynamic_segment is true, then phdr should/will be non-NULL and otherwise shdr is non-NULL. Add explicit checks to help the compiler out and in case an error is made calling the handle_dynamic function. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: Mark extract_section function staticMark Wielaard2023-04-072-1/+5
| | | | | | | The extract_section function in debuginfod-client.c is an internal function and should not be exported. Mark it as static. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Prepare for 0.188Mark Wielaard2023-04-0711-5937/+6189
| | | | | | | | Set version to 0.188 Update elfutils.spec.in Regenerate po/*.po files Signed-off-by: Mark Wielaard <mark@klomp.org>
* Changelog: Update entries from previous commits.Aaron Merey2023-04-072-0/+9
| | | | | | Update Changelogs with details from commits 04b1a3aa and 054b3bde9. Signed-off-by: Aaron Merey <amerey@redhat.com>
* run-debuginfod-section.sh: Avoid zstd-compressed rpmsAaron Merey2023-04-071-1/+1
| | | | | | | Only test using rpms without zstd compression. Older versions of libarchive may fail to handle these. Signed-off-by: Aaron Merey <amerey@redhat.com>
* debuginfod-client: Fix out-of-bounds writeAaron Merey2023-04-071-2/+1
| | | | | | | Return early from path_escape when '\0' is seen in order to prevent an out-of-bounds write to the dest buffer. Signed-off-by: Aaron Merey <amerey@redhat.com>
* debuginfod: Support queries for ELF/DWARF sectionsAaron Merey2023-04-0721-299/+1307
| | | | | | | | | | | | | | | | | | | | | | Add new function debuginfod_find_section which queries debuginfod servers for the raw binary contents of the specified ELF/DWARF section in a file matching the given build-id. Extend the server webapi to support section queries. Section query URLS have the following format: /buildid/BUILDID/section/SECTION The server will attempt to extract the section from a debuginfo file matching the given build-id. If the debuginfo file cannot be found or the section has type SHT_NOBITS, the server will attempt to extract the section from the executable file matching the build-id. If the server is built without section query support, the client will attempt to download the debuginfo matching the build-id and extract the section. If the debuginfo file cannot be found or the section has type SHT_NOBITS, the server will attempt to download the executable file matching the build-id and extract the section. Signed-off-by: Aaron Merey <amerey@redhat.com>
* PR29472: debuginfod metadata query reworkusers/fche/try-pr29472Frank Ch. Eigler2022-10-319-141/+228
| | | | | | | Generalize lookup to "file" vs "glob" modes, propagate through API. Add server side timeout for metadata query ops. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* Added metadata query of debuginfod serversFrank Ch. Eigler2022-10-3116-334/+960
| | | | | | | Debuginfod servers can be queried by source path and will return JSON arrays of all the known metadata. Signed-off-by: Ryan Goldberg <rgoldber@redhat.com>
* Rename 'hello{2,3}.spec.' -> 'hello{2,3}.specfile'Yonggang Luo2022-10-318-5/+23
| | | | | | | | | | | These filenames are invalid on win32. We don't want to include multiple .spec files for make rpm. rpmbuild --sign is not supported anymore. Also include hello3.specfile in EXTRA_DIST. Escape some macros in the elfutils.spec.in file comments. Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Signed-off-by: Mark Wielaard <mark@klomp.org>
* readelf: add binutils-style --syms optionArsen Arsenović2022-10-306-1/+23
| | | | | | This helps people with a lot of built up muscle memory :) Signed-off-by: Arsen Arsenović <arsen@aarsen.me>
* libelf: Sync elf.h from glibcMark Wielaard2022-10-292-5/+17
| | | | | | Adds ELFCOMPRESS_ZSTD, NT_S390_PV_CPU_DATA and NT_LOONGARCH_*. Signed-off-by: Mark Wielaard <mark@klomp.org>
* lib{asm,cpu,dw,dwfl,dwelf}: Move platform depended include into system.hYonggang Luo2022-10-2837-51/+55
| | | | Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* debuginfod-client: Add DEBUGINFOD_HEADERS_FILE.Daniel Thornburgh2022-10-287-3/+74
| | | | | | | | This DEBUGINFOD_HEADERS_FILE environment variable names a file to supply HTTP headers to outgoing requests. Notably, this allows for Authorization headers to be added from a file under OS access control. Signed-off-by: Daniel Thornburgh <dthorn@google.com>
* configure.ac: Update AC_PROG_CC and AC_PROG_LEX for autoconf 2.70Mark Wielaard2022-10-272-2/+7
| | | | | | | | | With autoconf 2.70 we must use AC_PROG_CC (which will check for c11 and c99), for earlier versions we'll use AC_PROG_CC_C99. Also use AC_PROG_LEX([noyywrap]), the extra argument is ignored with earlier versions, but required for 2.70. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Use grep -E instead of egrep, use grep -F instead of fgrep.Mark Wielaard2022-10-2710-11/+26
| | | | | | | GNU grep 3.8 gives a deprecation warning when using egrep or fgrep. Just use grep -E and grep -F. Signed-off-by: Mark Wielaard <mark@klomp.org>
* config: Add BuildRequires socat for run-debuginfod-response-headers.shMark Wielaard2022-10-272-0/+6
| | | | Signed-off-by: Mark Wielaard <mark@klomp.org>
* readelf: Handle DW_LLE_GNU_view_pairMark Wielaard2022-10-274-1/+27
| | | | | | | | DW_LLE_GNU_view_pair is used by gcc -gvariable-location-views=incompat5. As described in http://www.fsfla.org/~lxoliva/papers/sfn/dwarf6-sfn-lvu.txt and proposed for DWARF6 https://dwarfstd.org/ShowIssue.php?issue=170427.1 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw: Use #include <system.h> instead of <endian.h> in memory-access.hYonggang Luo2022-10-272-2/+6
| | | | Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* libelf/libdwfl: Remove LIB_SYSTEM_H define in lib{elf,dwfl}_crc32.cYonggang Luo2022-10-274-2/+8
| | | | | | | | | | | | | rationale: https://sourceware.org/bugzilla/show_bug.cgi?id=21001 If we don't remove this macro, when try #include <system.h> in libdw/memory-access.h wont' take effect because "#define LIB_SYSTEM_H 1" The compile error: ./../libdw/memory-access.h:390:12: error: implicit declaration of function ‘bswap_32’ [-Werror=implicit-function-declaration] Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* libebl: Don't #include <dlfcn.h> in eblclosebackend.c and eblopenbackend.cYonggang Luo2022-10-273-2/+5
| | | | | | | It's not accessed symbols in dlfcn.h in eblclosebackend.c and eblopenbackend.c Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* debuginfod: report libmicrohttpd version on startupFrank Ch. Eigler2022-10-172-0/+6
| | | | | | To assist troubleshooting with intermittent bugs. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* Strip __ prefix from __BYTE_ORDER __LITTLE_ENDIAN and __BIG_ENDIANYonggang Luo2022-10-1717-31/+59
| | | | | | | | __BYTE_ORDER, __LITTLE_ENDIAN and __BIG_ENDIAN are defined by the gcc/clang preprocessor. BYTE_ORDER, LITTLE_ENDIAN and BIG_ENDIAN are defined in <endian.h>. Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* Move the #include <libintl.h> into eu-config.hYonggang Luo2022-10-1632-31/+1
| | | | | | | | | | So we do not need include in each file. And indeed the macro #define _(Str) dgettext ("elfutils", Str) access libintl function dgettext, so it's make more sense #include <libintl.h> in file eu-config.h Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* move platform depended include into system.h of libelfYonggang Luo2022-10-1624-43/+43
| | | | | | | | All of these files either #include <system.h> directly or #include "libelfP.h" And now "libelfP.h also #include <system.h>, so the platform depended include can be moved to system.h safely Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* tests: include config.h first.Mark Wielaard2022-10-162-1/+6
| | | | | | | Otherwise some symbols (lseek, open) might not get the 64bit offset variants because they don't pick up _FILE_OFFSET_BITS. Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Check lseek, read and malloc results with correct types in test.Mark Wielaard2022-10-162-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | When compiling dwfl-report-offline-memory.c on some systems (latest gcc/glibc and --enable-sanitize-undefined) we might get: In file included from /usr/include/features.h:490, from /usr/include/assert.h:35, from dwfl-report-offline-memory.c:18: In function ‘read’, inlined from ‘main’ at dwfl-report-offline-memory.c:68:23: /usr/include/bits/unistd.h:38:10: error: ‘__read_alias’ specified size 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=] 38 | return __glibc_fortify (read, __nbytes, sizeof (char), | ^~~~~~~~~~~~~~~ /usr/include/bits/unistd.h: In function ‘main’: /usr/include/bits/unistd.h:26:16: note: in a call to function ‘__read_alias’ declared with attribute ‘access (write_only, 2, 3)’ 26 | extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf, | ^~~~~~~~~~ cc1: all warnings being treated as errors make[2]: *** [Makefile:2461: dwfl-report-offline-memory.o] Error 1 Fix by using the correct types and checking all return values. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdwfl: add dwfl_report_offline_memoryAleksei Vetrov2022-10-1613-4/+221
| | | | | | | | | | | | | This method allows to read and report ELF from memory instead of opening a file. That way arbitrary memory can be worked with, e.g. when coming from a stream without the need to persist. Another useful application is for fuzzing, because fuzzers might be able to track accesses to the memory and change the fuzzer input to cover more edge cases through more targeted input. Hence, add a new function along with a test case. Signed-off-by: Aleksei Vetrov <vvvvvv@google.com>
* tests: Add libeu to tests needing error() APIKhem Raj2022-10-132-30/+34
| | | | | | | | A local error() implementation is used when libc does not provide it, therefore link in libeu.a which contains this function in tests needing error() API Signed-off-by: Khem Raj <raj.khem@gmail.com>
* debuginfod-client: Ensure only negative error codes returned.Aaron Merey2022-09-282-2/+7
| | | | | Switch a couple error codes from positive to negative so they aren't interpreted as file descriptors by the caller.
* Retrive 64bit timestamp from curl_easy_getinfo on _TIME_BITS=64 environment河辺 岳人2022-09-272-0/+9
| | | | | | | | | | | | | | | | | | | | | On 32bit system compiled with -D_TIME_BITS=64, following tests failed: FAIL: run-debuginfod-archive-test.sh FAIL: run-debuginfod-archive-groom.sh FAIL: run-debuginfod-archive-rename.sh FAIL: run-debuginfod-federation-sqlite.sh FAIL: run-debuginfod-federation-metrics.sh FAIL: run-debuginfod-federation-link.sh due to tests/debuginfod-subr.sh:archive_test failing on "test $fileame -ot `pwd`", with LHS file having a bogus timestamp. LHS is generated by debuginfo-find as a cache file. I'm not sure the fix is the correct way, but since -D_TIME_BITS=64 mandates -D_FILE_OFFSET_BITS=64 in glibc, this does work on glibc environment. Signed-off-by: Taketo Kabe <kabe@sra-tohoku.co.jp>
* ar: Correct -N COUNT off-by-oneMark Wielaard2022-09-145-2/+81
| | | | | | | | | | | | | When using instance [COUNT], the instance check is wrong. instance-- == 0 should be --instance == 0. Add a testcase run-ar-N.sh that uses -N COUNT with extract and delete operations checking the right instance was extracted and deleted. https://sourceware.org/bugzilla/show_bug.cgi?id=28725 Reported-by: panxiaohe <panxh_ran@163.com> Signed-off-by: Mark Wielaard <mark@klomp.org>
* libelf: Correctly decode ar_mode as octal stringMark Wielaard2022-09-142-2/+28
| | | | | | | | | ar_mode is encoded as an octal ascii string, not decimal. Add a new OCT_FIELD macro to decode it. https://sourceware.org/bugzilla/show_bug.cgi?id=28729 Signed-off-by: Mark Wielaard <mark@klomp.org>
* PR28284 cont'd, ->winning_headers reset at start of new queryFrank Ch. Eigler2022-09-082-1/+8
| | | | | | | Mark noted we need to ditch the last client ->winning_headers along with the last ->url. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* add debuginfod_get_headers if DUMMY_LIBDEBUGINFOD is usedMartin Liska2022-09-082-0/+6
| | | | Signed-off-by: Martin Liska <mliska@suse.cz>
* PR28284: add tweaks on previous debuginfod x-debuginfod* header forwarding workFrank Ch. Eigler2022-09-0711-65/+96
| | | | | | | | Embrace case-independent headers, more fully document, handle HTTP \r. In addition to test case, hand-tested against fedora debuginfod instances, running federated servers under valgrind. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* PR28284 - Debuginfod header functionality implementedNoah Sanci2022-09-0611-8/+122
| | | | | | | | Debuginfod and debuginfod clients are now equipped to send and receive http headers prefixed with X-DEBUGINFOD and print them in verbose mode for more context Signed-off-by: Noah Sanci <nsanci@redhat.com>
* debuginfod: Use auto-sized connection pool when -C is not given with argAaron Merey2022-09-054-18/+25
| | | | | | | | | | | | | | | | | | Since commit 4b42d9ad, libmicrohttpd's epoll event loop is used when available in which case we must disable its setting for spawning a thread per request. This contradicts the debuginfod doc's description of '-C', which indicates that if this command line option is not given then the thread pool size is unbounded. Fix this by using an auto-sized thread pool when '-C' is not given, just as we do when it's given with no argument. Update the doc's description of '-C'. Also use a fixed-size pool even if epoll is not supported. The unbounded pool config cannot be considered entirely reliable as it appears to cause random fails in the run-debuginfod-webapi-concurrency test. Signed-off-by: Aaron Merey <amerey@redhat.com>
* Add missing changelog entries.Martin Liska2022-08-172-0/+20
|
* config/debuginfod.sysconfig: Clarify & classify the variablesFrank Ch. Eigler2022-08-172-4/+18
| | | | | | | Some of them are for debuginfod command line; others are environment variables for the embedded client library. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* Add new debuginfod.sysconfig value DEBUGINFOD_EXTRA_ARGSMartin Liska2022-08-172-2/+3
| | | | | | | Split DEBUGINFOD_PATHS and put non-path arguments to the newly created variable called DEBUGINFOD_EXTRA_ARGS. Signed-off-by: Martin Liska <mliska@suse.cz>
* debuginfod: fix http_requests_total{type="debuginfo"} when dwz is usedMartin Liska2022-08-171-2/+4
| | | | | | | | When dwarf_extract_source_paths is called, it can call handle_buildid when a rpm file used dwz. Ignore such internal request in http_requests_total statistics. Signed-off-by: Martin Liska <mliska@suse.cz>
* debuginfod: print filename for "cannot open archive" errorMartin Liska2022-08-171-2/+8
| | | | | | Report the file that has such a problem so that one can inspect it. Signed-off-by: Martin Liska <mliska@suse.cz>
* Support nullglob in profile.*.in filesMartin Liska2022-08-162-2/+2
| | | | | | | | | | | | In openSUSE we have the following RPM checker that uses shopt -s nullglob: https://github.com/openSUSE/post-build-checks/blob/master/checks/50-check-libtool-deps#L31 The script loads all /etc/profile.d/*.sh files via source $FILE which can end up by stuck cat (with no arguments): shopt -s nullglob ; cat "/etc/debuginfod"/*.urls (stuck)
* PR29474: debuginfodFrank Ch. Eigler2022-08-152-1/+8
| | | | | | | | | | | | | | | | | | | | | | | Previous code sometimes confused debuginfod with concurrent queries targeting the same RPM. One thread fetching & prefetching, the other thread misinterpreted the sudden presence of its target file in the fdcache as a mere unnecessary prefetch duplicate. But if it was the other thread's target file, previous code would -skip- it completely, resulting in a 404 error. New code allows the other thread to also decompress the target file and return it, and still continue to its own prefetching process for other files. There's a performance trade-off here. Another option would be for the other thread to check the fdcache regularly and abort its own prefetch/fetch/prefetch loop early in case of a sudden target file hit. That'd save CPU probably but it'd stop prefetching of later segments of the input archive, which could save future time. Automated testing is too time/load sensitive to attempt. Confirmed working with Martin's stress tester. Reported-By: Martin Liška <mliska@suse.cz> Signed-Off-By: Frank Ch. Eigler <fche@redhat.com>