This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC] Prevent tailcall optimizations of libdl functions
- From: Yuri Gribov <tetra2005 at gmail dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Cc: bugdal at aerifal dot cx, Jakub Jelinek <jakub at redhat dot com>
- Date: Wed, 25 Jan 2017 08:12:14 +0000
- Subject: [RFC] Prevent tailcall optimizations of libdl functions
- Authentication-results: sourceware.org; auth=none
Hi all,
This is a ping on https://sourceware.org/bugzilla/show_bug.cgi?id=21050
Some libdl functions rely on return address to figure out the calling
DSO and then use this information in computation (e.g. output of dlsym
depends on which library called it).
As reported in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66826 this
may break under tailcall optimization i.e. in cases like
return dlsym(...);
Rich Felker suggested that adding new GCC attribute is a possible
solution. Another option would be to hack around dlsym to prevent
tailcall from happening e.g.
#define dlsym(h, name) { volatile void *sym = dlsym(h, name); return
(void *)sym; }
Which solution is more appropriate for Glibc?
-Yury