summary refs log tree commit diff
path: root/nptl/allocatestack.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-08-21 23:55:36 +0000
committerUlrich Drepper <drepper@redhat.com>2007-08-21 23:55:36 +0000
commit2a01ce56b7d585c0e760ba27e0a07819f3b8b723 (patch)
tree3b598b3518db114c32997054a406ae07d27558cf /nptl/allocatestack.c
parent45dc3ad77e9ab9648365866c64650593114c84fb (diff)
downloadglibc-2a01ce56b7d585c0e760ba27e0a07819f3b8b723.tar.gz
glibc-2a01ce56b7d585c0e760ba27e0a07819f3b8b723.tar.xz
glibc-2a01ce56b7d585c0e760ba27e0a07819f3b8b723.zip
[BZ #4938]
2007-08-21  Ulrich Drepper  <drepper@redhat.com>
	[BZ #4938]
	* allocatestack.c (__reclaim_stacks): Clear the TSD in the
	reclaimed stack if necessary.
	* Makefile (tests): Add tst-tsd6.
	* tst-tsd6.c: New file.
Diffstat (limited to 'nptl/allocatestack.c')
-rw-r--r--nptl/allocatestack.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 02a84f4d9b..c894e96a28 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -794,6 +794,26 @@ __reclaim_stacks (void)
 
 	  /* Account for the size of the stack.  */
 	  stack_cache_actsize += curp->stackblock_size;
+
+	  if (curp->specific_used)
+	    {
+	      /* Clear the thread-specific data.  */
+	      memset (curp->specific_1stblock, '\0',
+		      sizeof (curp->specific_1stblock));
+
+	      curp->specific_used = false;
+
+	      for (size_t cnt = 1; cnt < PTHREAD_KEY_1STLEVEL_SIZE; ++cnt)
+		if (curp->specific[cnt] != NULL)
+		  {
+		    memset (curp->specific[cnt], '\0',
+			    sizeof (curp->specific_1stblock));
+
+		    /* We have allocated the block which we do not
+		       free here so re-set the bit.  */
+		    curp->specific_used = true;
+		  }
+	    }
 	}
     }