Bug 489439 - 0.140 regression: dwfl_module_build_id yields wrong vaddr for ET_DYN
Summary: 0.140 regression: dwfl_module_build_id yields wrong vaddr for ET_DYN
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: elfutils
Version: 10
Hardware: i686
OS: Linux
low
medium
Target Milestone: ---
Assignee: Roland McGrath
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-03-10 02:45 UTC by Frank Ch. Eigler
Modified: 2009-05-20 23:53 UTC (History)
2 users (show)

Fixed In Version: 0.141-1.fc10
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-05-09 03:56:12 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Frank Ch. Eigler 2009-03-10 02:45:12 UTC
Description of problem:
The build-id vaddr appears to be miscomputed for an i686 prelinked
ET_DYN object such as /lib/libc-2.9.so.

Version-Release number of selected component (if applicable):
0.140, bisected to commit 31fd654

How reproducible:
always

Steps to Reproduce:
1. run stap -e 'probe process("SOMETHING.so").function("*"){}' -p4 --vp003 | grep 0x
2. observe SOMETHING.so module base address and build-id vaddr
  
Actual results:
build-id vaddr < module base
dump_unwindsyms /lib/libc-2.9.so index=0 base=0x7e73000
Found build-id in /lib/libc-2.9.so, length 20, end at 0x7e63198

Expected results:
build-id vaddr > module base
dump_unwindsyms /lib/libc-2.9.so index=0 base=0x7e73000
Found build-id in /lib/libc-2.9.so, length 20, end at 0x7e73198

Additional info:
http://sourceware.org/ml/systemtap/2009-q1/msg00513.html

[fche@pocket]~/systemtap/elfutils% eu-readelf -l /lib/libc-2.9.so
Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz  MemSiz   Flg Align
  PHDR           0x000034 0x07e63034 0x07e63034 0x000140 0x000140 R E 0x4
  INTERP         0x146ae0 0x07fa9ae0 0x07fa9ae0 0x000013 0x000013 R   0x1
	[Requesting program interpreter: /lib/ld-linux.so.2]
  LOAD           0x000000 0x07e63000 0x07e63000 0x16db78 0x16db78 R E 0x1000
  LOAD           0x16e1e4 0x07fd11e4 0x07fd11e4 0x002798 0x00546c RW  0x1000
  DYNAMIC        0x16fd7c 0x07fd2d7c 0x07fd2d7c 0x0000f8 0x0000f8 RW  0x4
  NOTE           0x000174 0x07e63174 0x07e63174 0x000044 0x000044 R   0x4
  TLS            0x16e1e4 0x07fd11e4 0x07fd11e4 0x000008 0x000040 R   0x4
  GNU_EH_FRAME   0x146af4 0x07fa9af4 0x07fa9af4 0x0069f4 0x0069f4 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x000000 0x000000 RW  0x4
  GNU_RELRO      0x16e1e4 0x07fd11e4 0x07fd11e4 0x001e1c 0x001e1c R   0x1

 Section to Segment mapping:
  Segment Sections...
   00     
   01      [RO: .interp]
   02      [RO: .note.gnu.build-id .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_d .gnu.version_r .rel.dyn .rel.plt .plt .text __libc_freeres_fn __libc_thread_freeres_fn .rodata .interp .eh_frame_hdr .eh_frame .gcc_except_table .hash]
   03      [RELRO: .tdata .tbss .fini_array .ctors .dtors __libc_subfreeres __libc_atexit __libc_thread_subfreeres .data.rel.ro .dynamic .got] <RELRO: .got.plt> .data .bss
   04      [RELRO: .dynamic]
   05      [RO: .note.gnu.build-id .note.ABI-tag]
   06      [RELRO: .tdata .tbss .fini_array .ctors .dtors]
   07      [RO: .eh_frame_hdr]
   08     
   09      [RELRO: .tdata .tbss .fini_array .ctors .dtors __libc_subfreeres __libc_atexit __libc_thread_subfreeres .data.rel.ro .dynamic .got]

Comment 1 Roland McGrath 2009-03-10 03:45:30 UTC
Fixed in upstream commit 8651c5e.

A workaround would be to see if the vaddr falls outside the module bounds (or just check _ELFUTILS_PREREQ, I guess), and if so, apply the main file's bias (the one returned by dwfl_module_getelf) to it.

Comment 2 Mark Wielaard 2009-03-30 09:40:05 UTC
systemtap now contains a workaround for this issue:

Author: Mark Wielaard <mjw>
Date:   Mon Mar 16 14:19:20 2009 +0100

    Add workaround for dwfl_module_build_id bug with elfutils < 0.140.
    
    * translate.cxx (dump_unwindsyms): Check elfutils version and whether
      build_id_vaddr < base, and if so add main_bias to address.

Comment 3 Fedora Update System 2009-04-24 22:46:38 UTC
elfutils-0.141-1.fc9 has been submitted as an update for Fedora 9.
http://admin.fedoraproject.org/updates/elfutils-0.141-1.fc9

Comment 4 Fedora Update System 2009-04-24 22:46:52 UTC
elfutils-0.141-1.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/elfutils-0.141-1.fc10

Comment 5 Fedora Update System 2009-04-27 21:31:42 UTC
elfutils-0.141-1.fc10 has been pushed to the Fedora 10 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'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F10/FEDORA-2009-3994

Comment 6 Fedora Update System 2009-04-27 21:35:45 UTC
elfutils-0.141-1.fc9 has been pushed to the Fedora 9 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-newkey update elfutils'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F9/FEDORA-2009-4018

Comment 7 Fedora Update System 2009-05-09 03:55:59 UTC
elfutils-0.141-1.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2009-05-09 04:20:10 UTC
elfutils-0.141-1.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2009-05-19 21:58:31 UTC
elfutils-0.141-1.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/elfutils-0.141-1.fc11

Comment 10 Fedora Update System 2009-05-20 23:53:27 UTC
elfutils-0.141-1.fc11 has been pushed to the Fedora 11 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.