summaryrefslogtreecommitdiff
path: root/elf/rtld.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2019-11-02 21:40:26 +0100
committerFlorian Weimer <fweimer@redhat.com>2019-11-02 21:40:26 +0100
commit6a47bd92bf87136b6b7530edd4e7dc88a42ac6ed (patch)
tree1ed35ce6435b77a45c03b14db6141f0c2d981cc1 /elf/rtld.c
parent42893aa38fd6041d349ea0427c4d5ccbacd9a2be (diff)
downloadglibc-6a47bd92bf87136b6b7530edd4e7dc88a42ac6ed.tar.gz
Properly initialize audit cookie for the dynamic loader [BZ #25157]fw/bug25157
The l_audit array is indexed by audit module, not audit function.
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 8a6e1a11b2..bb7ca4114e 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1008,13 +1008,7 @@ ERROR: audit interface '%s' requires version %d (maximum supported version %d);
/* Store the pointer. */
if (err_str == NULL && largs.result != NULL)
- {
- newp->fptr[cnt] = largs.result;
-
- /* The dynamic linker link map is statically allocated,
- initialize the data now. */
- GL(dl_rtld_map).l_audit[cnt].cookie = (intptr_t) &GL(dl_rtld_map);
- }
+ newp->fptr[cnt] = largs.result;
else
newp->fptr[cnt] = NULL;
++cnt;
@@ -1030,6 +1024,12 @@ ERROR: audit interface '%s' requires version %d (maximum supported version %d);
*last_audit = GLRO(dl_audit) = &newp->ifaces;
else
*last_audit = (*last_audit)->next = &newp->ifaces;
+
+ /* The dynamic linker link map is statically allocated, initialize
+ the data now. */
+ GL (dl_rtld_map).l_audit[GLRO (dl_naudit)].cookie
+ = (intptr_t) &GL(dl_rtld_map);
+
++GLRO(dl_naudit);
/* Mark the DSO as being used for auditing. */