summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* report_r_debug: handle `-z separate-code' and find more modulesHEADmasterLuke Diamand2023-05-121-4/+10
| | | | | | | | | | | | | | | | | | | | | Looking at some cores in eu-stack, I found that they were not being backtraced. This was because elfutils had not found some modules (e.g. libc-2.22.so) in report_r_debug. That is because it has a limit on the number of link map entries it will look at, to avoid loops in corrupted core files. The example I found had: - 36 elements - 109 iterations See also discussion here: https://sourceware.org/pipermail/elfutils-devel/2023q2/006149.html Signed-off-by: Luke Diamand <ldiamand@roku.com>
* PR30316: debuginfod wal checkpointingusers/fche/try-filecompFrank Ch. Eigler2023-05-094-2/+127
| | | | | | | | | | | | Add a "--scan-checkpoint=NUM" option to debuginfod to control forced synchronization & sqlite -wal checkpointing for the multithreaded scanning process. In absence of this, a server that's busy with other read & write operations can accumulate potentially large SQLITE WAL temporary files. This option causes the server to take intermittent quiescent breaks during scanning, during which the -wal file can be processed and truncated. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod: PR30378: better compression for _files tableFrank Ch. Eigler2023-05-092-81/+183
| | | | | | | | | | | | | | | | | | | Split the _files table into two links into a new _fileparts table, interning the dirname and basename of each file name string. This reduces storage requirements for many thousands of almost-identical long paths that are evident in large builds like kernels. This is unfortunately a schema-breaking change, so requires reindexing of the corpus. While in the vicinity, the file scan work queue is changed from a <set> to an <unordered_set>. The intent is that files be scanned in a more random sequence instead of sorted. If they're sorted, then files that contain errors will tend to be retried over and over again at the next scan cycle, even at the expense of making progress on the other files in the queue. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* backends: Add set_initial_registers_tid callback for LoongArchYouling Tang2023-05-094-1/+96
| | | | | | | This patch implements the set_initial_registers_tid hook for LoongArch. Signed-off-by: Liwei Ge <geliwei@openanolis.org> Signed-off-by: Youling Tang <tangyouling@loongson.cn>
* backends: Add core_note callback for LoongArchYouling Tang2023-05-094-1/+122
| | | | Signed-off-by: Youling Tang <tangyouling@loongson.cn>
* backends: Add frame pointer unwinding for LoongArchYouling Tang2023-05-094-1/+93
| | | | | | | | | | | If we don't find any debug information for a given frame, we usually cannot unwind any further. However, the binary in question might have been compiled with frame pointers, in which case we can look up the well known frame pointer locations in the stack snapshot and use them to bridge the frames without debug information. Signed-off-by: Liwei Ge <geliwei@openanolis.org> Signed-off-by: Youling Tang <tangyouling@loongson.cn>
* backends: Add initial return value location support for LoongArchYouling Tang2023-05-094-1/+212
| | | | | | | | LoongArch ELF ABI specification - Return values: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_return_values Signed-off-by: Liwei Ge <geliwei@openanolis.org> Signed-off-by: Youling Tang <tangyouling@loongson.cn>
* backends: Add abi_cfi and register_info callbacks for LoongArchYouling Tang2023-05-095-2/+238
| | | | | | | | | | | LoongArch Reference Manual - Volume 1: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html LoongArch ELF ABI: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html Signed-off-by: Liwei Ge <geliwei@openanolis.org> Signed-off-by: Youling Tang <tangyouling@loongson.cn>
* elfcompress: Don't compress if section already compressed unless forcedMark Wielaard2023-05-081-20/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | Before commit a5b07cdf9 "support ZSTD compression algorithm" elfcompress would not try to compress a section if it already had the requested compression type (or was already uncompressed) unless the --force flag was given. An else if construct was changed to an if in the commit causing elfcompress to warn (in verbose mode) but then still try to (re)compress the section. Add an explicit check so if nothing needs (un)compressing, the file isn't changed. The diff looks large, but git diff -b -w is just: + if (force || type != schtype) + { if (shdr->sh_type != SHT_NOBITS && (shdr->sh_flags & SHF_ALLOC) == 0) { @@ -554,6 +556,7 @@ process_file (const char *fname) printf ("[%zd] %s ignoring %s section\n", ndx, sname, (shdr->sh_type == SHT_NOBITS ? "no bits" : "allocated")); } + } Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdwfl: Fix memory leak in unzip()John Gallagher2023-05-082-1/+5
| | | | | | | state.input_buffer is not freed if the file is found to not be compressed with the compression algorithm unzip() is trying to use. Signed-off-by: John Gallagher <john@gllghr.com>
* PR30377: fix debuginfod -r -X combinationFrank Ch. Eigler2023-04-226-3/+111
| | | | | | | | Until this fix, debuginfod -r -X '.*' didn't trigger groom-time removal of everything, because the -I include regex overrode it. Corrected logic to match the scan-time tie-breaking between -I / -X. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* testsuite: Avoid C99 compatibility issues in run-native-test.shFlorian Weimer2023-04-221-1/+2
| | | | | | | Include <unistd.h> for the pause function, and add the return type of main. Avoids an implicit function declaration and implicit int. Signed-off-by: Florian Weimer <fweimer@redhat.com>
* readelf: display dynamic symtab without section headersDi Chen2023-04-185-151/+405
| | | | | | | | | | | | | | | | | | | | | | This commit adds a new option "-D/--use-dynamic" to support printing the dynamic symbol table from the PT_DYNAMIC segment. By using the PT_DYNAMIC segment, eu-readelf can go through the contents of dynamic section entries and the values of each tag. From that, we can get the address and size of the dynamic symbol table, the address of the string table, etc. By using the new option "-D/--use-dynamic", eu-readelf can list the symbols without section headers. Example: $ ./src/readelf -Ds a.out 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UNDEF 1: 0000000000000000 0 FUNC GLOBAL DEFAULT UNDEF __libc_start_main@GLIBC_2.34 (2) 2: 0000000000000000 0 NOTYPE WEAK DEFAULT UNDEF __gmon_start__ https://sourceware.org/bugzilla/show_bug.cgi?id=28873 Signed-off-by: Di Chen <dichen@redhat.com>
* tests: Limit the number of concurrent requests in debuginfod-federationMark Wielaard2023-04-172-2/+6
| | | | | | | | | | | | It seems doing 100 parallel requests can crash some versions of libmicrohttpd so limit the number a little to the number of processors times 4, with a max of 64. * tests/run-debuginfod-federation-metrics.sh: Use nproc * 4, or 64 for seq curl requests. * tests/run-debuginfod-federation-sqlite.sh: Likewise. Signed-off-by: Mark Wielaard <mark@klomp.org>
* readelf: Handle NULL shdr in section_nameMark Wielaard2023-04-141-1/+1
| | | | | | | | | | In some error cases we want to show the section name but cannot because the section header is corrupt or NULL. Make sure the section_name always returns "???" in that case. * src/readelf.c (section_name): Check for shdr == NULL. Signed-off-by: Mark Wielaard <mark@klomp.org>
* backends: Check results for NULL early in dwarf_peeled_die_typeMark Wielaard2023-04-141-3/+3
| | | | | | | | | | | Calling dwarf_peeled_die_type with a NULL results pointer is an error, check early that result is not NULL so dwarf_formref_die and dwarf_peel_type won't try to set the NULL Dwarf_Die. * backends/libebl_CPU.h (dwarf_peeled_die_type): Move check for results == NULL to start of function. Signed-off-by: Mark Wielaard <mark@klomp.org>
* PR30348: debuginfod: retry partial archive scansFrank Ch. Eigler2023-04-132-0/+21
| | | | | | | | | | | | | On some public debuginfod servers, it was observed that errors may occur during individual archive scanning operations. That's fine, but previous code still went ahead and marked the archive "done" by inserting a record into the *_file_mtime_scanned table. New code ensures that exceptions propagate for these cases, and an archive that encountered an error while scanning will be retried later. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* backends: add checks for _GLOBAL_OFFSET_TABLE_ on loongarchYouling Tang2023-04-073-0/+41
| | | | | | | | | | | | | | | | Add handling of _GLOBAL_OFFSET_TABLE_. Before applying the patch: $ ./src/elflint --gnu-ld ./src/elflint section [35] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x68548 does not match .got.plt section address 0x68238 After applying the patch: $ ./src/elflint --gnu-ld ./src/elflint No errors Signed-off-by: Liwei Ge <geliwei@openanolis.org> Signed-off-by: Youling Tang <tangyouling@loongson.cn>
* backends: Add new relocation type handling for LoongArchYouling Tang2023-04-072-0/+44
| | | | | | Add new relocation type handling. Signed-off-by: Youling Tang <tangyouling@loongson.cn>
* libelf: Sync elf.h from glibc.Youling Tang2023-04-072-1/+45
| | | | | | Adds R_LARCH_*. Signed-off-by: Youling Tang <tangyouling@loongson.cn>
* debuginfod: When retrieving files from cache, update atime manuallyJan Alexander Steffens (heftig)2023-03-302-0/+20
| | | | | | | | | The cache cleaning logic requires atime to be correct (strictatime or relatime) but some users on Linux only have noatime. Attempt to update the atime manually so that the cache works properly. Signed-off-by: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
* debuginfod: Don't touch access time of new filesJan Alexander Steffens (heftig)2023-03-303-10/+22
| | | | | | | | Instead of copying the mtime, which might be far in the past, don't touch the access time. This will prevent cache cleaning from considering the file as old immediately. Signed-off-by: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
* debuginfod-client.c: Avoid sscanf on mixed-case component of stringAaron Merey2023-03-302-2/+7
| | | | | | | | | | | sscanf is used to get the value of x-debuginfod-size from the http headers. The format string used assumes that the header field name is entirely lower case. However mixed-case field names are possible, resulting in the value not being read. Fix this by removing "x-debuginfod-size" from the format string. Signed-off-by: Aaron Merey <amerey@redhat.com>
* nuke a top-level ChangeLog blurb that duplicated the debuginfod/ChangeLogFrank Ch. Eigler2023-03-291-5/+0
|
* debuginfod: Replace futimes with futimensJan Alexander Steffens (heftig)2023-03-293-10/+14
| | | | | | | Similar to what 8c4aa0ef998191ed828a37190dc179b91649938a did for ar and strip, replace the non-standard futimes with the POSIX futimens. Signed-off-by: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
* debuginfod-client.c: Fix download size not correctly fallbacks to ↵lilydjwg2023-03-293-3/+14
| | | | | | x-debuginfod-size header Signed-off-by: lilydjwg <lilydjwg@gmail.com>
* LoongArch: implemented a basic machine flag checkAlexey Sheplyakov2023-03-202-0/+8
| | | | | | | | | | | | | | | | | | | | With this patch I can use eu-elflint to verify LoongArch ELF binaries. Previously eu-elflint was complaining about invalid machine flags: $ ./src/elflint --gnu-ld ./src/elflint invalid machine flags: 0x43 $ echo $? 1 * backends/loongarch_symbol.c (loongarch_init): Hook machine_flag_check. * backends/loongarch_symbol.c (loongarch_machine_flag_check): New function. https://sourceware.org/bugzilla/show_bug.cgi?id=30251 Signed-off-by: Alexey Sheplyakov <asheplyakov@basealt.ru>
* debuginfod-client.c: Skip empty file creation for cancelled queriesAaron Merey2023-03-172-3/+8
| | | | | | | | | | | | | | | | | Empty files in the client cache are used to indicate that contacted servers could not find a requested resource. Future queries for this resource will not be attempted until the cache_miss_s duration has passed. Currently these empty files are also created when a query is cancelled through the client's progressfn. This can occur, for example, when a user cancels a download with ctrl-c. This prevents user-cancelled queries from being retried promptly without having to modify cache_miss_s. Fix this by skipping the creation of an empty cache file when progressfn cancels a query. Signed-off-by: Aaron Merey <amerey@redhat.com>
* tests: skip '(null)' symname frames in backtrace testsMark Wielaard2023-03-051-0/+8
| | | | | | | | | | | | Some setups might have some frames for unknown (null) functions in the thread backtrace. Skip these frames instead of failing immediately. * tests/backtrace.c (callback_verify): Check and skip nulls_seen. https://sourceware.org/bugzilla/show_bug.cgi?id=29176 Signed-off-by: Mark Wielaard <mark@klomp.org>
* configure.ac contains BashismsMark Wielaard2023-03-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Autoconf scripts are supposed to be written in POSIX-compatible shell language. elfutils commits 0ffe2874e75d48cb88936e119e5284ff2bf664d9 and 3fa98a6f29b0f370e32549ead7eb897c839af980 introduced Bashisms to configure.ac that cause errors when /bin/sh is not Bash. Example error when /bin/sh is Dash: ./configure: 8748: test: xyes: unexpected operator The cause of the error is the use of a non-existent == operator in expressions passed to the 'test' built-in command. POSIX shell specifies only an = operator for testing string equality. * configure.ac: Replace == by = in use_msan and enable_demangler comparisons. https://sourceware.org/bugzilla/show_bug.cgi?id=30196 Reported-by: Matt Whitlock <sourceware@mattwhitlock.name> Signed-off-by: Mark Wielaard <mark@klomp.org>
* Fix static build when zstd is enabled for libelfMark Wielaard2023-03-033-3/+3
| | | | | | | | | | | | | | | | | When doing a static build (as with --enable-gcov) the build fails because the executables aren't linked with -lzstd. Also the run-debuginfod-query-retry.sh test relies on libdebuginfod.so.1 which isn't there. Fix by adding $(zstd_LIBS) to the static libelf lines and using the debuginfod-find executable itself in the testcase. * src/Makefile.am (libelf): When BUILD_STATIC add $(zstd_LIBS) * tests/Makefile.am (libelf): Likewise. * tests/run-debuginfod-query-retry.sh: Use debuginfod-find instead of libdebuginfod.so.1 Signed-off-by: Mark Wielaard <mark@klomp.org>
* Prepare for 0.189elfutils-0.189Mark Wielaard2023-03-039-3721/+3813
| | | | | | | | | Set version to 0.189 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>
* libelf: Document and make ELFCOMPRESS_ZSTD usable with old system elf.hMark Wielaard2023-03-034-5/+25
| | | | | | | | Make sure that even if the system elf.h doesn't have ELF_COMPRESS_ZSTD defined it can still be used as constant. Also update libelf.h documentation and add new feature to NEWS. Signed-off-by: Mark Wielaard <mark@klomp.org>
* readelf: Fix use-after-free ebl pointer issueMark Wielaard2023-03-032-2/+8
| | | | | | | | | | | | | | | | | | | | | With -flto gcc 13 sees that we use the ebl pointer after closing and freeing it. In function ‘process_elf_file’, inlined from ‘process_dwflmod’ at readelf.c:818:3: readelf.c:1070:6: error: pointer ‘ebl_18’ used after ‘free’ [-Werror=use-after-free] 1070 | if (pure_ebl != ebl) | ^ In function ‘ebl_closebackend’, inlined from ‘process_elf_file’ at readelf.c:1068:3, inlined from ‘process_dwflmod’ at readelf.c:818:3: ../libebl/eblclosebackend.c:47:7: note: call to ‘free’ here 47 | free (ebl); | ^ Fix by only calling ebl_closebackend after using it in the comparison. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw: Fix dwarf_getscopes memory leak on errorMark Wielaard2023-02-282-1/+8
| | | | | | | | | | When there is an error in dwarf_getscopes after the initial scopes have been allocated, e.g. when looking for the inlined scopes, then the scopes would leak. Fix this by explicitly free the scopes on error. https://sourceware.org/bugzilla/show_bug.cgi?id=29434 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libcpu: Remove the need of NMNES by using enumYonggang Luo2023-02-235-21/+60
| | | | | Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw: Use elf_rawdata when checking .debug sectionMark Wielaard2023-02-232-2/+7
| | | | | | | .debug sections are raw bytes and don't need conversion even when host and file have different endian order. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libelf: memmove any extra bytes left by elf_cvt_gnuhash conversionMark Wielaard2023-02-232-2/+14
| | | | | | | | Otherwise some undefined bytes might be left in the buffer. Now they might still be not useful, but at least they are as defined in the file. Signed-off-by: Mark Wielaard <mark@klomp.org>
* NEWS: Add old version code namesMark Wielaard2023-02-232-26/+30
| | | | Signed-off-by: Mark Wielaard <mark@klomp.org>
* Update m4 files from autoconf-archiveMark Wielaard2023-02-212-62/+503
| | | | | | | Update m4/ax_check_compile_flag.m4 and m4/ax_cxx_compile_stdcxx.m4 to autoconf-archive-2023.02.20. Signed-off-by: Mark Wielaard <mark@klomp.org>
* configure: Check for and -Wuse-after-free=3 when availableMark Wielaard2023-02-214-1/+27
| | | | | | | gcc already includes -Wuse-after-free=2 in -Wall. -Wuse-after-free=3 also warns for indeterminate pointers in equality expressions. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libasm: Fix use-after-free issue with circular single linked list cleanupMark Wielaard2023-02-212-8/+14
| | | | | | | | | | | | | | | | Pointed out by gcc 12 with -Wuse-after-free=3 In function ‘free_section’ asm_end.c:552:17: error: pointer ‘data’ used after ‘free’ [-Werror=use-after-free] 552 | while (oldp != scnp->content); | ~~~~~^~~~~~~~~~~~~~~~ asm_end.c:550:9: note: call to ‘free’ here 550 | free (oldp); | ^~~~~~~~~~~ Fix by freeing scnp->content last. Signed-off-by: Mark Wielaard <mark@klomp.org>
* NEWS: Mention linking with libstdc++ or using --disable-demanglerMark Wielaard2023-02-171-0/+3
| | | | Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw: check that DWARF strings are null-terminatedAleksei Vetrov2023-02-173-1/+52
| | | | | | | | | | | | It is expected from libdw to return strings that are null-terminated to avoid overflowing ELF data. * Add calculation of a safe prefix inside string sections, where any string will be null-terminated. * Check if offset overflows the safe prefix in dwarf_formstring. Signed-off-by: Aleksei Vetrov <vvvvvv@google.com>
* configure: Error when demangler is enabled, but libstdc++ support isn'tMark Wielaard2023-02-172-1/+7
| | | | | | | | | There have been a couple of cases where demangler support has been accidentially been disabled because libstdc++ wasn't there/installed during build. Make it an error if --disable-demangler isn't explicitly given. Signed-off-by: Mark Wielaard <mark@klomp.org>
* doc: Add .TP before -g in debuginfod.8Mark Wielaard2023-02-142-0/+5
| | | | | | Fixes indentation of -g option. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw: Correct data end checkfor deref_type operand in dwarf_getlocationMark Wielaard2023-02-142-1/+6
| | | | | | | | In __libdw_intern_expression we checked for one byte too many. We only need one byte for the size and (at least one) for the uleb128 DIE reference. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw: Handle DW_OP_GNU_uninit in dwarf_getlocationMark Wielaard2023-02-144-0/+16
| | | | | | | | | | | dwarf_getlocation would return an error when it saw a DW_OP_GNU_uninit. Handle it by simply recognizing as a no argument operation. DW_OP_GNU_uninit is emitted by GCC as a marker to flag the location expression as referring to an uninitialized value. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw, readelf, elflint: Add get_(u|s)leb128 guardsMark Wielaard2023-02-1413-1/+72
| | | | | | | | | Add sanity check making sure an leb128 isn't being read beyond the end of the current data segment. Most code already had these guards, but some were missing. This makes sure an appropriate error is generated instead. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw: check memory access in get_(u|s)leb128Aleksei Vetrov2023-02-142-3/+36
| | | | | | | | | | __libdw_get_uleb128 and __libdw_get_sleb128 should check if addrp has already reached the end before unrolling the first step. It is done by moving __libdw_max_len to the beginning of the function, which can notice, that addrp is beyond the end. Then we just check the result of this function. Signed-off-by: Aleksei Vetrov <vvvvvv@google.com>