summaryrefslogtreecommitdiff
path: root/libc/nptl
diff options
context:
space:
mode:
Diffstat (limited to 'libc/nptl')
-rw-r--r--libc/nptl/ChangeLog19
-rw-r--r--libc/nptl/Makefile12
-rw-r--r--libc/nptl/allocatestack.c19
-rw-r--r--libc/nptl/shlib-versions2
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/tst-setgetname.c14
-rw-r--r--libc/nptl/tst-tls7.c143
-rw-r--r--libc/nptl/tst-tls7mod.c40
7 files changed, 37 insertions, 212 deletions
diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog
index 0defc9a87..a4d3f45a4 100644
--- a/libc/nptl/ChangeLog
+++ b/libc/nptl/ChangeLog
@@ -1,3 +1,13 @@
+2014-02-05 Carlos O'Donell <carlos@redhat.com>
+
+ * sysdeps/unix/sysv/linux/tst-setgetname.c (do_test): Skip the
+ test if !__ASSUME_PROC_PID_TASK_COMM and get_self_comm returns
+ ENOENT.
+
+2014-01-23 Stefan Liebler <stli@linux.vnet.ibm.com>
+
+ * tst-tls7.c: Adjust testcase timeout
+
2014-01-18 H.J. Lu <hongjiu.lu@intel.com>
[BZ #14782]
@@ -9,14 +19,7 @@
(do_test): Call it.
* tst-tls7mod.c (action): Move sem_post to caller.
-2014-01-03 Andrew Hunter <ahh@google.com>
-
- * nptl/Makefile (tst-tls7): New test.
- * nptl/tst-tls7.c: New file.
- * nptl/tst-tls7mod.c: New file.
- * nptl/allocatestack.c (init_one_static_tls): Use atomic barrier.
-
-2013-12-12 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
+2011-12-12 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* sysdeps/powerpc/tls.h (struct tcbhead_t): Add DSO and TAR fields.
* nptl/sysdeps/powerpc/tcb-offsets.sym: Likewise.
diff --git a/libc/nptl/Makefile b/libc/nptl/Makefile
index 2cd0ce3ad..e07559ed2 100644
--- a/libc/nptl/Makefile
+++ b/libc/nptl/Makefile
@@ -307,7 +307,7 @@ tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \
tst-oncex3 tst-oncex4
endif
ifeq ($(build-shared),yes)
-tests += tst-atfork2 tst-tls3 tst-tls4 tst-tls5 tst-tls7 tst-_res1 tst-fini1 \
+tests += tst-atfork2 tst-tls3 tst-tls4 tst-tls5 tst-_res1 tst-fini1 \
tst-stackguard1
tests-nolibpthread += tst-fini1
ifeq ($(have-z-execstack),yes)
@@ -318,8 +318,7 @@ endif
modules-names = tst-atfork2mod tst-tls3mod tst-tls4moda tst-tls4modb \
tst-tls5mod tst-tls5moda tst-tls5modb tst-tls5modc \
tst-tls5modd tst-tls5mode tst-tls5modf \
- tst-_res1mod1 tst-_res1mod2 tst-execstack-mod tst-fini1mod \
- tst-tls7mod
+ tst-_res1mod1 tst-_res1mod2 tst-execstack-mod tst-fini1mod
extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) tst-cleanup4aux.o
test-extras += $(modules-names) tst-cleanup4aux
test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
@@ -333,7 +332,6 @@ tst-tls5modc.so-no-z-defs = yes
tst-tls5modd.so-no-z-defs = yes
tst-tls5mode.so-no-z-defs = yes
tst-tls5modf.so-no-z-defs = yes
-tst-tls7mod.so-no-z-defs = yes
ifeq ($(build-shared),yes)
# Build all the modules even when not actually running test programs.
@@ -496,12 +494,6 @@ $(objpfx)tst-tls5: $(objpfx)tst-tls5mod.so $(shared-thread-library)
LDFLAGS-tst-tls5 = $(no-as-needed)
LDFLAGS-tst-tls5mod.so = -Wl,-soname,tst-tls5mod.so
-# ensure free(malloc()) isn't optimized out
-CFLAGS-tst-tls7.c = -fno-builtin-malloc -fno-builtin-free
-$(objpfx)tst-tls7: $(libdl) $(shared-thread-library)
-$(objpfx)tst-tls7.out: $(objpfx)tst-tls7mod.so
-$(objpfx)tst-tls7mod.so: $(shared-thread-library)
-
ifeq ($(build-shared),yes)
ifeq ($(run-built-tests),yes)
tests: $(objpfx)tst-tls6.out
diff --git a/libc/nptl/allocatestack.c b/libc/nptl/allocatestack.c
index 2a5ac2211..13eca47cf 100644
--- a/libc/nptl/allocatestack.c
+++ b/libc/nptl/allocatestack.c
@@ -242,7 +242,11 @@ get_cached_stack (size_t *sizep, void **memp)
/* Clear the DTV. */
dtv_t *dtv = GET_DTV (TLS_TPADJ (result));
- _dl_clear_dtv (dtv);
+ 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. */
_dl_allocate_tls_init (TLS_TPADJ (result));
@@ -1173,18 +1177,13 @@ init_one_static_tls (struct pthread *curp, struct link_map *map)
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
# endif
- /* Initialize the memory. */
- memset (__mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
- '\0', map->l_tls_blocksize - map->l_tls_initimage_size);
-
/* Fill in the DTV slot so that a later LD/GD access will find it. */
- dtv[map->l_tls_modid].pointer.is_static = true;
- /* Pairs against the read barrier in tls_get_attr_tail, guaranteeing
- any thread waiting for an update to pointer.val sees the
- initimage write. */
- atomic_write_barrier ();
dtv[map->l_tls_modid].pointer.val = dest;
+ dtv[map->l_tls_modid].pointer.is_static = true;
+ /* Initialize the memory. */
+ memset (__mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
+ '\0', map->l_tls_blocksize - map->l_tls_initimage_size);
}
void
diff --git a/libc/nptl/shlib-versions b/libc/nptl/shlib-versions
index 495b240a5..f6b9b9ae6 100644
--- a/libc/nptl/shlib-versions
+++ b/libc/nptl/shlib-versions
@@ -2,5 +2,5 @@ sparc64.*-.*-linux.* libpthread=0 GLIBC_2.2
sh.*-.*-linux.* libpthread=0 GLIBC_2.2
s390x-.*-linux.* libpthread=0 GLIBC_2.2
powerpc64-.*-linux.* libpthread=0 GLIBC_2.3
-powerpc.*le-.*-linux.* libpthread=0 GLIBC_2.18
+powerpc.*le-.*-linux.* libpthread=0 GLIBC_2.17
.*-.*-linux.* libpthread=0
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/tst-setgetname.c b/libc/nptl/sysdeps/unix/sysv/linux/tst-setgetname.c
index 2aceba53b..f5693e26c 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/tst-setgetname.c
+++ b/libc/nptl/sysdeps/unix/sysv/linux/tst-setgetname.c
@@ -23,6 +23,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
+#include <kernel-features.h>
/* New name of process. */
#define NEW_NAME "setname"
@@ -99,6 +100,19 @@ do_test (int argc, char **argv)
if (res == 0)
{
res = get_self_comm (gettid (), name_check, TASK_COMM_LEN);
+
+#if !__ASSUME_PROC_PID_TASK_COMM
+ /* On this first test we look for ENOENT to be returned from
+ get_self_comm to indicate that the kernel is older than
+ 2.6.33 and doesn't contain comm within the proc structure.
+ In that case we skip the entire test. */
+ if (res == ENOENT)
+ {
+ printf ("SKIP: The kernel does not have /proc/self/task/%%lu/comm.\n");
+ return 0;
+ }
+#endif
+
if (res == 0)
{
if (strncmp (name, name_check, strlen (BIG_NAME)) == 0)
diff --git a/libc/nptl/tst-tls7.c b/libc/nptl/tst-tls7.c
deleted file mode 100644
index 583d5b462..000000000
--- a/libc/nptl/tst-tls7.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/* Copyright (C) 2013 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
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-
-/* This test checks that TLS in a dlopened object works when first accessed
- from a signal handler. */
-
-#include <assert.h>
-#include <atomic.h>
-#include <dlfcn.h>
-#include <pthread.h>
-#include <semaphore.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-void *
-spin (void *ignored)
-{
- while (1)
- {
- /* busywork */
- free (malloc (128));
- }
-
- /* never reached */
- return NULL;
-}
-
-static void (*tls7mod_action) (int, siginfo_t *, void *);
-
-static void
-action (int signo, siginfo_t *info, void *ignored)
-{
- sem_t *sem = info->si_value.sival_ptr;
-
- atomic_read_barrier ();
- assert (tls7mod_action != NULL);
- (*tls7mod_action) (signo, info, ignored);
-
- /* This sem_post may trigger dlclose, which will invalidate tls7mod_action.
- It is important to do that only after tls7mod_action is no longer
- active. */
- sem_post (sem);
-}
-
-int
-do_test (void)
-{
- pthread_t th[10];
-
- for (int i = 0; i < 10; ++i)
- {
- if (pthread_create (&th[i], NULL, spin, NULL))
- {
- puts ("pthread_create failed");
- exit (1);
- }
- }
-#define NITERS 75
-
- for (int i = 0; i < NITERS; ++i)
- {
- void *h = dlopen ("tst-tls7mod.so", RTLD_LAZY);
- if (h == NULL)
- {
- puts ("dlopen failed");
- exit (1);
- }
-
- tls7mod_action = dlsym (h, "action");
- if (tls7mod_action == NULL)
- {
- puts ("dlsym for action failed");
- exit (1);
- }
- atomic_write_barrier ();
-
- struct sigaction sa;
- sa.sa_sigaction = action;
- sigemptyset (&sa.sa_mask);
- sa.sa_flags = SA_SIGINFO;
- if (sigaction (SIGUSR1, &sa, NULL))
- {
- puts ("sigaction failed");
- exit (1);
- }
-
- sem_t sem;
- if (sem_init (&sem, 0, 0))
- {
- puts ("sem_init failed");
- }
-
- sigval_t val;
- val.sival_ptr = &sem;
- for (int i = 0; i < 10; ++i)
- {
- if (pthread_sigqueue (th[i], SIGUSR1, val))
- {
- puts ("pthread_sigqueue failed");
- }
- }
-
-
- for (int i = 0; i < 10; ++i)
- {
- if (sem_wait (&sem))
- {
- puts ("sem_wait failed");
- }
- }
-
- /* Paranoia. */
- tls7mod_action = NULL;
-
- if (dlclose (h))
- {
- puts ("dlclose failed");
- exit (1);
- }
- }
- return 0;
-}
-
-#define TIMEOUT 4
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
diff --git a/libc/nptl/tst-tls7mod.c b/libc/nptl/tst-tls7mod.c
deleted file mode 100644
index da5af5637..000000000
--- a/libc/nptl/tst-tls7mod.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2013 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
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-/* Dynamic module with TLS to be accessed by a signal handler to check safety
- of that mode. */
-
-#include <semaphore.h>
-#include <signal.h>
-#include <unistd.h>
-
-/* This is an unlikely value to see in incorrectly initialized TLS
- block -- make sure we're initialized properly. */
-static __thread intptr_t tls_data = 0xdeadbeef;
-
-void
-action (int signo, siginfo_t *info, void *ignored)
-{
- if (tls_data != 0xdeadbeef)
- {
- write (STDOUT_FILENO, "wrong TLS value\n", 17);
- _exit (1);
- }
-
- /* arbitrary choice, just write something unique-ish. */
- tls_data = (intptr_t) info;
-}