Bug 249467 - eu-readelf -n vs .debug files
eu-readelf -n vs .debug files
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: elfutils (Show other bugs)
rawhide
All Linux
low Severity low
: ---
: ---
Assigned To: Roland McGrath
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-07-24 16:32 EDT by Jan Kratochvil
Modified: 2007-11-30 17:12 EST (History)
0 users

See Also:
Fixed In Version: 0.131-1.fc7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-11-12 19:13:26 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jan Kratochvil 2007-07-24 16:32:56 EDT
Description of problem:
eu-strip debug file separation corrupts the embedded build-id note.

Version-Release number of selected component (if applicable):
elfutils-0.128-2.fc7.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. echo 'int main (void) { return 0; }' >main.c;gcc -o main main.c
-Wl,--build-id;echo ORIG;eu-readelf -a main|grep -A99 Owner;eu-strip
--strip-debug -f main.debug main;echo STRIPPED-BASE;eu-readelf -a main|grep -A99
Owner;echo STRIPPEd-DEBUG;eu-readelf -a main.debug|grep -A99 Owner

Actual results:
ORIG
  Owner          Data size  Type
  GNU                   16  VERSION
    OS: Linux, ABI: 2.6.9
  GNU                   20  <unknown>: 3
STRIPPED-BASE
  Owner          Data size  Type
  GNU                   16  VERSION
    OS: Linux, ABI: 2.6.9
  GNU                   20  <unknown>: 3
STRIPPEd-DEBUG
  Owner          Data size  Type
                        4  <unknown>: 20

Expected results:
ORIG
  Owner          Data size  Type
  GNU                   16  VERSION
    OS: Linux, ABI: 2.6.9
  GNU                   20  <unknown>: 3
STRIPPED-BASE
  Owner          Data size  Type
  GNU                   16  VERSION
    OS: Linux, ABI: 2.6.9
  GNU                   20  <unknown>: 3
STRIPPEd-DEBUG
  Owner          Data size  Type
  GNU                   16  VERSION
    OS: Linux, ABI: 2.6.9
  GNU                   20  <unknown>: 3

Additional info:
Comment 1 Roland McGrath 2007-07-24 16:48:51 EDT
There is no problem in eu-strip, just in eu-readelf.  It uses the phdrs instead
of sections to look for notes.  readelf (bintuils) will show you that the
contents are fine.  It's on my list to make eu-readelf handle notes in .debug
files, but it is not a big priority.
Comment 2 Jan Kratochvil 2007-07-25 14:43:58 EDT
ELF first pages in the core files have corrupted/missing SHDR as it just does
not fit there.  So one needs to locate NT_GNU_BUILD_ID from the core files by
PHDR only.  This cannot be changed.

But separate .debug files have only the corrupted (not updated) PHDR offsets 
while SHDR is right there.

Wouldn't it be best to implement/fix PHDR offsets updating in EU-STRIP?
The debug-id consumers now need a workaround to differentiate looking up the
build-id NOTE in the ELF main file from the core (PHDR) the ELF separate debug
file (SHDR).
Comment 3 Roland McGrath 2007-09-11 15:45:58 EDT
No, it's best that phdrs remain untouched by strip.

The proper procedure should be to use shdrs when available and phdrs when not.
When you have a partial or corrupt ELF file such that the shdrs are not usable,
then shdrs are not available, so don't use them.
Comment 4 Roland McGrath 2007-10-03 20:04:43 EDT
I have changed readelf upstream to use sections in preference to phdrs.
This should be fixed in 0.130.
Comment 5 Roland McGrath 2007-10-16 05:57:53 EDT
This issue should be resolved by elfutils-0.130.  If there is still a problem,
reopen or file a new bug report with complete test case details.
Comment 6 Fedora Update System 2007-10-17 22:30:52 EDT
elfutils-0.130-3.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update elfutils'
Comment 7 Fedora Update System 2007-11-12 19:13:20 EST
elfutils-0.131-1.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.

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