summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* debuginfod: filter webapi for bad keywords earlyFrank Ch. Eigler2021-02-254-1/+14
| | | | | | | Prevent some unnecessary processing of user data and keep invalid request types out of metrics. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* testsuite: run-debuginfod-find.sh: Fix grooming test indeterminacyFrank Ch. Eigler2021-02-172-8/+10
| | | | | | | | | We were looking at a less-than-ideal metric to check the effects of grooming on the database. It turns out there is a counter just for removed files/archives, which will have the same value regardless of the presence of other test configurations. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* NEWS: add a debuginfod blurb re. bsdtarFrank Ch. Eigler2021-02-171-0/+4
| | | | Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* testsuite: run-debuginfod-find.sh: Be more verbose on failureFrank Ch. Eigler2021-02-172-15/+22
| | | | | | | To help diagnose timing glitches in debuginfod testing, print more diagnostics on a metric-timeout failure. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* readelf: Type DIE offset is from start of CU.Mark Wielaard2021-02-174-2/+11
| | | | | | | | | While inspecting some type units I noticed the type offset seemed off. We were printing the offset as is, but it should include the offset of the unit. There was actually a testcase for this, run-readelf-types.sh but that had the same bug in the expected output. Fixed both. Signed-off-by: Mark Wielaard <mark@klomp.org>
* readelf, libdw: blocks aren't expressions for DWARF version 4Mark Wielaard2021-02-174-1/+31
| | | | | | | | For DWARF version 4 or higher a block form really encodes a block, not an expression location. Also constant offsets can be expressed as DW_FORM_implicit_const in DWARF version 5. Signed-off-by: Mark Wielaard <mark@klomp.org>
* PR27413: use bsdtar to unpack deb-related formatsFrank Ch. Eigler2021-02-172-10/+8
| | | | | | | | | | | | | | | | dpkg-deb has been reported to be fragile when running under debuginfod, whereas bsdtar (libarchive) is happy with all these flavors of files. Switch to a bsdtar based pipeline, now equipped with an escaped glob pattern that adapts to a variety of interior data.tar* compression formats. No testsuite impact. .ipk format tested with some random openwrt and kino-extension binaries found on the net. Some of these are built with out buildid, and hardly any with debuginfo, but whatever, bsdtar and elfutils extract whatever info is there. Signed-off-by: Frank Ch. Eigler <fche@redhat.com> Signed-off-by: Dorinda Bassey <dorindabassey@gmail.com>
* tests: Quote make variables in TESTS_ENVIRONMENTAlexander Miller via Elfutils-devel2021-02-122-14/+20
| | | | | | | | | | | | | | Commit eb922a1b8f3a ("tests: use ${CC} instead of 'gcc' in tests") exports ${CC} into the test environment, but doesn't quote the value for the assignment. That doesn't work properly if the value contains whitespace. In a multilib/biarch environment however, it's common to set CC="gcc -m32" or similar. That causes tests to print error messages: "/bin/sh: line 2: -m32: command not found". Fix that by adding quotes around all make variables (not just $CC) used in setting up TESTS_ENVIRONMENT. Signed-off-by: Alexander Miller <alex.miller@gmx.de>
* elfutils.spec.in: Escape %%check in comment.Mark Wielaard2021-02-122-1/+5
| | | | Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests/run-debuginfod-find.sh: skip test if cpio isn't available.Érico Rolim2021-02-082-0/+5
| | | | Signed-off-by: Érico Rolim <erico.erc@gmail.com>
* NEWS: add one more debuginfod bragelfutils-0.183Frank Ch. Eigler2021-02-051-0/+1
| | | | Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* Prepare for 0.183Mark Wielaard2021-02-0513-3607/+3668
| | | | | | | | | Set version to 0.183 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>
* backends/ppc_initreg.c: include <asm/ptrace.h>.Érico Rolim2021-02-052-0/+5
| | | | | | | Necessary on musl for struct pt_regs definition, doesn't affect the build on glibc, since <sys/user.h> includes the same header. Signed-off-by: Érico Rolim <erico.erc@gmail.com>
* ar: Pull should_truncate_fname() into file scopeTimm Bäder2021-02-052-17/+24
| | | | | | Get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* PR27092: debuginfod low-memory handlingFrank Ch. Eigler2021-02-056-35/+119
| | | | | | | | | | | | | | | | | | | | | | A couple of closely related pieces of work allow more early warning about low storage/memory conditions: - New prometheus metrics to track filesystem freespace, and more details about some errors. - Frequent checking of $TMPDIR freespace, to trigger fdcache emergency flushes. - Switch to floating point prometheus metrics, to communicate fractions - and short time intervals - accurately. - Fix startup-time pthread-creation error handling. Testing is smoke-test-level only as it is hard to create free-space-limited $TMPDIRs. Locally tested against tiny through medium tmpfs filesystems, with or without sqlite db also there. Shows a pleasant stream of diagnostics and metrics during shortage but generally does not fail outright. However, catching an actual libstdc++- or kernel-level OOM is beyond our ken. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* PR27323 debuginfod: improve query concurrency with groomingFrank Ch. Eigler2021-02-052-37/+93
| | | | | | | | | | | | | | | | | | | | | Start using a second sqlite3 database connection for webapi query servicing. This allows much better concurrency when long-running grooming operations are in progress. No testsuite impact. Grooming times are too short to try to hit with concurrent requests. OTOH the existing tests did show some interesting regressions that needed fixing, like needing not to dual-wield db and dbq when doing rpm-dwz-related lookups from during scanning, and the way in which corrupted databases are reported. These needed some automated invocations of gdb on the running debuginfod binaries that just failed their testing, for in-situ debugging. Hand-tested for function on a huge 20GB index file. Allowed webapi queries to be run throughout random points of the grooming process, including especially the long count(*) report loops before & after. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* readelf: Remove show_op_index variableTimm Bäder2021-02-052-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | advance_pc() uses show_op_index to save whether the current op_index is > 0 OR the new op_index is > 0. The new op index is calculated via new_op_index = (op_index + op_advance) % max_ops_per_instr; since all of the variables involved are unsigned, new_op_index >= op_index is always true. So... if op_index > 0, then new_op_index > 0 if op_index == 0, then new_op_index >= 0 and if the new_op_index is > 0, then the old one was as well. In any case, we only need to check the new_op_index, since show_op_index used to OR the two comparisons. In other words: op_index > 0 | new_op_index > 0 || show_op_index ------------------------------------------------ true true true false true true true false true xx false false false ... but since the third line (marked with xx) is not possible, the table becomes: op_index > 0 | new_op_index > 0 || show_op_index ------------------------------------------------ true true true false true true false false false ... and show_op_index is equal to (new_op_index > 0). So, remove the show_op_index variable and simply replace it by comparing the new op_index > 0.
* libdwfl: use GNU strerror_r only when available.Érico Rolim2021-02-054-1/+29
| | | | | | | | | | Some C libraries don't provide the GNU version of strerror_r, only the XSI-compliant one. We use the GNU version when available, since it fits the code better, and otherwise use the XSI-compliant one. https://sourceware.org/bugzilla/show_bug.cgi?id=21010 Signed-off-by: Érico Rolim <erico.erc@gmail.com>
* tests: use ${CC} instead of 'gcc' in testsSergei Trofimovich via Elfutils-devel2021-01-317-13/+25
| | | | | | | | | | | | | | To better support cross-compilation Gentoo provides a way to configure system without 'gcc' binary and only provide tool-prefixed tools, like 'x86_64-pc-linux-gnu-gcc'. The packages are built as ./configure --host=x86_64-pc-linux-gnu. In https://bugs.gentoo.org/718872 Agostino Sarubbo found a few test failures that use hardcoded 'gcc' instead of expected ${CC}. The change propagates detected ${CC} at configure time to test scripts. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* readelf: Pull regname() into file scopeTimm Bäder2021-01-302-18/+30
| | | | | | Get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* readelf: Pull left() info file scopeTimm Bäder2021-01-302-7/+15
| | | | | | Get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* readelf: Pull same_set() info file scopeTimm Bäder2021-01-302-10/+21
| | | | | | Get rid of a nested function this way Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* readelf: Pull add_dump_section() into file scopeTimm Bäder2021-01-302-16/+24
| | | | | | Get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* arlib-argp: Pull text_for_default() into file scopeTimm Bäder2021-01-292-10/+17
| | | | | | Get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* zstrptr: Pull print_string() into file scopeTimm Bäder2021-01-292-21/+28
| | | | | | Get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* addr2line: Pull show_note() and show_int() in file scopeTimm Bäder2021-01-292-21/+33
| | | | | | Get rid of the nested functions Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* elf-from-memory: Refactor to get rid of nested functionTimm Bäder2021-01-282-65/+56
| | | | | | | Try to unify the 32/64 bit code paths and get rid of the nested handle_segment() this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* elf-from-memory: Restructure code to get rid of nested handle_segment()Timm Bäder2021-01-282-47/+41
| | | | | | | | Use one loop for both 32 and 64 bit case. This allows for only one call site of the old handle_segment(), which we can then inline into the for loop. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* strip: Remove no_symtab_updates() functionTimm Bäder2021-01-282-45/+35
| | | | | | | | | The no_symtab_updates() function was being called at the beginning of all case labels in this switch, so we can just call it once before the switch. Then it only has one call-site, so inline this short function there. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* strip: Pull update_section_size() into file scopeTimm Bäder2021-01-282-23/+35
| | | | | | Get rid of a nested function this way. Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* strip: Pull relocate() info file scopeTimm Bäder2021-01-282-163/+193
| | | | | | | | Pull relocate() info file scope and get rid of a nested function this way. Refactor remove_debug_relocations() to minimize the parameters we need to pass to relocate(). Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* strip: Replace nested check_preserved function with loopTimm Bäder2021-01-282-16/+25
| | | | Signed-off-by: Timm Bäder <tbaeder@redhat.com>
* elflint: Recognize SHF_GNU_RETAIN as extra section flag.Mark Wielaard2021-01-152-9/+20
| | | | | | | | | | SHF_GNU_RETAIN is like SHF_LINK_ORDER it can appear on any section and should be ignored by elflint. Add all such flags to a new EXTRA_SHFLAGS and use it consistently in check_sections. https://sourceware.org/bugzilla/show_bug.cgi?id=27134 Signed-off-by: Mark Wielaard <mark@klomp.org>
* Add coverage targetDmitry V. Levin2021-01-124-0/+62
| | | | | | | | | | | Implement a target for capturing code coverage using lcov. It is available when elfutils is configured using --enable-gcov. Tested with autoreconf -if && ./configure --enable-maintainer-mode --enable-gcov && make && make check && make coverage Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* src/elflint.c: add debug print for GNU_RETAIN and othersSergei Trofimovich2021-01-122-1/+9
| | | | Signed-off-by: Mark Wielaard <mark@klomp.org>
* src/elflint.c: fix printing of unknown flagsSergei Trofimovich2021-01-112-2/+11
| | | | | | | | | | | | before the change section_flags_string() ignored unknown section flags: snprintf() did write numeric value into buffer, but "*cp = '\0'" negated the effect. The change advances the 'cp' pointer'. While at it add a '|' separator between known and unknown flags. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* src/readelf: use qsort instead of qsort_r.Érico Rolim2021-01-102-4/+14
| | | | | | | | | This program is single threaded, so using qsort with a global variable isn't a danger. The interface for qsort_r isn't standardized (and diverges between glibc and FreeBSD, for example), which makes usage of qsort, where possible, preferrable. Signed-off-by: Érico Rolim <erico.erc@gmail.com>
* Split the top level .gitignore fileDmitry V. Levin2020-12-2014-155/+181
| | | | | | | | | | Move subdirectory parts of the top level .gitignore into appropriate subdirectories. This would be consistent with ChangeLog files, currently one has to update the top level ChangeLog file when the top level .gitignore file is changed in a way that affects a specific subdirectory only. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* .gitignore: updateDmitry V. Levin2020-12-202-5/+13
| | | | Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* libcpu: linking i386_gendis requires obstack.Érico Rolim2020-12-162-1/+5
| | | | Signed-off-by: Mark Wielaard <mark@klomp.org>
* Handle SHF_GNU_RETAIN in eu-readelf and eu-elflint.Mark Wielaard2020-12-167-0/+63
| | | | | | | readelf -S now shows 'R' when SHF_GNU_RETAIN is set. elflint accepts SHF_GNU_RETAIN when set on section in --gnu mode. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libelf: Sync elf.h from glibc.Mark Wielaard2020-12-162-6/+11
| | | | | | Adds SHF_GNU_RETAIN. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Modernize gettext infrastructureDmitry V. Levin2020-12-1624-2986/+70
| | | | | | | | | | | | | | | Switch to use AM_GNU_GETTEXT, AM_GNU_GETTEXT_VERSION, and AM_GNU_GETTEXT_REQUIRE_VERSION, this allows to stop bundling gettext infrastructure files and let autoreconf invoke autopoint which will set the gettext infrastructure up. Use this opportunity to create separate .gitignore files for m4/ and po/ directories. Tested with autoreconf -if && ./configure --enable-maintainer-mode && make && make distcheck Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* src: consistently use _(Str) instead of gettext(Str)Dmitry V. Levin2020-12-1615-1038/+1040
| | | | | | | | | Make use of the _(Str) macro provided by <config.h>. The change was made automatically using the following command: $ git grep -l '\<gettext *(' src |xargs sed -i 's/\<gettext *(/_(/g' Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* libcpu: consistently use _(Str) instead of gettext(Str)Dmitry V. Levin2020-12-163-4/+9
| | | | | | | | | | | | eu-config.h defines _(Str) to dgettext ("elfutils", Str) instead of a simple gettext (Str) for a reason: the library might be indirectly used by clients that called bindtextdomain with a domain different from "elfutils". The change was made automatically using the following command: $ git grep -l '\<gettext *(' libcpu |xargs sed -i 's/\<gettext *(/_(/g' Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* lib: consistently use _(Str) instead of gettext(Str)Dmitry V. Levin2020-12-164-4/+9
| | | | | | | | | | | | eu-config.h defines _(Str) to dgettext ("elfutils", Str) instead of a simple gettext (Str) for a reason: the library might be indirectly used by clients that called bindtextdomain with a domain different from "elfutils". The change was made automatically using the following command: $ git grep -l '\<gettext *(' lib |xargs sed -i 's/\<gettext *(/_(/g' Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* Consistently define _(Str) using dgettext ("elfutils", Str)Dmitry V. Levin2020-12-1618-34/+36
| | | | | | | | | | | | | | Move the definition of _(Str) macro to lib/eu-config.h which already provides a definition of N_(Str) macro. Since lib/eu-config.h is appended to config.h, it is included into every compilation unit and therefore both macros are now universally available. Remove all other definitions of N_(Str) and _(Str) macros from other files to avoid conflicts and redundancies. The next step is to replace all uses of gettext(Str) with _(Str). Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* libebl: consistently use _(Str) instead of gettext(Str)Dmitry V. Levin2020-12-1612-24/+38
| | | | | | | | | | | | libeblP.h defines _(Str) to dgettext ("elfutils", Str) instead of a simple gettext (Str) for a reason: the library might be indirectly used by clients that called bindtextdomain with a domain different from "elfutils". The change was made automatically using the following command: $ git grep -l '\<gettext *(' libebl |xargs sed -i 's/\<gettext *(/_(/g' Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* libelf: Make sure we have at least a full ELF header available.Mark Wielaard2020-12-162-0/+11
| | | | | | | | | | | When elf_memory is called we could get a slightly too small image that doesn't contain a full ELF header (but does contain at least the e_ident values). Require the full header before even validating the rest of the ELF header fields. https://sourceware.org/bugzilla/show_bug.cgi?id=27076 Signed-off-by: Mark Wielaard <mark@klomp.org>
* elflint: Always print symbol name (if known) in error messages.Mark Wielaard2020-12-162-49/+54
| | | | | | | | | | | | | Adding the symbol name associated with the symbol index number makes the error messages a little bit more useful. We used to say: section [59] '.symtab': symbol 9: st_value out of bounds But now says: section [59] '.symtab': symbol 9 (.annobin_size.c.hot): st_value out of bounds Signed-off-by: Mark Wielaard <mark@klomp.org>