Bug 588818 - core file module detection confused by core from a PIE
core file module detection confused by core from a PIE
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: elfutils (Show other bugs)
rawhide
All Linux
low Severity medium
: ---
: ---
Assigned To: Roland McGrath
Fedora Extras Quality Assurance
:
Depends On: 579038
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-04 12:51 EDT by Denys Vlasenko
Modified: 2010-07-06 13:19 EDT (History)
14 users (show)

See Also:
Fixed In Version: elfutils-0.148-1.fc12
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 579038
Environment:
Last Closed: 2010-07-01 14:52:51 EDT
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)
Comment 1 Roland McGrath 2010-05-04 17:11:15 EDT
Reproduced with:

$ gcc -o piedie -fpie -pie -xc <(echo 'main(){abort();}')
$ ./piedie
Aborted (core dumped)
$ eu-unstrip -n --core=core.28229 
eu-unstrip: No modules recognized in core file
Comment 5 Petr Machata 2010-05-05 12:22:54 EDT
In dwfl_link_map_report it looks at the ELF of the main (pie) binary, and reads dyn_vaddr.  That's value like 0x2009f8, which is outside all reported segments.  I think the problem is that we don't account for bias as we do when reporting segments.
Comment 6 Petr Machata 2010-05-05 12:28:30 EDT
The "value like" bit was meant to mean "small value", as opposed to values like 0x7f6a0d996000 for addresses where the libraries are mapped".
Comment 7 Petr Machata 2010-05-05 14:40:18 EDT
(In reply to comment #5)
>  I think the problem is that we don't account for bias

... which I don't know how to obtain.  I thought AT_BASE would hold the bias for the main binary, but that doesn't seem to be it.  There is a number with roughly the right magnitude, but it's still too small for bias (in my test case it's 0x7f35fe376000, the binary was mapped to 0x7f6a0d996000).

We know the address of PHDR block, but not of EHDR (then we could do AT_ENTRY - e_entry).  I'm not sure if we can assume anything about the size of EHDR, the presence of e_phoff implies that more fields could be added to the end of EHDR, there could be padding, or whatnot.  Hmm, what about looking sizeof (EHDR) bytes back, checking if the magic holds, and if not, scanning back for magic "reasonably far"?
Comment 8 Roland McGrath 2010-05-05 15:45:08 EDT
Fixed upstream.
Comment 9 Fedora Update System 2010-06-29 00:52:23 EDT
elfutils-0.148-1.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/elfutils-0.148-1.fc12
Comment 10 Fedora Update System 2010-06-29 00:52:29 EDT
elfutils-0.148-1.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/elfutils-0.148-1.fc13
Comment 11 Fedora Update System 2010-06-29 11:32:08 EDT
elfutils-0.148-1.fc13 has been pushed to the Fedora 13 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/elfutils-0.148-1.fc13
Comment 12 Fedora Update System 2010-06-29 11:34:25 EDT
elfutils-0.148-1.fc12 has been pushed to the Fedora 12 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/elfutils-0.148-1.fc12
Comment 13 James Laska 2010-06-30 10:20:43 EDT
Using the reproducer in comment#1, the reported problem does not occur with elfutils-0.148-1.fc13.

$ gcc -o piedie -fpie -pie -xc <(echo 'main(){abort();}')
/proc/self/fd/63: In function ‘main’:
/proc/self/fd/63:1: warning: incompatible implicit declaration of built-in function ‘abort’
$ ./piedie 
$ ulimit -c unlimited
$ eu-unstrip -n --core core.9471 
0x7f27472a1000+0x201000 586b9b81baedc58dcdd34f630856e401f0f08032@0x7f27472a124c - - [pie]
0x7fff509ff000+0x1000 9eef3c8dabad1ba6746e5fef74878ba17e416e38@0x7fff509ff2f8 . - linux-vdso.so.1
0x7f2746d01000+0x37f000 f855edf9e7f0567206e280428d6d405f30a5b3f9@0x7f2746d01280 /lib64/libc.so.6 - libc.so.6
0x7f2747080000+0x221000 f9554ea901052eaee919938a843d292b129532db@0x7f27470801d8 /lib64/ld-linux-x86-64.so.2 - ld-linux-x86-64.so.2
Comment 14 Fedora Update System 2010-07-01 14:52:42 EDT
elfutils-0.148-1.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 15 Fedora Update System 2010-07-06 13:19:15 EDT
elfutils-0.148-1.fc12 has been pushed to the Fedora 12 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.