public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/12575] New: dlopen RTLD_NOW does not apply to GNU-IFUNCs
@ 2011-03-13 10:15 jan.kratochvil at redhat dot com
2011-03-13 10:16 ` [Bug libc/12575] " jan.kratochvil at redhat dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: jan.kratochvil at redhat dot com @ 2011-03-13 10:15 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=12575
Summary: dlopen RTLD_NOW does not apply to GNU-IFUNCs
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper.fsp@gmail.com
ReportedBy: jan.kratochvil@redhat.com
`-Wl,-z,now' works and the GNU-IFUNC resolver is called before `main'.
But RTLD_NOW returns handle and GNU-IFUNC gets called only after `dlsym'.
Even if the executable calling dlopen(, RTLD_NOW) uses -Wl,-z,-now.
The first part of the test below is correct:
+ ./mc
f
main
But this part prints:
+ ./mcd
dlsym
f
while I expect:
+ ./mcd
f
dlsym
This behavior determines how the glibc Bug 2328 should be resolved in GDB.
cat >lc.c <<EOH
#include <stdio.h>
static int
fi (int a)
{
return a + 1;
}
asm (".type f, @gnu_indirect_function");
int (*
f (void)) (int a)
{
puts ("f");
return fi;
}
EOH
cat >mc.c <<EOH
#include <stdio.h>
extern int f (int a);
int
main (void)
{
puts ("main");
return f (-1);
}
EOH
cat >mcd.c <<EOH
#include <stdio.h>
#include <dlfcn.h>
int
main (void)
{
void *h = dlopen ("./lc.so", RTLD_NOW);
puts ("dlsym");
int (*fp) (int a) = (int (*) (int a)) dlsym (h, "f");
return fp (-1);
}
EOH
gcc -o lc.so lc.c -Wall -g -shared -fPIC; gcc -o mc mc.c -Wall -g -Wl,-z,now
./lc.so; gcc -o mcd mcd.c -Wall -g -Wl,-z,now -ldl; (set -x; ./mc; ./mcd)
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libc/12575] dlopen RTLD_NOW does not apply to GNU-IFUNCs
2011-03-13 10:15 [Bug libc/12575] New: dlopen RTLD_NOW does not apply to GNU-IFUNCs jan.kratochvil at redhat dot com
@ 2011-03-13 10:16 ` jan.kratochvil at redhat dot com
2011-05-12 3:10 ` drepper.fsp at gmail dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: jan.kratochvil at redhat dot com @ 2011-03-13 10:16 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=12575
Jan Kratochvil <jan.kratochvil at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |x86_64-fedora15-linux-gnu
Host| |x86_64-fedora15-linux-gnu
Blocks| |2328
--- Comment #1 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2011-03-13 10:16:28 UTC ---
Tested on Fedora 15:
glibc-2.13.90-6.i686
glibc-2.13.90-6.x86_64
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libc/12575] dlopen RTLD_NOW does not apply to GNU-IFUNCs
2011-03-13 10:15 [Bug libc/12575] New: dlopen RTLD_NOW does not apply to GNU-IFUNCs jan.kratochvil at redhat dot com
2011-03-13 10:16 ` [Bug libc/12575] " jan.kratochvil at redhat dot com
@ 2011-05-12 3:10 ` drepper.fsp at gmail dot com
2011-06-02 13:13 ` jan.kratochvil at redhat dot com
2014-06-27 13:45 ` fweimer at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: drepper.fsp at gmail dot com @ 2011-05-12 3:10 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=12575
Ulrich Drepper <drepper.fsp at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WORKSFORME
--- Comment #2 from Ulrich Drepper <drepper.fsp at gmail dot com> 2011-05-12 03:09:03 UTC ---
There is nothing to change in the dynamic linker.
When you dynamically load the DSO this doesn't magically make a relocation
appear. In your test, the symbol f doesn't have any relocation attached to it
and this is correct. This is really the expected behavior. Without a
relocation or returning the symbol address (as in dlsym) there is no place to
store the result of the ifunc function call.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libc/12575] dlopen RTLD_NOW does not apply to GNU-IFUNCs
2011-03-13 10:15 [Bug libc/12575] New: dlopen RTLD_NOW does not apply to GNU-IFUNCs jan.kratochvil at redhat dot com
2011-03-13 10:16 ` [Bug libc/12575] " jan.kratochvil at redhat dot com
2011-05-12 3:10 ` drepper.fsp at gmail dot com
@ 2011-06-02 13:13 ` jan.kratochvil at redhat dot com
2014-06-27 13:45 ` fweimer at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: jan.kratochvil at redhat dot com @ 2011-06-02 13:13 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=12575
--- Comment #3 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2011-06-02 13:13:06 UTC ---
I agree now, there is no <f@plt> stub anywhere in the dlopen case, thanks.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libc/12575] dlopen RTLD_NOW does not apply to GNU-IFUNCs
2011-03-13 10:15 [Bug libc/12575] New: dlopen RTLD_NOW does not apply to GNU-IFUNCs jan.kratochvil at redhat dot com
` (2 preceding siblings ...)
2011-06-02 13:13 ` jan.kratochvil at redhat dot com
@ 2014-06-27 13:45 ` fweimer at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: fweimer at redhat dot com @ 2014-06-27 13:45 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=12575
Florian Weimer <fweimer at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Flags| |security-
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-06-27 13:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-13 10:15 [Bug libc/12575] New: dlopen RTLD_NOW does not apply to GNU-IFUNCs jan.kratochvil at redhat dot com
2011-03-13 10:16 ` [Bug libc/12575] " jan.kratochvil at redhat dot com
2011-05-12 3:10 ` drepper.fsp at gmail dot com
2011-06-02 13:13 ` jan.kratochvil at redhat dot com
2014-06-27 13:45 ` fweimer at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).