This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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] Fix freeing of initial dtv.


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 at de dot ibm dot 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)
     {


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