[PATCH] Fix linker-debugger interface
Gary Benson
gbenson@redhat.com
Thu Aug 16 15:46:00 GMT 2012
Hi all,
When unmapping the first object in a namespace, the runtime linker
correctly updates its internal pointer to the start of the list
but does not update the externally visible pointer. This results
in debuggers being passed pointers to memory that has been freed.
This issue was discovered by Jan Kratochvil [1]
The attached patch fixes. Ok to commit?
Thanks,
Gary
[1] http://www.cygwin.com/ml/gdb-patches/2012-08/msg00443.html
--
http://gbenson.net/
-------------- next part --------------
2012-08-16 Gary Benson <gbenson@redhat.com>
* elf/dl-close.c (_dl_close_worker): Also set r->r_map when
unmapping the first object in a namespace.
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 45b2187..216bd81 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -641,7 +641,7 @@ _dl_close_worker (struct link_map *map)
#ifdef SHARED
assert (nsid != LM_ID_BASE);
#endif
- ns->_ns_loaded = imap->l_next;
+ r->r_map = ns->_ns_loaded = imap->l_next;
}
--ns->_ns_nloaded;
More information about the Libc-alpha
mailing list