summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* PR25548: support canonicalized source-path names in debuginfod webapifche/pr25548Frank Ch. Eigler2020-03-2515-13/+227
| | | | | | | | | | | | | Programs are sometimes compiled with source path names containing noise like /./ or // or /foo/../, and these survive into DWARF. This code allows either raw or canonicalized pathnames in the webapi, by letting the client pass things verbatim, and letting the server store/accept both raw and canonicalized path names for source files. Tests included & docs updated. Signed-off-by: Frank Ch. Eigler <fche@redhat.com> Reported-by: Eli Schwartz <eschwartz@archlinux.org> Tested-by: Eli Schwartz <eschwartz@archlinux.org>
* debuginfod client API: add get_url functionFrank Ch. Eigler2020-03-2211-11/+107
| | | | | | | This function lets a client know, during or after a progressfn callback, what the url of the winning outgoing download is/was. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod client API: add get/set user_data functionsFrank Ch. Eigler2020-03-2210-9/+82
| | | | | | | | Add a pair of functions to associate a void* parameter with a client object. Requested by GDB team as a way to pass file names and such user-interface data through to a progressfn callback. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* libelf: {de,}compress: ensure zlib resource cleanupMatthias Maennich2020-03-202-6/+11
| | | | | | | | | | | | | | | __libelf_decompress would only cleanup zlib resources via inflateEnd() in case inflating was successful, but would leak memory if not. Fix this by calling inflateEnd() unconditionally. __libelf_decompress did this all the time already, but called deflateEnd() twice. That is not a (known) issue, but can be cleaned up by ensuring all error paths use 'return deflate_cleanup' and the success path calls deflateEnd() only once. Note, the deflate() needs to return Z_STREAM_END to indicate we are done. Hence change the condition. Fixes: 272018bba1f2 ("libelf: Add elf_compress and elf_compress_gnu.") Signed-off-by: Matthias Maennich <maennich@google.com>
* debuginfod-client: Update cache_path when the new default path existsAaron Merey2020-03-043-9/+19
| | | | | | | | | Update cache_path with the path of the new default directory when this directory already exists. Previously cache_path was updated only when creating the new default directory and would otherwise be set to the old default path. Signed-off-by: Aaron Merey <amerey@redhat.com>
* config: Remove rpm, add dpkg as Requires for debuginfod package in spec.Mark Wielaard2020-03-042-2/+8
| | | | | | | | | We no longer require rpm2cpio to unpack rpms. We do now require dpkg-deb to unpack debs. https://sourceware.org/bugzilla/show_bug.cgi?id=25583 Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod-client: default to XDG cache.Aaron Merey2020-02-286-32/+156
| | | | | | | | | | | | PR25502: debuginfod client should default to XDG cache Location of client cache now defaults to $XDG_CACHE_HOME/debuginfod_client. If XDG_CACHE_HOME is not set then fallback to $HOME/.cache/debuginfod_client. Also maintain backwards compatibility with the previous default path- if $HOME/.debuginfod_client_cache exists, use that instead of the new defaults. Signed-off-by: Aaron Merey <amerey@redhat.com>
* debuginfod: file:// URLs: handle curl resp. codeKonrad Kleine2020-02-264-13/+53
| | | | | | | | | | | | | | When file:// is used for DEBUGINFOD_URLS, then the response code for a successful server query is 0 and not 200. Using file:// can be helpful when you want to test your debuginfod-client integration against a mocked file tree that mimics the HTTP URLs from the debuginfod server. This way you don't have to run the debuginfod server at all. Fixes https://sourceware.org/bugzilla/show_bug.cgi?id=25600 Signed-off-by: Konrad Kleine <kkleine@redhat.com>
* debuginfod PR25583: map -R to -Z.rpmFrank Ch. Eigler2020-02-254-2/+11
| | | | | | | | | | It was reported that libarchive (bsdtar) at least as far back as rhel7 (3.1.2) can natively process RPM files, so there's no need to mediate those accesses through rpm2cpio. There's no noteworthy performance or testing impact. Signed-off-by: Frank Ch. Eigler <fche@redhat.com> Signed-off-by: Mark Wielaard <mark@klomp.org>
* PR25375: fdcache prefetching to reduce repeated archive decompressionFrank Ch. Eigler2020-02-254-30/+113
| | | | | | | Introduce new option --fdcache-prefetch to accelerate repeated queries from the same debuginfo archive. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* tests: Explicitly unset DEBUGINFOD_URLS.Mark Wielaard2020-02-212-0/+7
| | | | | | | | | | If DEBUGINFOD_URLS is set various tests will try to query the debuginfod server which can stall the tests a bit. If other evironment variables like DEBUGINFOD_PROGRESS are set it will make various tests fail because the expected output doesn't match. Tests should PASS without needing a debuginfod server, unless they test (and set) one themselves. Signed-off-by: Mark Wielaard <mark@klomp.org>
* PR25365: debuginfod-client: restrict cleanup to client-pattern filesAaron Merey2020-02-194-1/+34
| | | | | | | | Avoid deleting general files and directories in case a user mis-sets $DEBUGINFOD_CACHE_PATH or accidentally moves a file into the cache. Signed-off-by: Aaron Merey <amerey@redhat.com>
* readelf, elflint: Handle PT_GNU_PROPERTY.Mark Wielaard2020-02-189-3/+169
| | | | | | | | | binutils 2.32 ld emits a new PT_GNU_PROPERTY segment that overlaps with the PT_NOTE segment covering the .note.gnu.property section data. https://sourceware.org/bugzilla/show_bug.cgi?id=25511 Signed-off-by: Mark Wielaard <mark@klomp.org>
* elflint: Check sh_info for symtab isn't too big.Mark Wielaard2020-02-182-0/+8
| | | | | | | | The sh_info field of the symtab says how many symbols are in the section. Make sure at least that many symbols fit in the section. Reported-by: Ulrich Drepper <drepper@redhat.com> Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod/doc: Fix typo debuginfo_progressfn_t -> debuginfod_progressfn_tKonrad Kleine2020-02-121-3/+3
| | | | | | | I've copied the type name for the progress function from the manual and noticed that it didn't compile... Signed-off-by: Konrad Kleine <kkleine@redhat.com>
* debuginfod testing: SIGUSR2 vs "groom" metric synchFrank Ch. Eigler2020-02-101-1/+2
| | | | | | | | | Previous code did not account for a groom job that was already completed at startup, so the SIGUSR2-triggered one may not have completed in time for the test. The shell won the race condition on most buildbot VMs, but a debian builder showed the error of our ways. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod: testsuite for general archive (arch-linux) supportFrank Ch. Eigler2020-02-103-6/+25
| | | | | | Tested analogously to how RPMs are. Signed-Off-By: Frank Ch. Eigler <fche@redhat.com>
* debuginfod arch-linux test binariesEli Schwartz2020-02-105-0/+44
| | | | Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
* debuginfod: archive processing: handle -Z EXT=cat with direct fopenMark Wielaard2020-02-101-10/+37
| | | | Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: generalized archive supportFrank Ch. Eigler2020-02-104-25/+81
| | | | | | | | | Add a '-Z EXT[=CMD]' option to debuginfod, which lets it scan any given extension and run CMD on it to unwrap distro archives. For example, for arch-linux pacman files, -Z '.tar.zst=zstdcat' lets debuginfod grok debug and source content in split-debuginfo files. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod.h: fix typo in comment: legnth -> lengthKonrad Kleine2020-02-101-1/+1
| | | | Signed-off-by: Konrad Kleine <kkleine@redhat.com>
* libdwfl: Fix some GCC10 -Wnull-dereference issues.Mark Wielaard2020-02-062-3/+16
| | | | | | | | | GCC10 on some arches will warn about possible NULL derefences. In the libdwfl linux-kernel-modules.c cases it might be caught already by earlier calls to get_release (). But it is hard to see that will really always happen. So do an explicit NULL check just in case. Signed-off-by: Mark Wielaard <mark@klomp.org>
* ChangeLog catchup for two recent commitsFrank Ch. Eigler2020-02-032-0/+8
| | | | Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod test: assert curl & rpm2cpio during test prologueFrank Ch. Eigler2020-02-031-9/+10
| | | | | | | | On debian & ubuntu hosts, rpm2cpio is not available by default, and heck, curl might not be either. Check for both these programs during tests/run-debuginfod-find.sh startup, else exit-77 (skip). Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* PR24393: debuginfod configury: tolerate CXX= configure invocationsFrank Ch. Eigler2020-02-031-4/+4
| | | | | | | | | Previous code was fragile with respect to this case and needlessly tolerant with non-c++11 compilers. New configury makes more muscular assertion about this, to catch bad $CXX settings or poor language support. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod: diagnostics verbosity tweakFrank Ch. Eigler2020-01-222-1/+7
| | | | | | | marxin reported "skipping hat= .... empty comp_dir" messages were too chatty for the journnal. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* empty commit for irker testFrank Ch. Eigler2020-01-220-0/+0
|
* PR25394 cont'd: debuginfod testsuite fix for -USR1 timingFrank Ch. Eigler2020-01-201-0/+1
| | | | | | If a SIGUSR1 is sent before the initial traversal, it no longer results in an extra traversal. That's a sensible effect. The test case just needs to wait before the kill -USR1.
* PR25394 cont'd: debuginfod timing fix for fts-traversal threadFrank Ch. Eigler2020-01-201-0/+1
| | | | | The new code neglected to set the last_rescan timestamp, leading to overly frequent rescanning.
* PR25394 followup#2: debuginfod casting fixesFrank Ch. Eigler2020-01-201-2/+2
| | | | | Buildbot still reports type warnings in time_t arithmetic. Explicit (long)er cast pushed as obvious ... or is it? :-)
* PR25394 followup: debuginfod casting fixesFrank Ch. Eigler2020-01-201-2/+2
| | | | | Buildbot reports type warnings in time_t arithmetic. Explicit (long) cast pushed as obvious.
* PR25394: debuginfod mutex between grooming and scanningfche/debuginfod-PR25394Frank Ch. Eigler2020-01-194-44/+100
| | | | | | | | | | | | | | | | | | | | Extended the work-queue concept with "idlers" - other threads that block on the work queue until it becomes empty (rather than normal consumers that block on it until it becomes non-empty). Use this facility for the groomer thread to avoid working at the same time as the scanner threads. Use this for the fts traversal thread for similar reasons. One user-visible effect: response to SIGUSR1 and SIGUSR2 will wait until the work queue runs empty, but the man page was unspecific so does not need changing. It's not obvious how to test this with a tests/ dataset so small that scanning takes negligible time, so the former races are very tight. P.S. We also evaluated using sqlite level transactions to isolate the scanner thread groups-of-operations from the groomer. These experiments failed to produce a nominally concurrent debuginfod, having triggered "database locked" type errors. So we remain single-threaded (fully serialized) at the sqlite API level.
* PR25415: fix debuginfod SEGV for empty search path listFrank Ch. Eigler2020-01-184-0/+25
| | | | | Prevent triggering undefined behaviour of fts(3), which causes a SEGV on fedora glibc 2.29.
* nm: Fix nm --external sysv format output.Mark Wielaard2020-01-162-1/+6
| | | | | | | | | | | Partial revert of commit 66f4c37d497bdde040a33f299b12163f044b1bf2. If index zero wasn't a real symbol it has already been filtered out in show_symbols so don't skip it in show_symbols_sysv. https://sourceware.org/bugzilla/show_bug.cgi?id=25227 Reported-by: Enzo Matsumiya <ematsumiya@suse.com> Signed-off-by: Mark Wielaard <mark@klomp.org>
* doc: Fix DEBUGINFOD_PROGRESS description to just mention output on stderr.Mark Wielaard2020-01-122-2/+7
| | | | | | | | An earlier variant of the default progress function could write to any file. Which is still in the documentation. But the actual implementation just uses stderr. Fix the documentation to match. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libasm.h: Don't include libebl.h. Define an opaque Ebl handle.Mark Wielaard2020-01-1213-1/+20
| | | | | | | | | Using libasm isn't really usable without a way to create an Ebl handle. But we don't support libebl.h (and libebl itself). Just define the Ebl handle as an opaque struct. Code that uses it needs to figure out how to instantiate one itself (they cannot in any supportable way...) Signed-off-by: Mark Wielaard <mark@klomp.org>
* elfutils.spec: typo fixFrank Ch. Eigler2020-01-121-1/+0
| | | | | | Removed dangling %endif. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* elfutils.spec: dependency typo fixFrank Ch. Eigler2020-01-122-1/+5
| | | | | | | Commit da0959cafda4 introduced a dependency on "debuginfod-client", whereas it's really "elfutils-debuginfod-client". Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod: extracted-from-archive file cacheFrank Ch. Eigler2020-01-118-15/+277
| | | | | | | | | | | Add a facility to service webapi and dwz/altdebug requests that resolve to archives via a $TMPDIR file cache. This permits instantaneous dwz resolution during -debuginfo rpm scanning, and also instantanous duplicate webapi requests. The cache is limited both in number of entries and in storage space. Heuristics provide serviceable defaults. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod: print U-A: and X-F-F: request headersFrank Ch. Eigler2020-01-112-3/+26
| | | | | | | | | For an incoming webapi request, print two headers that should assist in the administration of a debuginfod service. At fweimer's suggestion, added a bit of filtering so the text is more reliably parseable. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod: rework threading model for file/archive scanningFrank Ch. Eigler2020-01-116-559/+548
| | | | | | | | | | We switch from a thread per supplied PATH, with a semaphore based concurrency control, to a fixed number of worker threads collecting the result of a plain directory traversal being put into a work queue. This allows maximal continuous concurrency, even if the PATH directories are dramatically differently sized. There is no more need to use concurrency-motivated subdirectory wildcards for PATH entries: just a single top level directory will work fast. doc & tests incl.
* debuginfod: Use DEBUGINFOD_TIMEOUT as seconds to get at least 100K.Mark Wielaard2020-01-108-34/+45
| | | | | | | Use just one timeout using CURLOPT_LOW_SPEED_TIME (default 90 seconds) and CURLOPT_LOW_SPEED_LIMIT (100K). Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: pass a distro-summary User-Agent request headerFrank Ch. Eigler2020-01-092-2/+90
| | | | | | | | | | | | It may be useful for a debuginfod server operator to know what kinds of clients make webapi requests. This is mainly as a telemetry/diagnostic (though the data cannot be really trusted). It may also be useful to automate downloading of distro packages to a debuginfod server in the case of an unknown hex buildid. doc/testing not affected as these are diagnostics. Signed-off-by: Frank Ch. Eigler <fche@redhat.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Do not install libdebuginfod.pc unless debuginfod is enabledDmitry V. Levin2020-01-082-1/+9
| | | | | Fixes: 288f6b199 ("debuginfod 1/2: client side") Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* debuginfod server: support .deb/.ddeb archivesFrank Ch. Eigler2019-12-2214-132/+257
| | | | | | | | | Add support for scanning .deb / .ddeb files, enabled with a new command line option "-U". Using a synthetic .deb/.ddeb from a Ubuntu 18 machine, extend the debuginfod testsuite with some .deb processing, if the dpkg-deb binary is installed. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod: usability tweaks, incl. $DEBUGINFOD_PROGRESS client supportFrank Ch. Eigler2019-12-198-40/+117
| | | | | | | | | | This facility allows a default progress-printing function to be installed if the given environment variable is set. Some larger usage experience (systemtap fetching kernels) indicates the default timeout is too short, so forked it into a connection timeout (default short) and a transfer timeout (default unlimited). Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* libdwfl: remove broken coalescing logic in dwfl_report_segmentOmar Sandoval2019-12-188-45/+118
| | | | | | | | | | | | dwfl_report_segment has some logic that detects when a segment is contiguous with the previously reported segment, in which case it's supposed to coalesce them. However, in this case, it actually returns without updating the segment array at all. As far as I can tell, this has always been broken. It appears that no one uses the coalescing logic anyways, as they pass IDENT as NULL. Let's just get rid of the logic and add a test case. Signed-off-by: Omar Sandoval <osandov@fb.com>
* libcpu: Compile i386_lex.c with -Wno-implicit-fallthroughOmar Sandoval2019-12-122-1/+6
| | | | | | | | elfutils is compiled with -Wimplicit-fallthrough=5, so the fallthrough comment in i386_lex.c (generated by flex) doesn't prevent the implicit fallthrough warning. Add -Wno-implicit-fallthrough to i386_lex_CFLAGS. Signed-off-by: Omar Sandoval <osandov@fb.com>
* configure: Fix -D_FORTIFY_SOURCE=2 check when CFLAGS contains -Wno-errorOmar Sandoval2019-12-122-1/+6
| | | | | | | | | | | | | | If CFLAGS contains -Wno-error, then the check for -D_FORTIFY_SOURCE=2 won't fail when appropriate. E.g., compiling with: ./configure CFLAGS='-Wno-error -O0' && Results in a flood of "_FORTIFY_SOURCE requires compiling with optimization (-O)" warnings. Make sure we add -Werror after the user-defined CFLAGS. Signed-off-by: Omar Sandoval <osandov@fb.com>
* debuginfod: Check the DEBUGINFOD_URLS environment variable early in client.Mark Wielaard2019-12-112-9/+16
| | | | | | | | | | | | | | | | | | If the debuginfod-client isn't configured we should do as little as possible. Simply return early with ENOSYS if no servers are configured. This means we won't check This does change the behavior of the debuginfod_find calls slightly. Previously we would setup and check the cache if the given build-id was valid. Which might have provided a result if an earlier client had run with the same cache and valid server URLs which knew about that particular build-id. Now we don't return any cached results unless at least one server is configured. This prevents selinux errors when the library is used in a confined setup. Signed-off-by: Mark Wielaard <mark@klomp.org>