Bug 1674430 - RFE: support reading compressed ELF objects
Summary: RFE: support reading compressed ELF objects
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: elfutils
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.1
Assignee: Mark Wielaard
QA Contact: Martin Cermak
Vladimír Slávik
URL:
Whiteboard:
Depends On: 1682591 1683705
Blocks: 1701002 1650074
TreeView+ depends on / blocked
 
Reported: 2019-02-11 10:50 UTC by Panu Matilainen
Modified: 2021-09-17 14:44 UTC (History)
4 users (show)

Fixed In Version: elfutils-0.176-1.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-05 22:18:00 UTC
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:3575 0 None None None 2019-11-05 22:18:19 UTC

Description Panu Matilainen 2019-02-11 10:50:12 UTC
Description of problem:

From the description of bug 1650074:
> 
> There are no /usr/lib/.build-id /usr/lib/debug/.build-id
> links for kernel modules in kernel rpms like there used to be.
> 
> The problem seems to be in rpmbuild which is not able to
> read compressed kernel module files and wouldn't add their
> .build-id links to the rpm.
> 
> Solution was discussed with Mark Wielaard to used elfutils 0.175
> which supports compressed elf objects via dwelf_elf_begin:
> 
> > /* Creates a read-only Elf handle from the given file handle.  The
> >    file may be compressed and/or contain a linux kernel image header,
> >    in which case it is eagerly decompressed in full and the Elf handle
> >    is created as if created with elf_memory ().  On error NULL is
> >    returned.  The Elf handle should be closed with elf_end ().  The
> >    file handle will not be closed.  Does not return ELF_K_NONE
> > handles.  */
> > extern Elf *dwelf_elf_begin (int fd);
> 
> elfutils 0.175 should be released shortly.

Elfutils rebase (or backport of the feature) is needed to fix this in rpm, this bug is for tracking the elfutils side of things.

Comment 1 Mark Wielaard 2019-05-10 20:24:33 UTC
The elfutils 0.176 rebase provides the new dwelf_elf_begin () function.

Comment 3 Mark Wielaard 2019-05-21 09:18:26 UTC
For testing purposes you could of course look to see that dwelf_elf_begin is now in libdwelf.h and libdw.so.
Also eu-readelf now takes advantage of dwelf_elf_begin() to directly read compressed ELF files.
An example are linux kernel modules. Take for example a random one like:
/usr/lib/modules/3.10.0-957.12.2.el7.x86_64/kernel/fs/xfs/xfs.ko.xz

Before this change:
$ eu-readelf -n xfs.ko.xz 
eu-readelf: cannot create EBL handle
$ echo $?
1

After this change:
$ eu-readelf -n xfs.ko.xz 

Note section [ 1] '.note.gnu.build-id' of 36 bytes at offset 0x40:
  Owner          Data size  Type
  GNU                   20  GNU_BUILD_ID
    Build ID: 57949197896368b658cc27fd62191a7ca345826c
$ echo $?
0

Comment 6 errata-xmlrpc 2019-11-05 22:18:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:3575


Note You need to log in before you can comment on or make changes to this bug.