Commit Graph

2391 Commits

Author SHA1 Message Date
Mark Wielaard a344b8ce0b Update mailinglist subscription info.
Signed-off-by: Mark Wielaard <mark@klomp.org>
2020-03-25 23:25:49 +01:00
Frank Ch. Eigler ea7eb6934b debuginfod-client thinko: non-default progressfn extra output
A previous commit changed the default_progressfn output format
to \rFOOBAR, to be terminated by an \n when the download finished.
The \n terminator was conditional on the wrong thing (env var
setting, rather than actual progressfn setting), so the \n could
be printed even if an app overrode the default.
2020-03-24 21:34:37 -04:00
Frank Ch. Eigler c7316d9ff9 debuginfod-find: Correct error check for -v source combo
Hardcoding argv[2] is wrong in presence of -v option.  Code
immediately following did the correct argv[] indexing already.

Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
2020-03-24 15:01:58 -04:00
Mark Wielaard 7db645ba72 tests: Fix getphdrnum and run-lfs-symbols.sh testcase.
getphdrnum.c didn't include config.h which is why run-lfs-symbols.sh
flagged it for containing bad (non-lfs) symbols.

run-lfs-symbols.sh was still checking the libebl modules, which we
don't create anymore. But it didn't fail the test for non-existing
tests. Add some extra logging and explicitly check files exist.

Signed-off-by: Mark Wielaard <mark@klomp.org>
2020-03-23 23:57:51 +01:00
Mark Wielaard 7982afbc6a tests: Add testcase for elf_getphdrnum with more than 65535 entries.
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Omar Sandoval <osandov@fb.com>
2020-03-23 12:28:50 +01:00
Omar Sandoval ee2dd07f57 libelf: handle PN_XNUM in elf_getphdrnum before shdr 0 is cached
__elf_getphdrnum_rdlock() handles PN_XNUM by getting sh_info from
elf->state.elf{32,64}.scns.data[0].shdr.e{32,64}. However, that is only
a cache that may or may not have been populated by elf_begin() or
elf{32,64}_getshdr(); if it hasn't been cached yet, elf_getphdrnum()
returns 65535 (the value of PN_XNUM) instead. We should explicitly get
the shdr if it isn't cached.

Signed-off-by: Omar Sandoval <osandov@fb.com>
2020-03-23 11:23:24 +01:00
Frank Ch. Eigler 5d67e9d3ea debuginfod client API: add get_url function
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>
2020-03-22 16:46:16 -04:00
Frank Ch. Eigler b40e255683 debuginfod client API: add get/set user_data functions
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>
2020-03-22 16:46:14 -04:00
Matthias Maennich 2092865a7e libelf: {de,}compress: ensure zlib resource cleanup
__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: 272018bba1 ("libelf: Add elf_compress and elf_compress_gnu.")
Signed-off-by: Matthias Maennich <maennich@google.com>
2020-03-20 18:08:10 +01:00
Aaron Merey a5cf9ba6bb debuginfod-client: Update cache_path when the new default path exists
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>
2020-03-04 11:38:05 +01:00
Mark Wielaard 398991cd3f config: Remove rpm, add dpkg as Requires for debuginfod package in spec.
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>
2020-03-04 11:35:38 +01:00
Aaron Merey e939590219 debuginfod-client: default to XDG cache.
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>
2020-02-28 14:21:55 +01:00
Konrad Kleine 4c1de9608b debuginfod: file:// URLs: handle curl resp. code
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>
2020-02-26 21:10:40 +01:00
Frank Ch. Eigler 37d56e9275 debuginfod PR25583: map -R to -Z.rpm
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>
2020-02-25 14:30:45 -05:00
Frank Ch. Eigler 577170fc84 PR25375: fdcache prefetching to reduce repeated archive decompression
Introduce new option --fdcache-prefetch to accelerate repeated
queries from the same debuginfo archive.

Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
2020-02-25 12:05:28 -05:00
Mark Wielaard 8f430df5ee tests: Explicitly unset DEBUGINFOD_URLS.
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>
2020-02-21 13:36:43 +01:00
Aaron Merey 889edd912c PR25365: debuginfod-client: restrict cleanup to client-pattern files
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>
2020-02-19 14:01:33 -05:00
Mark Wielaard c4600ae002 readelf, elflint: Handle PT_GNU_PROPERTY.
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>
2020-02-18 13:20:18 +01:00
Mark Wielaard f4354082ba elflint: Check sh_info for symtab isn't too big.
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>
2020-02-18 13:09:26 +01:00
Konrad Kleine 69660c6a82 debuginfod/doc: Fix typo debuginfo_progressfn_t -> debuginfod_progressfn_t
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>
2020-02-12 09:11:10 -05:00
Frank Ch. Eigler 990955ef0a debuginfod testing: SIGUSR2 vs "groom" metric synch
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>
2020-02-10 14:33:54 -05:00
Frank Ch. Eigler ad09e79132 debuginfod: testsuite for general archive (arch-linux) support
Tested analogously to how RPMs are.

Signed-Off-By: Frank Ch. Eigler <fche@redhat.com>
2020-02-10 11:10:12 -05:00
Eli Schwartz 0245c6ed65 debuginfod arch-linux test binaries
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
2020-02-10 11:10:12 -05:00
Mark Wielaard 499129e77a debuginfod: archive processing: handle -Z EXT=cat with direct fopen
Signed-off-by: Mark Wielaard <mark@klomp.org>
2020-02-10 11:10:12 -05:00
Frank Ch. Eigler 8ef876aa17 debuginfod: generalized archive support
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>
2020-02-10 11:09:49 -05:00
Konrad Kleine b86d781e3e debuginfod.h: fix typo in comment: legnth -> length
Signed-off-by: Konrad Kleine <kkleine@redhat.com>
2020-02-10 11:06:13 -05:00
Mark Wielaard 268e805de0 libdwfl: Fix some GCC10 -Wnull-dereference issues.
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>
2020-02-06 21:29:55 +01:00
Frank Ch. Eigler 9b0fb4440a ChangeLog catchup for two recent commits
Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
2020-02-03 14:21:15 -05:00
Frank Ch. Eigler b260496ced debuginfod test: assert curl & rpm2cpio during test prologue
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>
2020-02-03 14:11:53 -05:00
Frank Ch. Eigler 14d5b412dc PR24393: debuginfod configury: tolerate CXX= configure invocations
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>
2020-02-03 06:29:31 -05:00
Frank Ch. Eigler c406e5d827 debuginfod: diagnostics verbosity tweak
marxin reported "skipping hat= .... empty comp_dir" messages
were too chatty for the journnal.

Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
2020-01-22 15:27:59 -05:00
Frank Ch. Eigler 55b05fded2 empty commit for irker test 2020-01-22 13:22:31 -05:00
Frank Ch. Eigler 0bf657f701 PR25394 cont'd: debuginfod testsuite fix for -USR1 timing
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.
2020-01-20 21:49:07 -05:00
Frank Ch. Eigler c351734f4f PR25394 cont'd: debuginfod timing fix for fts-traversal thread
The new code neglected to set the last_rescan timestamp, leading
to overly frequent rescanning.
2020-01-20 15:38:50 -05:00
Frank Ch. Eigler 09d76c1dd5 PR25394 followup#2: debuginfod casting fixes
Buildbot still reports type warnings in time_t arithmetic.
Explicit (long)er cast pushed as obvious ... or is it? :-)
2020-01-20 15:03:11 -05:00
Frank Ch. Eigler 91b7beaef9 PR25394 followup: debuginfod casting fixes
Buildbot reports type warnings in time_t arithmetic.
Explicit (long) cast pushed as obvious.
2020-01-20 14:46:51 -05:00
Frank Ch. Eigler 34e6701891 PR25394: debuginfod mutex between grooming and scanning
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.
2020-01-19 20:40:00 -05:00
Frank Ch. Eigler c02dfd95e3 PR25415: fix debuginfod SEGV for empty search path list
Prevent triggering undefined behaviour of fts(3), which causes
a SEGV on fedora glibc 2.29.
2020-01-18 15:32:40 -05:00
Mark Wielaard 62e3c37afd nm: Fix nm --external sysv format output.
Partial revert of commit 66f4c37d49.
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>
2020-01-16 23:33:52 +01:00
Mark Wielaard 2319680b33 doc: Fix DEBUGINFOD_PROGRESS description to just mention output on stderr.
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>
2020-01-12 17:14:52 +01:00
Mark Wielaard 287a18452a libasm.h: Don't include libebl.h. Define an opaque Ebl handle.
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>
2020-01-12 17:14:52 +01:00
Frank Ch. Eigler 1d26e8e107 elfutils.spec: typo fix
Removed dangling %endif.

Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
2020-01-12 11:05:21 -05:00
Frank Ch. Eigler ad40dc74cd elfutils.spec: dependency typo fix
Commit da0959cafd introduced a dependency on "debuginfod-client",
whereas it's really "elfutils-debuginfod-client".

Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
2020-01-12 11:01:43 -05:00
Frank Ch. Eigler 1905518e16 debuginfod: extracted-from-archive file cache
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>
2020-01-11 22:41:54 -05:00
Frank Ch. Eigler 05429d7531 debuginfod: print U-A: and X-F-F: request headers
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>
2020-01-11 16:05:46 -05:00
Frank Ch. Eigler 32ed4e6f8e debuginfod: rework threading model for file/archive scanning
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.
2020-01-11 09:47:02 -05:00
Mark Wielaard b8d85ed024 debuginfod: Use DEBUGINFOD_TIMEOUT as seconds to get at least 100K.
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>
2020-01-10 00:12:00 +01:00
Frank Ch. Eigler 288c76775f debuginfod: pass a distro-summary User-Agent request header
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>
2020-01-09 16:14:51 -05:00
Dmitry V. Levin fed3c3ceea Do not install libdebuginfod.pc unless debuginfod is enabled
Fixes: 288f6b199 ("debuginfod 1/2: client side")
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2020-01-08 15:26:13 +01:00
Frank Ch. Eigler 5de5dc7d1b debuginfod server: support .deb/.ddeb archives
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>
2019-12-22 20:54:10 -05:00