Re: elf_memory again, readonly or readwrite...
Hi, On Thu, 2024-08-29 at 15:47 +0200, Mark Wielaard wrote: > So we changed elf_memory so it pretends the in-memory Elf image is > read with ELF_C_READ_MMAP. This helps when calling elf_memory on > read-only memory which still wants to change some things about the Elf > like uncompress some sections (which changes the section header). > > With ELF_C_READ_MMAP libelf will make a copy of the section headers, > so any changes aren't written to the memory image (because that would > crash if the underlying memory is read-only). > > But that breaks another use case where elf_memory is used on rw memory > and then the section headers are updated using libelf and it is > expected those in-memory section headers reflect the changes. > > The problem of course is the elf_memory function doesn't take a "mode" > argument. So we have to guess. And make one or the other usage > unusable. > > I think we should assume the memory is read/write and at least header > updates are written back to the memory image. But that when only just > reading the image then nothing is changed and written back to the > image. > > This does mean that when explicitly uncompressing sections you have to > make sure the image is writable (because that updates the shdrs). I waited too long deciding what to do here. Sorry. We are about to make the 0.192 release today. If it isn't too late then I would like to apply my proposed patch (as attached). It isn't ideal, but it basically reverts to the behavior of elfutils 0.190. So you can again do direct manipulation on ELF images created through elf_memory. So in that way it was a regression in 0.191, fixed for 0.192. It does mean that if the memory you gave elf_memory is read-only and you call elf_compress on one of the sections things might crash (because elf_compress will try to update the Elf_Shdr structure in place to set the new size). Which indeed could be seen as a regression from 0.191 (but was there before). If you do want to decompress (or otherwise manipulate) the ELF image created through elf_memory you have to do what the testcase (now) does. mmap the image using MMAP_PRIVATE so it is (copy-on-)writable. Longer term we probably want a new elf_memory2 function that takes an argument describing the protection bits of the given memory. Aaron, is it OK to commit this before you start the 0.192 release process? Cheers, Mark From 81981fdfd8f776508579da60d29e068359c61e6a Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 18 Oct 2024 16:52:49 +0200 Subject: [PATCH] libelf: Treat elf_memory image as writable There are use cases where the Elf image created by elf_memory is manipulated, through the libelf interfaces, in place. This doesn't work anymore since we changed elf_memory to assume the memory is read-only in elfutils 0.191. commit cc44ac674 ('libelf: Treat elf_memory as if using ELF_C_READ_MMAP'). The reason for that change was that if elf_memory was given a read-only memory image then decompressing a section with elf_compress would crash. Since it directly writes the updated Shdr size. If you do want to use elf_compress on an Elf created by elf_memory you have make sure the memory is writable. You can do this for example by using mmap PROTE_WRITE and MAP_PRIVATE. * libelf/elf_memory.c (elf_memory): Call __libelf_read_mmaped_file with ELF_C_READ_MMAP_PRIVATE. * tests/elfgetzdata.c (main): Use mmap PROT_WRITE and MAP_PRIVATE. Signed-off-by: Mark Wielaard --- libelf/elf_memory.c | 3 ++- tests/elfgetzdata.c | 6 -- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libelf/elf_memory.c b/libelf/elf_memory.c index 13d77cb71b39..1df49d732dd9 100644 --- a/libelf/elf_memory.c +++ b/libelf/elf_memory.c @@ -46,5 +46,6 @@ elf_memory (char *image, size_t size) return NULL; } - return __libelf_read_mmaped_file (-1, image, 0, size, ELF_C_READ_MMAP, NULL); + return __libelf_read_mmaped_file (-1, image, 0, size, +ELF_C_READ_MMAP_PRIVATE, NULL); } diff --git a/tests/elfgetzdata.c b/tests/elfgetzdata.c index 0af6c223a06b..a50275fea1a7 100644 --- a/tests/elfgetzdata.c +++ b/tests/elfgetzdata.c @@ -69,7 +69,8 @@ main (int argc, char *argv[]) else { assert (do_mem); - // We mmap the memory ourselves, explicitly PROT_READ only + // We mmap the memory ourselves, explicitly PROT_READ | PROT_WRITE + // elf_memory needs writable memory when using elf_compress. struct stat st; if (fstat (fd, &st) != 0) { @@ -79,7 +80,8 @@ main (int argc, char *argv[]) continue; } map_size = st.st_size; - map_address = mmap (NULL, map_size, PROT_READ, MAP_PRIVATE, fd, 0); + map_address = mmap (NULL, map_size, PROT_READ | PROT_WRITE, + MAP_PRIVATE, fd, 0); if (map_address == MAP_FAILED) { printf ("%s cannot mmap %s\n", argv[cnt], strerror (errno)); -- 2.47.0
☺ Buildbot (Sourceware): elfutils - build successful (main)
A restored build has been detected on builder elfutils-fedora-x86_64 while building elfutils. Full details are available at: https://builder.sourceware.org/buildbot/#/builders/59/builds/414 Build state: build successful Revision: 0f3b436b7e4fc4d310be79a62e40a115fdc482d0 Worker: bbo1-2 Build Reason: (unknown) Blamelist: Aaron Merey Steps: - 0: worker_preparation ( success ) - 1: set package name ( success ) - 2: git checkout ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/2/logs/stdio - 3: autoreconf ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/3/logs/stdio - 4: configure ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/4/logs/stdio - config.log: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/4/logs/config_log - 5: get version ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/5/logs/stdio - property changes: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/5/logs/property_changes - 6: make ( warnings ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/6/logs/stdio - warnings (3): https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/6/logs/warnings__3_ - 7: make check ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/7/logs/stdio - test-suite.log: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/7/logs/test-suite_log - 8: make distcheck ( warnings ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/8/logs/stdio - test-suite.log: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/8/logs/test-suite_log - warnings (6): https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/8/logs/warnings__6_ - 9: make rpmbuild ( warnings ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/9/logs/stdio - warnings (30): https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/9/logs/warnings__30_ - 10: prep ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/10/logs/stdio - 11: build bunsen.cpio.gz ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/11/logs/stdio - 12: fetch bunsen.cpio.gz ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/12/logs/stdio - 13: unpack bunsen.cpio.gz ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/13/logs/stdio - 14: pass .bunsen.source.* ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/14/logs/stdio - 15: upload to bunsen ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/15/logs/stdio - 16: clean up ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/16/logs/stdio - 17: make distclean ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/414/steps/17/logs/stdio
Re: [PATCH] libelf: elf_compress doesn't handle multiple elf_newdata chunks correctly
Hi Aaron, On Fri, Oct 18, 2024 at 12:08:11AM -0400, Aaron Merey wrote: > LGTM. The new testcases pass on the trybots. And when I revert the > elf_compress.c changes and run the new tests they fail as expected, so > the elf_compress.c changes do in fact fix PR32102. Thanks, pushed. Cheers, Mark
Re: [PATCH] doc: Add libelf man page
Hi Aaron, I think if still possible you should include this in the release. I made some comments below, but they can be addressed later. They are just clarifications. On Fri, 2024-10-18 at 00:02 -0400, Aaron Merey wrote: > Signed-off-by: Aaron Merey > --- > config/elfutils.spec.in | 1 + > doc/Makefile.am | 3 +- > doc/libelf.3| 363 > 3 files changed, 366 insertions(+), 1 deletion(-) > create mode 100644 doc/libelf.3 > > diff --git a/config/elfutils.spec.in b/config/elfutils.spec.in > index 0d1ec11b..dcaa85b3 100644 > --- a/config/elfutils.spec.in > +++ b/config/elfutils.spec.in > @@ -304,6 +304,7 @@ fi > %{_mandir}/man3/elf_*.3* > %{_mandir}/man3/elf32_*.3* > %{_mandir}/man3/elf64_*.3* > +%{_mandir}/man3/libelf.3 > > %files libelf-devel-static > %{_libdir}/libelf.a > diff --git a/doc/Makefile.am b/doc/Makefile.am > index ceb6fd2d..c95369e9 100644 > --- a/doc/Makefile.am > +++ b/doc/Makefile.am > @@ -57,7 +57,8 @@ notrans_dist_man3_MANS= elf_update.3 \ > elf32_fsize.3 \ > elf64_fsize.3 \ > elf32_checksum.3 \ > - elf64_checksum.3 > + elf64_checksum.3 \ > + libelf.3 > > # libdebuginfod man pages (also notrans) > # Note we include them even when not building them because we want > diff --git a/doc/libelf.3 b/doc/libelf.3 > new file mode 100644 > index ..e6fb1a1b > --- /dev/null > +++ b/doc/libelf.3 > @@ -0,0 +1,363 @@ > +.TH LIBELF 3 2024-10-18 "Libelf" "Libelf Programmer's Manual" > + > +.SH NAME > +libelf \- a library for accessing and manipulating ELF (Executable and > Linkable > +Format) files > +.SH LIBRARY > +Elfutils library (\fBlibelf\fP, \fBlibelf.so\fP, \fB-lelf\fP) > +.SH SYNOPSIS > +.nf > +.B #include > + > +.SH DESCRIPTION > +The \fBlibelf\fP library provides an API for reading, writing, and > manipulating > +ELF (Executable and Linkable Format) files. ELF is a standard format for > object > +files, shared libraries, core dumps, and executables. See > +.BR elf (5) > +for more information regarding ELF. > + > +\fBlibelf\fP provides routines for working with ELF object file headers, > +sections, symbol tables, relocation entries, and other key components. I would s/key components/ELF data structures/ > +The core of the library is based on > +.I Elf > +file descriptors representing ELF files, which can be read from, written to, > +or updated in-place. The \fBelf_begin\fP function initializes access to an > +ELF object, while additional functions like \fBelf_getscn\fP, > \fBelf_getdata\fP, > +and \fBelf_ndxscn\fP provide access to specific parts of the ELF file. I would move the general part about there being 32-bit (ELFCLASS32) and 64-bit (ELFCLASS64) objects and that there are specific elf32 and elf64 functions for manipulating each of them from NAMESPACE below here just before MEMORY REPRESENTATION. > +.SH FILE VS MEMORY REPRESENTATION > + > +The \fBlibelf\fP library distinguishes between the file representation of an > +ELF file and its memory representation. > + > +.PP > +File Representation refers to the format in which an ELF file is stored on > disk. > +The fields in the file may use specific sizes, alignment, and byte ordering > +(endianness) that could be different from the native format used by the host > +system. > + > +.PP > +Memory Representation refers to the way the ELF data is organized when loaded > +into an application's memory. In memory, the data structures are typically > +converted into the native format of the host system (e.g., the system's > +endianness, word size, and alignment). > + > +.PP > +\fBlibelf\fP provides the following functions to translate ELF data between > +file and memory representations: > +.BR elf32_xlatetom , > +.BR elf64_xlatetom , > +.BR elf32_xlatetof , > +and > +.BR elf64_xlatetof . > + > +See > +.BR elf32_xlatetom (3) > +for more information. > + > +.SH ELF VERSION > + > +To account for the possibility of multiple versions of the ELF specification, > +the ELF version number must be specified with the \fBelf_version\fP function > +before any other \fBlibelf\fP functions. Maybe add: ... are called. Otherwise they might return an error. > This function sets \fBlibelf\fP's ELF > +version to the specified value. At this time the only supported ELF version > is > +\fBEV_CURRENT\fP. > > +.SH DESCRIPTORS > +.I Elf > +descriptors the central \fBlibelf\fP object for accessing and manipulating > +ELF files. They are created with the > +.BR elf_begin , > +.BR elf_clone , > +and > +.B elf_memory > +functions and closed with the > +.B elf_end > +function. > + > +\fBlibelf\fP also provides > +.I Elf_Scn > +and > +.I Elf_Data > +descriptors for ELF sections and section contents, respectively. Members > +of the > +.I Elf_Data > +struct are described below. > +Members of the > +.I Elf > +and > +.I Elf_Scn > +structs are hidden from applic
☠ Buildbot (Sourceware): elfutils - failed test (failure) (main)
A new failure has been detected on builder elfutils-fedora-x86_64 while building elfutils. Full details are available at: https://builder.sourceware.org/buildbot/#/builders/59/builds/412 Build state: failed test (failure) Revision: db597d916a9c887ee60e0422ea7100d9ecf03dff Worker: bb1-2 Build Reason: (unknown) Blamelist: Aaron Merey Steps: - 0: worker_preparation ( success ) - 1: set package name ( success ) - 2: git checkout ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/2/logs/stdio - 3: autoreconf ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/3/logs/stdio - 4: configure ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/4/logs/stdio - config.log: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/4/logs/config_log - 5: get version ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/5/logs/stdio - property changes: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/5/logs/property_changes - 6: make ( warnings ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/6/logs/stdio - warnings (3): https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/6/logs/warnings__3_ - 7: make check ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/7/logs/stdio - test-suite.log: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/7/logs/test-suite_log - 8: make distcheck ( warnings ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/8/logs/stdio - test-suite.log: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/8/logs/test-suite_log - warnings (6): https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/8/logs/warnings__6_ - 9: make rpmbuild ( failure ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/9/logs/stdio - warnings (30): https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/9/logs/warnings__30_ - 10: prep ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/10/logs/stdio - 11: build bunsen.cpio.gz ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/11/logs/stdio - 12: fetch bunsen.cpio.gz ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/12/logs/stdio - 13: unpack bunsen.cpio.gz ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/13/logs/stdio - 14: pass .bunsen.source.* ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/14/logs/stdio - 15: upload to bunsen ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/15/logs/stdio - 16: clean up ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/16/logs/stdio - 17: make distclean ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/59/builds/412/steps/17/logs/stdio A new failure has been detected on builder elfutils-debian-ppc64 while building elfutils. Full details are available at: https://builder.sourceware.org/buildbot/#/builders/63/builds/408 Build state: failed test (failure) Revision: db597d916a9c887ee60e0422ea7100d9ecf03dff Worker: debian-ppc64 Build Reason: (unknown) Blamelist: Aaron Merey Steps: - 0: worker_preparation ( success ) - 1: set package name ( success ) - 2: git checkout ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/408/steps/2/logs/stdio - 3: autoreconf ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/408/steps/3/logs/stdio - 4: configure ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/408/steps/4/logs/stdio - config.log: https://builder.sourceware.org/buildbot/#/builders/63/builds/408/steps/4/logs/config_log - 5: get version ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/408/steps/5/logs/stdio - property changes: https://builder.sourceware.org/buildbot/#/builders/63/builds/408/steps/5/logs/property_changes - 6: make ( warnings ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/408/steps/6/logs/stdio - warnings (4): https://builder.sourceware.org/buildbo
☺ Buildbot (Sourceware): elfutils - build successful (main)
A restored build has been detected on builder elfutils-debian-ppc64 while building elfutils. Full details are available at: https://builder.sourceware.org/buildbot/#/builders/63/builds/409 Build state: build successful Revision: 45104c731665de1ad6d796c508b9ee1ef84fc67b Worker: debian-ppc64 Build Reason: (unknown) Blamelist: Aaron Merey Steps: - 0: worker_preparation ( success ) - 1: set package name ( success ) - 2: git checkout ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/2/logs/stdio - 3: autoreconf ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/3/logs/stdio - 4: configure ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/4/logs/stdio - config.log: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/4/logs/config_log - 5: get version ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/5/logs/stdio - property changes: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/5/logs/property_changes - 6: make ( warnings ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/6/logs/stdio - warnings (4): https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/6/logs/warnings__4_ - 7: make check ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/7/logs/stdio - test-suite.log: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/7/logs/test-suite_log - 8: prep ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/8/logs/stdio - 9: build bunsen.cpio.gz ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/9/logs/stdio - 10: fetch bunsen.cpio.gz ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/10/logs/stdio - 11: unpack bunsen.cpio.gz ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/11/logs/stdio - 12: pass .bunsen.source.* ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/12/logs/stdio - 13: upload to bunsen ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/13/logs/stdio - 14: clean up ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/14/logs/stdio - 15: make distclean ( success ) Logs: - stdio: https://builder.sourceware.org/buildbot/#/builders/63/builds/409/steps/15/logs/stdio
[COMMITTED] config/elfutils.spec.in: Add missing wildcard
Replace %{_mandir}/man3/libelf.3 with %{_mandir}/man3/libelf.3* to account for possible compression-related file extension. Signed-off-by: Aaron Merey --- config/elfutils.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/elfutils.spec.in b/config/elfutils.spec.in index 1626a568..e63a3c10 100644 --- a/config/elfutils.spec.in +++ b/config/elfutils.spec.in @@ -304,7 +304,7 @@ fi %{_mandir}/man3/elf_*.3* %{_mandir}/man3/elf32_*.3* %{_mandir}/man3/elf64_*.3* -%{_mandir}/man3/libelf.3 +%{_mandir}/man3/libelf.3* %files libelf-devel-static %{_libdir}/libelf.a -- 2.46.2
Re: [PATCH] doc: Add libelf man page
On Fri, Oct 18, 2024 at 11:59 AM Mark Wielaard wrote: > > I think if still possible you should include this in the release. > I made some comments below, but they can be addressed later. They are > just clarifications. Thanks Mark, pushed. Will update after the release. (Discussed on IRC but repeating here). Aaron
Re: elf_memory again, readonly or readwrite...
Hi Mark, On Fri, Oct 18, 2024 at 11:03 AM Mark Wielaard wrote: > > I waited too long deciding what to do here. Sorry. We are about to make > the 0.192 release today. If it isn't too late then I would like to > apply my proposed patch (as attached). > > It isn't ideal, but it basically reverts to the behavior of elfutils > 0.190. So you can again do direct manipulation on ELF images created > through elf_memory. So in that way it was a regression in 0.191, fixed > for 0.192. > > It does mean that if the memory you gave elf_memory is read-only and > you call elf_compress on one of the sections things might crash > (because elf_compress will try to update the Elf_Shdr structure in > place to set the new size). Which indeed could be seen as a regression > from 0.191 (but was there before). If you do want to decompress (or > otherwise manipulate) the ELF image created through elf_memory you have > to do what the testcase (now) does. mmap the image using MMAP_PRIVATE > so it is (copy-on-)writable. > > Longer term we probably want a new elf_memory2 function that takes an > argument describing the protection bits of the given memory. > > Aaron, is it OK to commit this before you start the 0.192 release > process? This is fine, please go ahead and merge. Aaron
elfutils 0.192 released
ELFUTILS 0.192 "New rules, faster tools" - https://elfutils.org/ A new release of elfutils is available at: ftp://sourceware.org/pub/elfutils/0.192/ or https://sourceware.org/elfutils/ftp/0.192/ Visit us on the Libera.Chat irc channel #elfutils * NEWS * CONDUCT: A new code of conduct has been adopted. See the CONDUCT file for more information. debuginfod: Add per-file signature verification for integrity checking, using RPM IMA scheme from Fedora/RHEL. New API for metadata queries: file name -> buildid. Server-side extraction of files from kernel debuginfo packages is significantly faster. Now takes < 0.25 seconds, down from ~50 seconds. libdw: New functions dwfl_set_sysroot, dwfl_frame_unwound_source and dwfl_unwound_source_str. stacktrace: Experimental new tool that can process a stream of stack samples from the Sysprof profiler and unwind them into call chains. Enable on x86 with --enable-stacktrace. See README.eu-stacktrace in the development branch for detailed usage instructions: https://sourceware.org/cgit/elfutils/tree/README.eu-stacktrace?h=users/serhei/eu-stacktrace * GIT SHORTLOG * Aaron Merey (29): libdw: dwarf_getsrcfiles should not imply dwarf_getsrclines tests/.gitignore: Use correct spelling for get-files-define-file config/profile.fish.in: Prevent bracketed variables and unmatched wildcard errors Fix 'make coverage' when used with lcov version 2.0+ Makefile.am: Avoid code duplication debuginfod: PR28204 config/profile.fish.in config/Makefile.am: Modify profile.fish in all-local Update code of conduct Add man pages for some libelf functions elfutils.spec.in: Package elf32_* and elf64_* man pages tests/Makefile.am: Add run-sysroot.sh to EXTRA_DIST tests/run-sysroot.sh: Avoid testing output that depends on LZMA support tests/run-sysroot.sh: Delete file with tempfiles tests/run-sysroot.sh: Call exit_cleanup directly strip.c: Apply --permissive when writing the debug file Add man pages for some libelf functions configure.ac: Restore HAVE_LIBARCHIVE doc: Add elf32_checksum.3 and elf64_checksum.3 doc: Add elf32_fsize.3 and elf64_fsize.3 doc: Add elf32_getchdr.3 and elf64_getchdr.3 doc: Add elf32_getphdr.3 and elf64_getphdr.3 doc: Add elf32_getshdr.3 and elf64_getshdr.3 doc: Add elf32_newehdr.3 and elf64_newehdr.3 doc: Add elf32_newphdr.3 and elf64_newphdr.3 doc: Add elf{32,64}_xlatetof.3 and elf{32,64}_xlatetom.3 doc/Makefile.am: Add man pages doc: Add libelf man page Prepare for 0.192 config/elfutils.spec.in: Add missing wildcard Aleksei Vetrov (1): libdwfl: Make dwfl_report_offline_memory work with ELF_C_READ_MMAP Alfred Wingate (1): Avoid overriding libcxx system header Andreas Schwab (1): backends/riscv: Remove unused relocations Di Chen (1): PR31103: git authorship correction Frank Ch. Eigler (11): PR31103: debuginfod: periodically call malloc_trim(0) PR31637: debuginfod-find -v SIGSEGV Support nullglob in profile.sh.in PR29472: debuginfod: add metadata query webapi, C api, client debuginfod-client tweak for alma buildbot rework debuginfod configury PR31866: reenable --enable-libdebuginfod=dummy debuginfod: service metadata queries in separate, timed-out connections debuginfod: Make sure extra libs are also included in static link in src/ too tests/test-subr.sh: Put test_dir under /var/tmp. PR32218: debuginfod-client: support very long source file names Frederik “Freso” S. Olesen (1): config: Add profile script for fish shell German Gomez (3): aarch64: Create definitions for AARCH64_RA_SIGN_STATE register libdw, aarch64: Implement DW_CFA_AARCH64_negate_ra_state CFI instruction libdwfl, aarch64: Demangle return addresses using a PAC mask Heather McIntyre (7): libelf: Fix deadlock in __libelf_readall libelf: Fix deadlock in elf_cntl lib: Add eu_tsearch, eu_tfind, eu_tdelete and eu_tdestroy libdw: make dwarf_getalt and dwarf_setalt thread-safe libdwP.h: Add locking to __libdw_dieabbrev libdw: Make libdw_find_split_unit thread-safe libdw: Make libdw_findcu thread-safe Jose Quaresma (1): srcfiles: fix unused variable BUFFER_SIZE Khem Raj (2): debuginfod: Remove unused variable tests: Fix specifying constant of double type Kuan-Ying Lee (3): aarch64: Add NT_ARM_TAGGED_ADDR_CTRL regset aarch64: add some new core note types name aarch64: Add NT_ARM_PAC_* regset Luca Boccassi (1): readelf: add pretty printing for FDO Dlopen Metadata note Luke Diamand (2): libdwfl: specify optional sysroot to search for shared libraries and binaries eu-stack: add support for sysroot option M
[Bug libelf/32102] elf_compress doesn't handle multiple Elf_Data chunks created with elf_newdata correctly
https://sourceware.org/bugzilla/show_bug.cgi?id=32102 Mark Wielaard changed: What|Removed |Added Resolution|--- |FIXED Status|ASSIGNED|RESOLVED --- Comment #2 from Mark Wielaard --- commit 43179302d7041e562a9df97165ed15c1c2c7bc22 Author: Mark Wielaard Date: Tue Aug 20 17:59:01 2024 +0200 libelf: elf_compress doesn't handle multiple elf_newdata chunks correctly elf_compress would compress all (new) data chunks, but didn't reset the section data_list. This would cause extra data to be returned after decompression or create bad compressed data. Add a new testcase for this and explicitly zap the scn->data_list before resetting the elf section raw data after (de)compression. * libelf/elf_compress.c (__libelf_reset_rawdata): Cleanup scn->data_list. * tests/newzdata.c: New testcase. * tests/Makefile.am (check_PROGRAMS): Add newzdata. (TESTS): Likewise. (newzdata_LDADD): New variable. https://sourceware.org/bugzilla/show_bug.cgi?id=32102 Signed-off-by: Mark Wielaard -- You are receiving this mail because: You are on the CC list for the bug.