Bug 971411 - dwz .gnu_debugaltlink filename link fails (w/o build-id)
dwz .gnu_debugaltlink filename link fails (w/o build-id)
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: elfutils (Show other bugs)
rawhide
Unspecified Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Roland McGrath
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-06 08:59 EDT by Jan Kratochvil
Modified: 2014-07-02 04:14 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-07-02 04:14:13 EDT
Type: Bug
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 2013-06-06 08:59:56 EDT
Description of problem:
Without /usr/lib/debug/.build-id eu-readelf no longer works.

Version-Release number of selected component (if applicable):
elfutils-0.155-1.fc18.x86_64
24b26ec1aaf4dc87d274f1786a1ad83b3ec2ba25

How reproducible:
Always.

Steps to Reproduce:
rm -rf /usr/lib/debug/.build-id
eu-readelf -w /usr/lib/debug/usr/bin/cal.debug

Actual results:
open("../../.dwz/util-linux-2.22.2-6.fc18.x86_64", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/debug/.build-id/7c/7d537396447a43f436aed7d86c51da3c404cd6.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
eu-readelf: cannot get attribute value: no alternative debug link found
eu-readelf: cannot get attribute value: no alternative debug link found
eu-readelf: cannot get attribute value: no alternative debug link found

Expected results:
open("/usr/lib/debug/usr/bin/../../.dwz/util-linux-2.22.2-6.fc18.x86_64", O_RDONLY) = 42

Additional info:
The .gnu_debugaltlink filename was IMO meant to be relative to the parent .debug file.

This affects uninstalled debug infos.
Comment 1 Mark Wielaard 2013-06-06 09:27:21 EDT
> rm -rf /usr/lib/debug/.build-id

May I suggest you don't do that :)

Could you give an actual example (where the user doesn't blow away the system .build-id directory)? I do think this is a bug. But I am wondering how common this is. In general dwz is a system/packager tool, installing .debug and dwz multi files without corresponding build-ids would normally be a packaging bug.

.gnu_debugaltlink being relative to the .debug file makes sense. But that is somewhat hard to get at in general. We don't know where the given Elf for a Dwarf comes from (it might not even be a file).

The original design had new libdw methods dwarf_getalt () and dwarf_addalt () that let you set it on a new Dwarf. Those didn't make it in the final patch. We might have to introduce those then, so eu-readelf can use them to explicitly set when they cannot be found by build-id.

See https://lists.fedorahosted.org/pipermail/elfutils-devel/2012-June/002352.html for the original design including those methods.
Comment 2 Jan Kratochvil 2013-06-06 09:38:48 EDT
(In reply to Mark Wielaard from comment #1)
> Could you give an actual example (where the user doesn't blow away the
> system .build-id directory)?

rpmbuildlocal -bb prelink.spec
exx prelink-debuginfo-0.5.0-1.fc19.x86_64.rpm
eu-readelf --debug-dump=info prelink-debuginfo-0.5.0-1.fc19.x86_64/usr/lib/debug/usr/sbin/prelink.debug

The first two lines are custom scripts with obvious functionality.


So Dwarf maybe should contain its filename.
Comment 3 Fedora End Of Life 2013-12-21 08:53:31 EST
This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '18'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior to Fedora 18's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 4 Mark Wielaard 2013-12-21 12:07:27 EST
This is still an issue as discussed in a recent thread on elfutils-devel:
https://lists.fedorahosted.org/pipermail/elfutils-devel/2013-December/thread.html#3585
Comment 5 Mark Wielaard 2014-07-02 04:14:13 EDT
This was fixed in elfutils 0.159.

libdw: Support for DWZ multifile forms DW_FORM_GNU_ref_alt and
       DW_FORM_GNU_strp_alt is now enabled by default and no longer
       experimental. Added new functions dwarf_getalt and dwarf_setalt
       to get or set the alternative debug file used for the alt FORMs.

libdwfl: The dwfl_build_id_find_debuginfo and dwfl_standard_find_debuginfo
         functions will now try to resolve and set the alternative debug file.

That last change makes sure that if the build-id based approach doesn't work the fallback using a relative path name is used.

eu-readelf uses libdwfl to open the .debug file and so gets the dwz alt-file resolved automagically.

With elfutils-0.159-1.fc21.x86_64, util-linux-debuginfo-2.25-0.2.fc21.x86_64 and sudo mv /usr/lib/debug/.build-id /usr/lib/debug/no.build-id

$ strace -e trace=open eu-readelf --debug-dump=info /usr/lib/debug/usr/bin/cal.debug

open("/usr/lib/debug/.build-id/46/828366f0fe68634cfc16f27440598388d7b3df.debug", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/debug/usr/bin/../../.dwz/util-linux-2.25-0.2.fc21.x86_64", O_RDONLY) = 4

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