Bug 849435

Summary: phdrs wrong in .debug file
Product: [Fedora] Fedora Reporter: Mark Wielaard <mjw>
Component: prelinkAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jakub
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-29 08:45:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Mark Wielaard 2012-08-19 12:55:29 UTC
Take bash as example. bash-debuginfo-4.2.37-3.fc18.x86_64

$ eu-readelf -S /usr/lib/debug/usr/bin/bash.debug | grep NOTE
[ 2] .note.ABI-tag        NOTE         0000000000400254 00000238 00000020  0 A      0   0  4
[ 3] .note.gnu.build-id   NOTE         0000000000400274 00000258 00000024  0 A      0   0  4

$ eu-readelf -l /usr/lib/debug/usr/bin/bash.debug | grep NOTE
  NOTE           0x000254 0x0000000000400254 0x0000000000400254 0x000044 0x000044 R   0x4

The section header is correct, the first NOTE offset is 238. The program header offset is wrong.

This makes programs like valgrind which find the build-id through phdrs fail (I have a patch to make it use the shdr fallback in this case).

Comment 1 Fedora Update System 2012-08-19 18:51:37 UTC
valgrind-3.8.0-4.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/valgrind-3.8.0-4.fc18

Comment 2 Fedora Update System 2012-08-27 10:32:13 UTC
valgrind-3.8.0-5.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/valgrind-3.8.0-5.fc18

Comment 3 Fedora Update System 2012-08-27 16:30:00 UTC
Package valgrind-3.8.0-5.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing valgrind-3.8.0-5.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-12754/valgrind-3.8.0-5.fc18
then log in and leave karma (feedback).

Comment 4 Mark Wielaard 2012-08-28 21:36:10 UTC
Clearly I shouldn't have mentioned this bug in the valgrind package workaround. Sorry about the Fedora Update System noise.

As should be clear when I filed this bug, this isn't dwz. bash only has one .debug file, so dwz doesn't even run...

What is happening is that prelink comes along and rewrites the binary phdrs, while the .debug phdrs stay the same.

Reassigning to prelink.

Comment 5 Mark Wielaard 2012-08-29 08:45:34 UTC
Jakub explained: prelink doesn't by design adjust phdrs in the *.debug files, only in the binaries/libraries. After all, often the *-debuginfo* packages aren't even installed at all when prelinking. The phdrs in the *.debug files are there on purpose, tools using the *.debug files are supposed to compare the phdrs in the *.debug file with phdrs in the binary/executable and from that derive the prelinking bias and other shuffles prelink did.

So in general it is wrong to use phdrs in a .debug file to locate the build-id note. Use shdrs for that.

Comment 6 Fedora Update System 2012-09-17 23:39:49 UTC
valgrind-3.8.0-5.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2012-09-21 00:52:52 UTC
valgrind-3.8.1-1.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/valgrind-3.8.1-1.fc18

Comment 8 Fedora Update System 2012-09-25 16:36:19 UTC
valgrind-3.8.1-1.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.