[PATCH] Fix freeing of initial dtv.
Martin Schwidefsky
schwidefsky@de.ibm.com
Mon Mar 3 14:24:00 GMT 2003
Hi,
testing with nptl on s390-64 revealed a bug in _dl_deallocate_tls. The
dtv array may only be freed if it is not the initial dtv since the initial
dtv is allocated by the dynamic linker and this "early" memory is
not freeable. Why this does not crash i386 or s390-32 is a mystery.
Most probably pure luck.
blue skies,
Martin.
2003-03-03 Martin Schwidefsky <schwidefsky@de.ibm.com>
* sysdeps/generic/dl-tls.c (_dl_deallocate_tls): Don't free the dtv
array if it is the initial dtv.
diff -urN libc/sysdeps/generic/dl-tls.c libc-s390/sysdeps/generic/dl-tls.c
--- libc/sysdeps/generic/dl-tls.c Fri Jan 31 10:02:12 2003
+++ libc-s390/sysdeps/generic/dl-tls.c Mon Mar 3 10:56:37 2003
@@ -415,7 +415,10 @@
dtv_t *dtv = GET_DTV (tcb);
/* The array starts with dtv[-1]. */
- free (dtv - 1);
+#ifdef SHARED
+ if (dtv != GL(dl_initial_dtv))
+#endif
+ free (dtv - 1);
if (dealloc_tcb)
{
More information about the Libc-hacker
mailing list