This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch, ibm/2.13/master, updated. glibc-2.13-14-ge6121c8
- From: rsa at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 3 May 2011 21:57:43 -0000
- Subject: GNU C Library master sources branch, ibm/2.13/master, updated. glibc-2.13-14-ge6121c8
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, ibm/2.13/master has been updated
via e6121c8630ab06267036872230889caf8ab54123 (commit)
from 51067b55a305e08a6e965b06c42d00c5c343a993 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e6121c8630ab06267036872230889caf8ab54123
commit e6121c8630ab06267036872230889caf8ab54123
Author: Ulrich Drepper <drepper@gmail.com>
Date: Sun Apr 10 22:43:01 2011 -0400
Fix memory leak in TLS of loaded objects.
(cherry picked from commit e6c61494125126d2ba77e5d99f83887a2ed49783)
diff --git a/ChangeLog b/ChangeLog
index 5436e04..886952a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-04-10 Ulrich Drepper <drepper@gmail.com>
+
+ [BZ #12650]
+ * sysdeps/i386/dl-tls.h: Define TLS_DTV_UNALLOCATED.
+ * sysdeps/ia64/dl-tls.h: Likewise.
+ * sysdeps/powerpc/dl-tls.h: Likewise.
+ * sysdeps/s390/dl-tls.h: Likewise.
+ * sysdeps/sh/dl-tls.h: Likewise.
+ * sysdeps/sparc/dl-tls.h: Likewise.
+ * sysdeps/x86_64/dl-tls.h: Likewise.
+ * elf/dl-tls.c: Don't define TLS_DTV_UNALLOCATED here.
+
2011-03-16 Ryan S. Arnold <rsa@us.ibm.com>
* sysdeps/powerpc/powerpc32/power6/fpu/s_isnanf.S (isnanf): Fix
diff --git a/elf/dl-tls.c b/elf/dl-tls.c
index 824adc1..ea94aa0 100644
--- a/elf/dl-tls.c
+++ b/elf/dl-tls.c
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. Generic version.
- Copyright (C) 2002,2003,2004,2005,2006,2008 Free Software Foundation, Inc.
+ Copyright (C) 2002-2006,2008,2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -33,9 +33,6 @@
to allow dynamic loading of modules defining IE-model TLS data. */
#define TLS_STATIC_SURPLUS 64 + DL_NNS * 100
-/* Value used for dtv entries for which the allocation is delayed. */
-#define TLS_DTV_UNALLOCATED ((void *) -1l)
-
/* Out-of-memory handler. */
#ifdef SHARED
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 802abcd..f99dcfb 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,10 @@
+2011-04-10 Ulrich Drepper <drepper@gmail.com>
+
+ [BZ #12650]
+ * allocatestack.c (get_cached_stack): Deallocate DTV entries before
+ clearing memory.
+ Patch partly by Robert Rex <robert.rex@exasol.com>.
+
2011-01-19 Roland McGrath <roland@redhat.com>
* pthread_cond_wait.c (__pthread_cond_wait): Fix comment typo.
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 831e98e..ba251b9 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007, 2009, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2007, 2009, 2010, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -26,6 +26,7 @@
#include <sys/mman.h>
#include <sys/param.h>
#include <dl-sysdep.h>
+#include <dl-tls.h>
#include <tls.h>
#include <lowlevellock.h>
#include <kernel-features.h>
@@ -241,6 +242,10 @@ get_cached_stack (size_t *sizep, void **memp)
/* Clear the DTV. */
dtv_t *dtv = GET_DTV (TLS_TPADJ (result));
+ for (size_t cnt = 0; cnt < dtv[-1].counter; ++cnt)
+ if (! dtv[1 + cnt].pointer.is_static
+ && dtv[1 + cnt].pointer.val != TLS_DTV_UNALLOCATED)
+ free (dtv[1 + cnt].pointer.val);
memset (dtv, '\0', (dtv[-1].counter + 1) * sizeof (dtv_t));
/* Re-initialize the TLS. */
diff --git a/sysdeps/i386/dl-tls.h b/sysdeps/i386/dl-tls.h
index 58705c7..21b949b 100644
--- a/sysdeps/i386/dl-tls.h
+++ b/sysdeps/i386/dl-tls.h
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. i386 version.
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -58,3 +58,6 @@ strong_alias (___tls_get_addr, ___tls_get_addr_internal)
# endif
#endif
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/sysdeps/ia64/dl-tls.h b/sysdeps/ia64/dl-tls.h
index 26f3d2a..5e9a165 100644
--- a/sysdeps/ia64/dl-tls.h
+++ b/sysdeps/ia64/dl-tls.h
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. IA-64 version.
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -28,3 +28,6 @@
#define DONT_USE_TLS_INDEX 1
extern void *__tls_get_addr (size_t m, size_t offset);
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/sysdeps/powerpc/dl-tls.h b/sysdeps/powerpc/dl-tls.h
index 957d4b4..9ab81f9 100644
--- a/sysdeps/powerpc/dl-tls.h
+++ b/sysdeps/powerpc/dl-tls.h
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. PowerPC version.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -47,3 +47,6 @@ extern void *__tls_get_addr (tls_index *ti);
# define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET)
# define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET)
#endif
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/sysdeps/s390/dl-tls.h b/sysdeps/s390/dl-tls.h
index 0560462..7295abc 100644
--- a/sysdeps/s390/dl-tls.h
+++ b/sysdeps/s390/dl-tls.h
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. s390 version.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -72,6 +72,9 @@ __tls_get_offset:\n\
# define __TLS_GET_ADDR(__ti) \
({ extern char _GLOBAL_OFFSET_TABLE_[] attribute_hidden; \
(void *) __tls_get_offset ((char *) (__ti) - _GLOBAL_OFFSET_TABLE_) \
- + (unsigned long) __builtin_thread_pointer (); })
+ + (unsigned long) __builtin_thread_pointer (); })
#endif
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/sysdeps/sh/dl-tls.h b/sysdeps/sh/dl-tls.h
index 98e2f19..cf60790 100644
--- a/sysdeps/sh/dl-tls.h
+++ b/sysdeps/sh/dl-tls.h
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. SH version.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -27,3 +27,6 @@ typedef struct
extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/sysdeps/sparc/dl-tls.h b/sysdeps/sparc/dl-tls.h
index 6edf8d5..fb2535e 100644
--- a/sysdeps/sparc/dl-tls.h
+++ b/sysdeps/sparc/dl-tls.h
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. SPARC version.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -27,3 +27,6 @@ typedef struct
extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
diff --git a/sysdeps/x86_64/dl-tls.h b/sysdeps/x86_64/dl-tls.h
index 9b389ed..c382cd8 100644
--- a/sysdeps/x86_64/dl-tls.h
+++ b/sysdeps/x86_64/dl-tls.h
@@ -1,5 +1,5 @@
/* Thread-local storage handling in the ELF dynamic linker. x86-64 version.
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -27,3 +27,6 @@ typedef struct dl_tls_index
extern void *__tls_get_addr (tls_index *ti);
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 12 ++++++++++++
elf/dl-tls.c | 5 +----
nptl/ChangeLog | 7 +++++++
nptl/allocatestack.c | 7 ++++++-
sysdeps/i386/dl-tls.h | 5 ++++-
sysdeps/ia64/dl-tls.h | 5 ++++-
sysdeps/powerpc/dl-tls.h | 5 ++++-
sysdeps/s390/dl-tls.h | 7 +++++--
sysdeps/sh/dl-tls.h | 5 ++++-
sysdeps/sparc/dl-tls.h | 5 ++++-
sysdeps/x86_64/dl-tls.h | 5 ++++-
11 files changed, 55 insertions(+), 13 deletions(-)
hooks/post-receive
--
GNU C Library master sources