bd18c04...
by
Housam Alamour <email address hidden>
PR 30991: srcfiles tarball feature
* srcfiles.cxx: Introduce new --zip option that places all the
source files associated with a specified dwarf/elf file
into a zip file and sends it to stdout. Files may be
fetched from debuginfod (if applicable) or locally as
a backup.
Added -b option to disable the backup of checking
for files locally in -z mode.
* run-srcfiles-self.sh: Added test-case for the new zip
feature that archives the source files of the srcfiles
tool and checks archive integrity. An additional test
ensures that if debuginfod is enabled, the files are
fetched and archived properly while maintaing integrity.
* debuginfod-subr.sh: On very slow/remote storage, it can
take O(minute) to finish indexing the entire elfutils
build tree, so a wait_ready4 shell function is one
way to let a longer debuginfod wait operation work.
* srcfiles.1, NEWS: Added documentation for the new zip feature.
* configure.ac: Simplify check for libarchive for srcfiles.cxx
by integrating it into the same check for debuginfod.
* Makefile.am: build with local copy of debuginfod-client.
PR31248: debuginfod_find_*: lseek to the front on returned fds
Previous code could return a fd that had its file-offset left at the
place where libcurl last used it, namely at the end of the freshly
downloaded file. Not good if a client just wants to read it right
away! We now ensure (and document) that the fd is pointed to the
beginning of the file.
Signed-off-by: Frank Ch. Eigler <email address hidden>
tests: fix build against upcoming `gcc-14` (`-Werror=calloc-transposed-args`)
`gcc-14` added a new `-Wcalloc-transposed-args` warning recently. It
detected minor infelicity in `calloc()` API usage in `elfutils`:
elfstrmerge.c: In function 'main':
elfstrmerge.c:450:32: error:
'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
450 | newscnbufs = calloc (sizeof (void *), newshnums);
| ^~~~
elfstrmerge.c:450:32: note: earlier argument should specify number of elements, later size of each element
Signed-off-by: Sergei Trofimovich <email address hidden>
musl does not provide GNU version of basename and lately have removed
the definiton from string.h [1] which exposes this problem. It can be
made to work by providing a local implementation of basename which
implements the GNU basename behavior, this makes it work across C
libraries which have POSIX implementation only.
tests: Don't redirect output to /dev/null in run-native-test.sh
By redirecting all output to /dev/null in run-native-test.sh the
run-native-test.sh.log file will be empty on failures. This makes
it hard to figure out what went wrong.
Signed-off-by: Mark Wielaard <email address hidden>
03c1719...
by
Aleksei Vetrov <email address hidden>
libelf: check decompressed ZSTD size
Decompression functions like __libelf_decompress_zlib check that
decompressed data has the same size as it was declared in the header
(size_out argument). The same check is now added to
__libelf_decompress_zstd to make sure that the whole allocated buffer is
initialized.
* libelf/elf_compress.c (__libelf_decompress_zstd): Use return value
of ZSTD_decompress to check that decompressed data size is the
same as size_out of the buffer that was allocated.
Signed-off-by: Aleksei Vetrov <email address hidden>
It is possible for segments of different shared libaries to be interleaved
in memory such that the segments of one library are located in between
non-contiguous segments of another library.
For example, this can be seen with firefox on RHEL 7.9 where multiple
shared libraries could be mapped in between ld-2.17.so segments:
dwfl_segment_report_module did not account for the possibility of
interleaving non-contiguous segments, resulting in premature closure
of modules as well as failing to report modules.
Fix this by removing segment skipping in dwfl_segment_report_module.
When dwfl_segment_report_module reported a module, it would return
the index of the segment immediately following the end address of the
current module. Since there's a chance that other modules might fall
within this address range, dwfl_segment_report_module instead returns
the index of the next segment.
This patch also fixes premature module closure that can occur in
dwfl_segment_report_module when interleaving non-contiguous segments
are found. Previously modules with start and end addresses that overlap
with the current segment would have their build-ids compared with the
current segment's build-id. If there was a mismatch, that module would
be closed. Avoid closing modules in this case when mismatching build-ids
correspond to distinct modules.
e54af3a...
by
Aleksei Vetrov <email address hidden>
tests: Add test for duplicate entries in archive
Test dwfl-report-offline-memory against an archive that contains
non-relocatable ELFs with the same name and contents.
* tests/test-ar-duplicates.a.bz2: New test file.
* tests/run-dwfl-report-offline-memory.sh: Test new
test-ar-duplicates.a.bz2.
* tests/Makefile.am (EXTRA_DIST): Add test-ar-duplicates.a.bz2.
Signed-off-by: Aleksei Vetrov <email address hidden>
0ab5a3e...
by
Aleksei Vetrov <email address hidden>
libdwfl: handle duplicate ELFs when reporting archives
When archive is processed in process_archive (libdwfl/offline.c), it
creates an Elf object for each archive member. Then in
process_archive_member it calls process_file to create a Dwfl_Module
through __libdwfl_report_elf.
The ownership of the Elf object is expected to be:
* either transfered to the Dwfl_Module, if __libdwfl_report_elf returns
not NULL;
* or handled at the end of process_archive_member by calling elf_end.
Moreover, Elf object is expected to be alive, if __libdwfl_report_elf
returns not NULL, because at the end of process_archive_member it
advances to the next member through the elf_next call.
The problem happens when __libdwfl_report_elf encounters Elf with the
same name and content as it seen before. In that case dwfl_report_module
will reuse existing Dwfl_Module object. This leads to a codepath that
calls elf_end on the Elf object, while returning not NULL, breaking the
elf_next call to the next member.
The fix is to destroy m->main.elf instead and put the new Elf object in
the already existing Dwfl_Module.
* libdwfl/dwfl_report_elf.c (__libdwfl_report_elf): Replace Elf in
the Dwfl_Module in case of duplicate modules to prolong its
lifetime for subsequent processing.
Signed-off-by: Aleksei Vetrov <email address hidden>