summaryrefslogtreecommitdiff
path: root/elf/dl-object.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /elf/dl-object.c
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz
2.5-18.1
Diffstat (limited to 'elf/dl-object.c')
-rw-r--r--elf/dl-object.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/elf/dl-object.c b/elf/dl-object.c
index b46ebdc33f..86f7a8e4d9 100644
--- a/elf/dl-object.c
+++ b/elf/dl-object.c
@@ -39,14 +39,24 @@ _dl_new_object (char *realname, const char *libname, int type,
size_t libname_len = strlen (libname) + 1;
struct link_map *new;
struct libname_list *newname;
+#ifdef SHARED
+ /* We create the map for the executable before we know whether we have
+ auditing libraries and if yes, how many. Assume the worst. */
+ unsigned int naudit = GLRO(dl_naudit) ?: ((mode & __RTLD_OPENEXEC)
+ ? DL_NNS : 0);
+ size_t audit_space = naudit * sizeof (new->l_audit[0]);
+#else
+# define audit_space 0
+#endif
- new = (struct link_map *) calloc (sizeof (*new) + sizeof (*newname)
- + libname_len, 1);
+ new = (struct link_map *) calloc (sizeof (*new) + audit_space
+ + sizeof (*newname) + libname_len, 1);
if (new == NULL)
return NULL;
new->l_real = new;
- new->l_libname = newname = (struct libname_list *) (new + 1);
+ new->l_libname = newname = (struct libname_list *) ((char *) (new + 1)
+ + audit_space);
newname->name = (char *) memcpy (newname + 1, libname, libname_len);
/* newname->next = NULL; We use calloc therefore not necessary. */
newname->dont_free = 1;
@@ -59,6 +69,14 @@ _dl_new_object (char *realname, const char *libname, int type,
#endif
new->l_ns = nsid;
+#ifdef SHARED
+ for (unsigned int cnt = 0; cnt < naudit; ++cnt)
+ {
+ new->l_audit[cnt].cookie = (uintptr_t) new;
+ /* new->l_audit[cnt].bindflags = 0; */
+ }
+#endif
+
/* new->l_global = 0; We use calloc therefore not necessary. */
/* Use the 'l_scope_mem' array by default for the the 'l_scope'