[PATCH] Fix LD_AUDIT=foo.so:bar.so /bin/true
Jakub Jelinek
jakub@redhat.com
Mon Jun 18 15:47:00 GMT 2007
Hi!
When audit_list contains more than one list entry, init_tls is called
multiple times which screws up all TLS handling. When it is called the
second time, it will change GL(dl_tls_static_nelem) and then return
NULL as GL(dl_initial_dtv) != NULL. As tcbp is set to that unconditionally,
init_tls will be called after that loop once again, changing
GL(dl_tls_static_nelem) again.
This patch cures it.
2007-06-18 Jakub Jelinek <jakub@redhat.com>
* elf/rtld.c (dl_main): Don't call init_tls more than once.
--- libc/elf/rtld.c.jj 2007-06-18 15:27:28.000000000 +0200
+++ libc/elf/rtld.c 2007-06-18 17:10:14.000000000 +0200
@@ -1400,6 +1400,11 @@ of this helper program; chances are you
/* Iterate over all entries in the list. The order is important. */
struct audit_ifaces *last_audit = NULL;
struct audit_list *al = audit_list->next;
+
+ /* Since we start using the auditing DSOs right away we need to
+ initialize the data structures now. */
+ tcbp = init_tls ();
+
do
{
int tls_idx = GL(dl_tls_max_dtv_idx);
@@ -1410,10 +1415,6 @@ of this helper program; chances are you
no DF_STATIC_TLS bit is set. The reason is that we know
glibc will use the static model. */
- /* Since we start using the auditing DSOs right away we need to
- initialize the data structures now. */
- tcbp = init_tls ();
-
struct dlmopen_args dlmargs;
dlmargs.fname = al->name;
dlmargs.map = NULL;
Jakub
More information about the Libc-hacker
mailing list