This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/2] libc: Fix _dl_map_object_from_fd to update ld.so link_map mirror object


If __dl_iterate_phdr is called from audit context, it will not
provide all the info the callback. Some of the fields are just
zero.

The reason is, that inside the audit namespace the dynamic loader
link_map object is just a mirror of the real one. And it does not
have all the info filled in.

Filling in needed values for dynamic loader mirror link_map object.
---
2011-07-26  Jiri Olsa   <jolsa@redhat.com>

	* elf/dl-load.c (_dl_map_object_from_fd): Filling in needed
	values for dynamic loader mirror link_map object.

diff --git a/elf/dl-load.c b/elf/dl-load.c
index 18a83d2..4668b11 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -969,6 +969,13 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
       /* Refer to the real descriptor.  */
       l->l_real = &GL(dl_rtld_map);
 
+      /* Set up the program header information itself. It is needed in
+         the dl_iterate_phdr() callbacks.  */
+      l->l_addr = GL(dl_rtld_map).l_addr;
+      l->l_phdr = GL(dl_rtld_map).l_phdr;
+      l->l_phnum = GL(dl_rtld_map).l_phnum;
+      l->l_tls_modid = GL(dl_rtld_map).l_tls_modid;
+
       /* No need to bump the refcount of the real object, ld.so will
 	 never be unloaded.  */
       __close (fd);
-- 
1.7.4.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]