Bug 1081960 - glibc: PIE alters names returned by dladdr
Summary: glibc: PIE alters names returned by dladdr
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 23
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Carlos O'Donell
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-28 10:10 UTC by Florian Weimer
Modified: 2016-11-24 18:04 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-11-24 18:04:57 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
dladdr.c (658 bytes, text/plain)
2014-03-28 10:10 UTC, Florian Weimer
no flags Details

Description Florian Weimer 2014-03-28 10:10:19 UTC
Created attachment 879776 [details]
dladdr.c

Without PIE, I get this output:

[fweimer@oldenburg tmp]$ gcc dladdr.c -ldl
[fweimer@oldenburg tmp]$ ./a.out 
open: 0x4006f0
dli_fname: ./a.out
dli_fbase: 0x400000
dli_sname: open
dli_saddr: 0x4006f0

chdir: 0x400670
dli_fname: ./a.out
dli_fbase: 0x400000
dli_sname: chdir
dli_saddr: 0x400670

fstat: 0x400990
dli_fname: ./a.out
dli_fbase: 0x400000
dli_sname: (null)
dli_saddr: (nil)

fstat64: 0x4009a0
dli_fname: ./a.out
dli_fbase: 0x400000
dli_sname: (null)
dli_saddr: (nil)

dlsym: 0x400700
dli_fname: ./a.out
dli_fbase: 0x400000
dli_sname: dlsym
dli_saddr: 0x400700

But if I activate PIE, the output for "open" changes:

[fweimer@oldenburg tmp]$ gcc -fpie -pie dladdr.c -ldl
[fweimer@oldenburg tmp]$ ./a.out 
open: 0x7fefe5263580
dli_fname: /lib64/libc.so.6
dli_fbase: 0x7fefe517d000
dli_sname: __open64
dli_saddr: 0x7fefe5263580

chdir: 0x7fefe5263fd0
dli_fname: /lib64/libc.so.6
dli_fbase: 0x7fefe517d000
dli_sname: chdir
dli_saddr: 0x7fefe5263fd0

fstat: 0x7fefe5962c30
dli_fname: ./a.out
dli_fbase: 0x7fefe5962000
dli_sname: (null)
dli_saddr: (nil)

fstat64: 0x7fefe5962c40
dli_fname: ./a.out
dli_fbase: 0x7fefe5962000
dli_sname: (null)
dli_saddr: (nil)

dlsym: 0x7fefe553d150
dli_fname: /lib64/libdl.so.2
dli_fbase: 0x7fefe553c000
dli_sname: dlsym
dli_saddr: 0x7fefe553d150

It would be nice if I could get consistent output in all cases.  The resolution for fstat and fstat64 is missing as well, which is somewhat annoying.

(I use dladdr to obtain function names for error messages in a C++ wrapper, to avoid the need for a separate string constant with the function name.)

Comment 1 Fedora End Of Life 2015-05-29 11:23:29 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. 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 EOL if it remains open with a Fedora  'version'
of '20'.

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.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 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 this bug is closed as described in the policy above.

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 2 Jan Kurik 2015-07-15 14:41:46 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23

Comment 3 Fedora End Of Life 2016-11-24 11:08:37 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. 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 EOL if it remains open with a Fedora  'version'
of '23'.

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.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 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 this bug is closed as described in the policy above.

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 Florian Weimer 2016-11-24 18:04:44 UTC
If a function is aliased, it the name returned by dladdr is not deterministic.

The missing symbols come from libc_nonshared.a, so this is expected as well.


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