* [hurd,commited 0/5] Fix and enable more tests
@ 2020-06-08 0:06 Samuel Thibault
2020-06-08 0:06 ` [hurd,commited 1/5] hurd: Fix unwinding over interruptible RPC Samuel Thibault
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Samuel Thibault @ 2020-06-08 0:06 UTC (permalink / raw)
To: libc-alpha; +Cc: Samuel Thibault, commit-hurd
Samuel Thibault (5):
hurd: Fix unwinding over interruptible RPC
hurd: Make read and pread64 cancellable
htl: Fix tls initialization for already-created threads
htl: Fix registration of atfork handlers in modules
htl: Enable more tests
htl/pt-alloc.c | 29 +++++++++++++
nptl/Makefile | 41 ++-----------------
sysdeps/htl/old_pt-atfork.c | 4 +-
sysdeps/htl/pt-atfork.c | 10 +++++
sysdeps/htl/pthreadP.h | 3 ++
sysdeps/mach/hurd/Makefile | 3 +-
sysdeps/mach/hurd/Versions | 6 +++
sysdeps/mach/hurd/dl-sysdep.c | 5 +++
sysdeps/mach/hurd/htl/pt-sysdep.c | 3 ++
sysdeps/mach/hurd/i386/intr-msg.h | 2 +
sysdeps/mach/hurd/i386/ld.abilist | 1 +
sysdeps/mach/hurd/i386/localplt.data | 5 ++-
sysdeps/mach/hurd/not-cancel.h | 14 ++++---
sysdeps/mach/hurd/pread64.c | 16 ++++----
sysdeps/mach/hurd/pread64_nocancel.c | 35 ++++++++++++++++
sysdeps/mach/hurd/read.c | 12 +++---
sysdeps/mach/hurd/read_nocancel.c | 30 ++++++++++++++
sysdeps/pthread/Makefile | 41 +++++++++++++++++++
{nptl => sysdeps/pthread}/tst-_res1.c | 0
{nptl => sysdeps/pthread}/tst-_res1mod1.c | 0
{nptl => sysdeps/pthread}/tst-_res1mod2.c | 0
{nptl => sysdeps/pthread}/tst-atfork2.c | 0
{nptl => sysdeps/pthread}/tst-atfork2mod.c | 0
{nptl => sysdeps/pthread}/tst-fini1.c | 0
{nptl => sysdeps/pthread}/tst-fini1mod.c | 0
.../pthread/tst-pt-tls4.c | 0
{nptl => sysdeps/pthread}/tst-tls4moda.c | 0
{nptl => sysdeps/pthread}/tst-tls4modb.c | 0
28 files changed, 200 insertions(+), 60 deletions(-)
create mode 100644 sysdeps/mach/hurd/pread64_nocancel.c
create mode 100644 sysdeps/mach/hurd/read_nocancel.c
rename {nptl => sysdeps/pthread}/tst-_res1.c (100%)
rename {nptl => sysdeps/pthread}/tst-_res1mod1.c (100%)
rename {nptl => sysdeps/pthread}/tst-_res1mod2.c (100%)
rename {nptl => sysdeps/pthread}/tst-atfork2.c (100%)
rename {nptl => sysdeps/pthread}/tst-atfork2mod.c (100%)
rename {nptl => sysdeps/pthread}/tst-fini1.c (100%)
rename {nptl => sysdeps/pthread}/tst-fini1mod.c (100%)
rename nptl/tst-tls4.c => sysdeps/pthread/tst-pt-tls4.c (100%)
rename {nptl => sysdeps/pthread}/tst-tls4moda.c (100%)
rename {nptl => sysdeps/pthread}/tst-tls4modb.c (100%)
--
2.26.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [hurd,commited 1/5] hurd: Fix unwinding over interruptible RPC
2020-06-08 0:06 [hurd,commited 0/5] Fix and enable more tests Samuel Thibault
@ 2020-06-08 0:06 ` Samuel Thibault
2020-06-08 0:06 ` [hurd,commited 2/5] hurd: Make read and pread64 cancellable Samuel Thibault
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Samuel Thibault @ 2020-06-08 0:06 UTC (permalink / raw)
To: libc-alpha; +Cc: Samuel Thibault, commit-hurd
* sysdeps/mach/hurd/i386/intr-msg.h (INTR_MSG_TRAP): Set CFA register to
%ecx while %esp is altered.
---
sysdeps/mach/hurd/i386/intr-msg.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sysdeps/mach/hurd/i386/intr-msg.h b/sysdeps/mach/hurd/i386/intr-msg.h
index 54420fed01..70e6cc6592 100644
--- a/sysdeps/mach/hurd/i386/intr-msg.h
+++ b/sysdeps/mach/hurd/i386/intr-msg.h
@@ -37,10 +37,12 @@
" movl %6, %%eax\n" \
" jmp _hurd_intr_rpc_msg_sp_restored\n" \
"_hurd_intr_rpc_msg_do: movl %%esp, %%ecx\n" \
+ " .cfi_def_cfa_register %%ecx\n" \
" leal %4, %%esp\n" \
"_hurd_intr_rpc_msg_cx_sp: movl $-25, %%eax\n" \
"_hurd_intr_rpc_msg_do_trap: lcall $7, $0 # status in %0\n" \
"_hurd_intr_rpc_msg_in_trap: movl %%ecx, %%esp\n" \
+ " .cfi_def_cfa_register %%esp\n" \
"_hurd_intr_rpc_msg_sp_restored:" \
: "=a" (err), "+m" (option), "+m" (timeout), "=m" (*intr_port_p) \
: "m" ((&msg)[-1]), "m" (*cancel_p), "i" (EINTR) \
--
2.26.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [hurd,commited 2/5] hurd: Make read and pread64 cancellable
2020-06-08 0:06 [hurd,commited 0/5] Fix and enable more tests Samuel Thibault
2020-06-08 0:06 ` [hurd,commited 1/5] hurd: Fix unwinding over interruptible RPC Samuel Thibault
@ 2020-06-08 0:06 ` Samuel Thibault
2020-06-08 0:06 ` [hurd, commited 3/5] htl: Fix tls initialization for already-created threads Samuel Thibault
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Samuel Thibault @ 2020-06-08 0:06 UTC (permalink / raw)
To: libc-alpha; +Cc: Samuel Thibault, commit-hurd
and add _nocancel variants.
* sysdeps/mach/hurd/pread64.c (__libc_pread64): Call __pread64_nocancel
surrounded by enabling async cancel, to replace implementation moved to...
* sysdeps/mach/hurd/pread64_nocancel.c (__pread64_nocancel): ... here.
* sysdeps/mach/hurd/read.c (__libc_read): Call __read_nocancel surrounded by
enabling async cancel, to replace implementation moved to...
* sysdeps/mach/hurd/read_nocancel.c (__read_nocancel): ... here.
* sysdeps/mach/hurd/Makefile (sysdep_routines): Add read_nocancel and
pread64_nocancel.
* sysdeps/mach/hurd/not-cancel.h (__read_nocancel, __pread64_nocancel):
Replace macros with prototypes with a hidden proto on libc.
* sysdeps/mach/hurd/dl-sysdep.c: Include <not-cancel.h>.
(__pread64_nocancel): New alias, check that it is not hidden.
(__read_nocancel): New alias, check that it is not hidden.
* sysdeps/mach/hurd/Versions (libc.GLIBC_PRIVATE): Add __read_nocancel and
__pread64_nocancel.
(ld.GLIBC_2.1): Add __pread64.
(ld.GLIBC_PRIVATE): Add __read_nocancel and __pread64_nocancel.
* sysdeps/mach/hurd/i386/ld.abilist (__pread64): Add symbol.
* sysdeps/mach/hurd/i386/localplt.data (__read_nocancel, __pread64,
__pread64_nocancel): Add references.
---
sysdeps/mach/hurd/Makefile | 3 ++-
sysdeps/mach/hurd/Versions | 6 +++++
sysdeps/mach/hurd/dl-sysdep.c | 5 ++++
sysdeps/mach/hurd/i386/ld.abilist | 1 +
sysdeps/mach/hurd/i386/localplt.data | 5 +++-
sysdeps/mach/hurd/not-cancel.h | 14 +++++++----
sysdeps/mach/hurd/pread64.c | 16 ++++++-------
sysdeps/mach/hurd/pread64_nocancel.c | 35 ++++++++++++++++++++++++++++
sysdeps/mach/hurd/read.c | 12 ++++++----
sysdeps/mach/hurd/read_nocancel.c | 30 ++++++++++++++++++++++++
10 files changed, 106 insertions(+), 21 deletions(-)
create mode 100644 sysdeps/mach/hurd/pread64_nocancel.c
create mode 100644 sysdeps/mach/hurd/read_nocancel.c
diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile
index 039bcfc041..bf741058f5 100644
--- a/sysdeps/mach/hurd/Makefile
+++ b/sysdeps/mach/hurd/Makefile
@@ -196,7 +196,8 @@ sysdep_routines += cthreads
endif
ifeq (io, $(subdir))
-sysdep_routines += f_setlk close_nocancel_nostatus
+sysdep_routines += f_setlk close_nocancel_nostatus read_nocancel \
+ pread64_nocancel
endif
ifeq ($(subdir),sunrpc)
diff --git a/sysdeps/mach/hurd/Versions b/sysdeps/mach/hurd/Versions
index 1d6633f782..ce873f33f6 100644
--- a/sysdeps/mach/hurd/Versions
+++ b/sysdeps/mach/hurd/Versions
@@ -10,6 +10,7 @@ libc {
GLIBC_PRIVATE {
# Functions shared with the dynamic linker
__access; __access_noerrno; __libc_read; __libc_write; __libc_lseek64;
+ __read_nocancel; __pread64_nocancel;
__libc_lock_self0; __getcwd;
_dl_init_first;
@@ -32,6 +33,10 @@ ld {
_exit; _hurd_intr_rpc_mach_msg;
abort;
}
+ GLIBC_2.1 {
+ # functions that must be shared with libc
+ __pread64;
+ }
GLIBC_2.2 {
# functions that must be shared with libc
__open64;
@@ -45,6 +50,7 @@ ld {
# functions that must be shared with libc
__access; __access_noerrno; __libc_read; __libc_write; __libc_lseek64;
+ __read_nocancel; __pread64_nocancel;
__libc_lock_self0; __getcwd;
}
}
diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
index 574e252836..1626cd5928 100644
--- a/sysdeps/mach/hurd/dl-sysdep.c
+++ b/sysdeps/mach/hurd/dl-sysdep.c
@@ -47,6 +47,7 @@
#include <dl-tunables.h>
#include <not-errno.h>
+#include <not-cancel.h>
extern void __mach_init (void);
@@ -359,6 +360,7 @@ __close (int fd)
}
check_no_hidden(__pread64);
+check_no_hidden(__pread64_nocancel);
__ssize_t weak_function
__pread64 (int fd, void *buf, size_t nbytes, off64_t offset)
{
@@ -381,14 +383,17 @@ __pread64 (int fd, void *buf, size_t nbytes, off64_t offset)
return nread;
}
libc_hidden_weak (__pread64)
+weak_alias (__pread64, __pread64_nocancel)
check_no_hidden(__read);
+check_no_hidden(__read_nocancel);
__ssize_t weak_function
__read (int fd, void *buf, size_t nbytes)
{
return __pread64 (fd, buf, nbytes, -1);
}
libc_hidden_weak (__read)
+weak_alias (__read, __read_nocancel)
check_no_hidden(__write);
__ssize_t weak_function
diff --git a/sysdeps/mach/hurd/i386/ld.abilist b/sysdeps/mach/hurd/i386/ld.abilist
index b2be75cbff..b4fce5e5f5 100644
--- a/sysdeps/mach/hurd/i386/ld.abilist
+++ b/sysdeps/mach/hurd/i386/ld.abilist
@@ -6,6 +6,7 @@ GLIBC_2.2.6 __libc_stack_end D 0x4
GLIBC_2.2.6 __mmap F
GLIBC_2.2.6 __open F
GLIBC_2.2.6 __open64 F
+GLIBC_2.2.6 __pread64 F
GLIBC_2.2.6 __read F
GLIBC_2.2.6 __sbrk F
GLIBC_2.2.6 __strtoul_internal F
diff --git a/sysdeps/mach/hurd/i386/localplt.data b/sysdeps/mach/hurd/i386/localplt.data
index 541c3f32ae..c9f3ca66f9 100644
--- a/sysdeps/mach/hurd/i386/localplt.data
+++ b/sysdeps/mach/hurd/i386/localplt.data
@@ -19,7 +19,10 @@ ld.so: _dl_catch_exception + REL R_386_GLOB_DAT
ld.so: __open ?
ld.so: __open64
ld.so: __close
-ld.so: __read
+ld.so: __read ?
+ld.so: __read_nocancel
+ld.so: __pread64
+ld.so: __pread64_nocancel
ld.so: __write
ld.so: __writev
ld.so: __libc_lseek64
diff --git a/sysdeps/mach/hurd/not-cancel.h b/sysdeps/mach/hurd/not-cancel.h
index 15acfa3b92..8a8f5a9d3c 100644
--- a/sysdeps/mach/hurd/not-cancel.h
+++ b/sysdeps/mach/hurd/not-cancel.h
@@ -42,10 +42,12 @@
void __close_nocancel_nostatus (int fd);
-#define __read_nocancel(fd, buf, n) \
- __read (fd, buf, n)
-#define __pread64_nocancel(fd, buf, count, offset) \
- __pread64 (fd, buf, count, offset)
+/* Non cancellable read syscall. */
+__typeof (__read) __read_nocancel;
+
+/* Non cancellable pread syscall (LFS version). */
+__typeof (__pread64) __pread64_nocancel;
+
#define __write_nocancel(fd, buf, n) \
__write (fd, buf, n)
#define __writev_nocancel_nostatus(fd, iov, n) \
@@ -55,7 +57,9 @@ void __close_nocancel_nostatus (int fd);
#define __fcntl64_nocancel(fd, cmd, ...) \
__fcntl64 (fd, cmd, __VA_ARGS__)
-#if IS_IN (libc) || IS_IN (rtld)
+#if IS_IN (libc)
+hidden_proto (__read_nocancel)
+hidden_proto (__pread64_nocancel)
hidden_proto (__close_nocancel_nostatus)
#endif
diff --git a/sysdeps/mach/hurd/pread64.c b/sysdeps/mach/hurd/pread64.c
index 7683e29c99..e14416e63a 100644
--- a/sysdeps/mach/hurd/pread64.c
+++ b/sysdeps/mach/hurd/pread64.c
@@ -17,19 +17,17 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <unistd.h>
-#include <hurd/fd.h>
+#include <sysdep-cancel.h>
+#include <not-cancel.h>
ssize_t
__libc_pread64 (int fd, void *buf, size_t nbytes, off64_t offset)
{
- error_t err;
- if (offset < 0)
- err = EINVAL;
- else
- err = HURD_FD_USE (fd, _hurd_fd_read (descriptor, buf, &nbytes, offset));
- return err ? __hurd_dfail (fd, err) : nbytes;
+ ssize_t ret;
+ int cancel_oldtype = LIBC_CANCEL_ASYNC();
+ ret = __pread64_nocancel (fd, buf, nbytes, offset);
+ LIBC_CANCEL_RESET (cancel_oldtype);
+ return ret;
}
#ifndef __libc_pread64
diff --git a/sysdeps/mach/hurd/pread64_nocancel.c b/sysdeps/mach/hurd/pread64_nocancel.c
new file mode 100644
index 0000000000..f6bc5e62b4
--- /dev/null
+++ b/sysdeps/mach/hurd/pread64_nocancel.c
@@ -0,0 +1,35 @@
+/* Read block from given position in file without changing file pointer.
+ Hurd version.
+ Copyright (C) 2001-2020 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
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <hurd/fd.h>
+#include <not-cancel.h>
+
+ssize_t
+__pread64_nocancel (int fd, void *buf, size_t nbytes, off64_t offset)
+{
+ error_t err;
+ if (offset < 0)
+ err = EINVAL;
+ else
+ err = HURD_FD_USE (fd, _hurd_fd_read (descriptor, buf, &nbytes, offset));
+ return err ? __hurd_dfail (fd, err) : nbytes;
+}
+libc_hidden_weak (__pread64_nocancel)
diff --git a/sysdeps/mach/hurd/read.c b/sysdeps/mach/hurd/read.c
index 2e8f92a542..00e574e6d1 100644
--- a/sysdeps/mach/hurd/read.c
+++ b/sysdeps/mach/hurd/read.c
@@ -15,16 +15,18 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <unistd.h>
-#include <hurd/fd.h>
+#include <sysdep-cancel.h>
+#include <not-cancel.h>
/* Read NBYTES into BUF from FD. Return the number read or -1. */
ssize_t
__libc_read (int fd, void *buf, size_t nbytes)
{
- error_t err = HURD_FD_USE (fd, _hurd_fd_read (descriptor, buf, &nbytes, -1));
- return err ? __hurd_dfail (fd, err) : nbytes;
+ ssize_t ret;
+ int cancel_oldtype = LIBC_CANCEL_ASYNC();
+ ret = __read_nocancel (fd, buf, nbytes);
+ LIBC_CANCEL_RESET (cancel_oldtype);
+ return ret;
}
libc_hidden_def (__libc_read)
weak_alias (__libc_read, __read)
diff --git a/sysdeps/mach/hurd/read_nocancel.c b/sysdeps/mach/hurd/read_nocancel.c
new file mode 100644
index 0000000000..1aeae44d41
--- /dev/null
+++ b/sysdeps/mach/hurd/read_nocancel.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1993-2020 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
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <hurd/fd.h>
+#include <not-cancel.h>
+
+/* Read NBYTES into BUF from FD. Return the number read or -1. */
+ssize_t
+__read_nocancel (int fd, void *buf, size_t nbytes)
+{
+ error_t err = HURD_FD_USE (fd, _hurd_fd_read (descriptor, buf, &nbytes, -1));
+ return err ? __hurd_dfail (fd, err) : nbytes;
+}
+libc_hidden_weak (__read_nocancel)
--
2.26.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [hurd, commited 3/5] htl: Fix tls initialization for already-created threads
2020-06-08 0:06 [hurd,commited 0/5] Fix and enable more tests Samuel Thibault
2020-06-08 0:06 ` [hurd,commited 1/5] hurd: Fix unwinding over interruptible RPC Samuel Thibault
2020-06-08 0:06 ` [hurd,commited 2/5] hurd: Make read and pread64 cancellable Samuel Thibault
@ 2020-06-08 0:06 ` Samuel Thibault
2020-06-08 0:06 ` [hurd, commited 4/5] htl: Fix registration of atfork handlers in modules Samuel Thibault
2020-06-08 0:06 ` [hurd,commited 5/5] htl: Enable more tests Samuel Thibault
4 siblings, 0 replies; 6+ messages in thread
From: Samuel Thibault @ 2020-06-08 0:06 UTC (permalink / raw)
To: libc-alpha; +Cc: Samuel Thibault, commit-hurd
* sysdeps/htl/pthreadP.h: Include <link.h>
(__pthread_init_static_tls): New prototype.
* htl/pt-alloc.c (__pthread_init_static_tls): New function.
* sysdeps/mach/hurd/htl/pt-sysdep.c (_init_routine): Initialize tcb
field of initial thread. Set GL(dl_init_static_tls) to
&__pthread_init_static_tls.
---
htl/pt-alloc.c | 29 +++++++++++++++++++++++++++++
sysdeps/htl/pthreadP.h | 3 +++
sysdeps/mach/hurd/htl/pt-sysdep.c | 3 +++
3 files changed, 35 insertions(+)
diff --git a/htl/pt-alloc.c b/htl/pt-alloc.c
index 4e6fa52c4a..d4426bb2e3 100644
--- a/htl/pt-alloc.c
+++ b/htl/pt-alloc.c
@@ -212,3 +212,32 @@ retry:
*pthread = new;
return 0;
}
+
+void
+attribute_hidden
+__pthread_init_static_tls (struct link_map *map)
+{
+ int i;
+
+ __pthread_rwlock_wrlock (&__pthread_threads_lock);
+ for (i = 0; i < __pthread_num_threads; ++i)
+ {
+ struct __pthread *t = __pthread_threads[i];
+
+ if (t == NULL)
+ continue;
+
+# if TLS_TCB_AT_TP
+ void *dest = (char *) t->tcb - map->l_tls_offset;
+# elif TLS_DTV_AT_TP
+ void *dest = (char *) t->tcb + map->l_tls_offset + TLS_PRE_TCB_SIZE;
+# else
+# 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);
+ }
+ __pthread_rwlock_unlock (&__pthread_threads_lock);
+}
diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
index 7486c9383e..0eb969ea1a 100644
--- a/sysdeps/htl/pthreadP.h
+++ b/sysdeps/htl/pthreadP.h
@@ -22,10 +22,13 @@
#define __PTHREAD_HTL
#include <pthread.h>
+#include <link.h>
/* Attribute to indicate thread creation was issued from C11 thrd_create. */
#define ATTR_C11_THREAD ((void*)(uintptr_t)-1)
+extern void __pthread_init_static_tls (struct link_map *) attribute_hidden;
+
/* These represent the interface used by glibc itself. */
extern pthread_t __pthread_self (void);
diff --git a/sysdeps/mach/hurd/htl/pt-sysdep.c b/sysdeps/mach/hurd/htl/pt-sysdep.c
index 84d191475d..0963b44878 100644
--- a/sysdeps/mach/hurd/htl/pt-sysdep.c
+++ b/sysdeps/mach/hurd/htl/pt-sysdep.c
@@ -77,6 +77,7 @@ _init_routine (void *stack)
to the new stack. Pretend it wasn't allocated so that it remains
valid if the main thread terminates. */
thread->stack = 0;
+ thread->tcb = THREAD_SELF;
#ifndef PAGESIZE
__pthread_default_attr.__guardsize = __vm_page_size;
@@ -91,6 +92,8 @@ _init_routine (void *stack)
__pthread_atfork (NULL, NULL, reset_pthread_total);
+ GL(dl_init_static_tls) = &__pthread_init_static_tls;
+
/* Make MiG code thread aware. */
__mig_init (thread->stackaddr);
--
2.26.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [hurd, commited 4/5] htl: Fix registration of atfork handlers in modules
2020-06-08 0:06 [hurd,commited 0/5] Fix and enable more tests Samuel Thibault
` (2 preceding siblings ...)
2020-06-08 0:06 ` [hurd, commited 3/5] htl: Fix tls initialization for already-created threads Samuel Thibault
@ 2020-06-08 0:06 ` Samuel Thibault
2020-06-08 0:06 ` [hurd,commited 5/5] htl: Enable more tests Samuel Thibault
4 siblings, 0 replies; 6+ messages in thread
From: Samuel Thibault @ 2020-06-08 0:06 UTC (permalink / raw)
To: libc-alpha; +Cc: Samuel Thibault, commit-hurd
We really need modules to use their own pthread_atfork so that
__dso_handle properly identifies them.
* sysdeps/htl/pt-atfork.c (__pthread_atfork): Hide function.
(pthread_atfork): Hide alias.
* sysdeps/htl/old_pt-atfork.c (pthread_atfork): Rename macro to
__pthread_atfork to fix building the compatibility alias.
---
sysdeps/htl/old_pt-atfork.c | 4 ++--
sysdeps/htl/pt-atfork.c | 10 ++++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/sysdeps/htl/old_pt-atfork.c b/sysdeps/htl/old_pt-atfork.c
index d954b68f63..c7231d1feb 100644
--- a/sysdeps/htl/old_pt-atfork.c
+++ b/sysdeps/htl/old_pt-atfork.c
@@ -19,8 +19,8 @@
#include <shlib-compat.h>
#if SHLIB_COMPAT(libpthread, GLIBC_2_12, GLIBC_2_23)
-# define pthread_atfork __dyn_pthread_atfork
+# define __pthread_atfork __dyn_pthread_atfork
# include "pt-atfork.c"
-# undef pthread_atfork
+# undef __pthread_atfork
compat_symbol (libpthread, __dyn_pthread_atfork, pthread_atfork, GLIBC_2_12);
#endif
diff --git a/sysdeps/htl/pt-atfork.c b/sysdeps/htl/pt-atfork.c
index d547dd58e6..db8068e656 100644
--- a/sysdeps/htl/pt-atfork.c
+++ b/sysdeps/htl/pt-atfork.c
@@ -21,11 +21,21 @@
#include <fork.h>
#include <dso_handle.h>
+/* Hide the symbol so that no definition but the one locally in the
+ executable or DSO is used. */
int
+#ifndef __pthread_atfork
+/* Don't mark the compatibility function as hidden. */
+attribute_hidden
+#endif
__pthread_atfork (void (*prepare) (void),
void (*parent) (void),
void (*child) (void))
{
return __register_atfork (prepare, parent, child, __dso_handle);
}
+#ifndef __pthread_atfork
+extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),
+ void (*child) (void)) attribute_hidden;
weak_alias (__pthread_atfork, pthread_atfork)
+#endif
--
2.26.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [hurd,commited 5/5] htl: Enable more tests
2020-06-08 0:06 [hurd,commited 0/5] Fix and enable more tests Samuel Thibault
` (3 preceding siblings ...)
2020-06-08 0:06 ` [hurd, commited 4/5] htl: Fix registration of atfork handlers in modules Samuel Thibault
@ 2020-06-08 0:06 ` Samuel Thibault
4 siblings, 0 replies; 6+ messages in thread
From: Samuel Thibault @ 2020-06-08 0:06 UTC (permalink / raw)
To: libc-alpha; +Cc: Samuel Thibault, commit-hurd
* nptl/tst-_res1.c, tst-_res1mod1.c, tst-_res1mod2.c, tst-atfork2.c,
tst-atfork2mod.c, tst-fini1.c, tst-fini1mod.c, tst-tls4.c, tst-tls4moda.c,
tst-tls4modb.c: Move to...
* sysdeps/pthread: ... here. Rename tst-tls4.c to tst-pt-tls4.c to avoid
conflicting with elf/tst-tls4.c.
* nptl/Makefile: Move corresponding references and rules to...
* sysdeps/pthread/Makefile: ... here.
---
nptl/Makefile | 41 ++-----------------
sysdeps/pthread/Makefile | 41 +++++++++++++++++++
{nptl => sysdeps/pthread}/tst-_res1.c | 0
{nptl => sysdeps/pthread}/tst-_res1mod1.c | 0
{nptl => sysdeps/pthread}/tst-_res1mod2.c | 0
{nptl => sysdeps/pthread}/tst-atfork2.c | 0
{nptl => sysdeps/pthread}/tst-atfork2mod.c | 0
{nptl => sysdeps/pthread}/tst-fini1.c | 0
{nptl => sysdeps/pthread}/tst-fini1mod.c | 0
.../pthread/tst-pt-tls4.c | 0
{nptl => sysdeps/pthread}/tst-tls4moda.c | 0
{nptl => sysdeps/pthread}/tst-tls4modb.c | 0
12 files changed, 45 insertions(+), 37 deletions(-)
rename {nptl => sysdeps/pthread}/tst-_res1.c (100%)
rename {nptl => sysdeps/pthread}/tst-_res1mod1.c (100%)
rename {nptl => sysdeps/pthread}/tst-_res1mod2.c (100%)
rename {nptl => sysdeps/pthread}/tst-atfork2.c (100%)
rename {nptl => sysdeps/pthread}/tst-atfork2mod.c (100%)
rename {nptl => sysdeps/pthread}/tst-fini1.c (100%)
rename {nptl => sysdeps/pthread}/tst-fini1mod.c (100%)
rename nptl/tst-tls4.c => sysdeps/pthread/tst-pt-tls4.c (100%)
rename {nptl => sysdeps/pthread}/tst-tls4moda.c (100%)
rename {nptl => sysdeps/pthread}/tst-tls4modb.c (100%)
diff --git a/nptl/Makefile b/nptl/Makefile
index 9b549454f1..3f0b107d2f 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -364,27 +364,23 @@ tests += tst-cancelx4 tst-cancelx5 tst-cancelx6 tst-cancelx7 tst-cancelx9 \
tst-cleanupx4
ifeq ($(build-shared),yes)
-tests += tst-atfork2 tst-tls4 tst-_res1 tst-fini1 tst-compat-forwarder \
- tst-audit-threads
+tests += tst-compat-forwarder tst-audit-threads
tests-internal += tst-tls3 tst-tls3-malloc tst-tls5 tst-stackguard1
-tests-nolibpthread += tst-fini1
ifeq ($(have-z-execstack),yes)
tests += tst-execstack
endif
endif
-modules-names = tst-atfork2mod tst-tls3mod tst-tls4moda tst-tls4modb \
+modules-names = tst-tls3mod \
tst-tls5mod tst-tls5moda tst-tls5modb tst-tls5modc \
tst-tls5modd tst-tls5mode tst-tls5modf tst-stack4mod \
- tst-_res1mod1 tst-_res1mod2 tst-execstack-mod tst-fini1mod \
+ tst-execstack-mod \
tst-compat-forwarder-mod tst-audit-threads-mod1 \
tst-audit-threads-mod2
extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) \
tst-cleanup4aux.o tst-cleanupx4aux.o
test-extras += tst-cleanup4aux tst-cleanupx4aux
-test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
-tst-atfork2mod.so-no-z-defs = yes
tst-tls3mod.so-no-z-defs = yes
tst-tls5mod.so-no-z-defs = yes
tst-tls5moda.so-no-z-defs = yes
@@ -394,11 +390,6 @@ tst-tls5modd.so-no-z-defs = yes
tst-tls5mode.so-no-z-defs = yes
tst-tls5modf.so-no-z-defs = yes
-ifeq ($(build-shared),yes)
-# Build all the modules even when not actually running test programs.
-tests: $(test-modules)
-endif
-
ifeq ($(build-shared),yes)
# Set the `multidir' variable by grabbing the variable from the compiler.
@@ -510,11 +501,6 @@ CFLAGS-tst-initializers1-gnu11.c += $(CFLAGS-tst-initializers1-<)
tst-cancel7-ARGS = --command "exec $(host-test-program-cmd)"
tst-cancelx7-ARGS = $(tst-cancel7-ARGS)
-$(objpfx)tst-atfork2: $(libdl) $(shared-thread-library)
-LDFLAGS-tst-atfork2 = -rdynamic
-tst-atfork2-ENV = MALLOC_TRACE=$(objpfx)tst-atfork2.mtrace
-$(objpfx)tst-atfork2mod.so: $(shared-thread-library)
-
tst-stack3-ENV = MALLOC_TRACE=$(objpfx)tst-stack3.mtrace
$(objpfx)tst-stack3-mem.out: $(objpfx)tst-stack3.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-stack3.mtrace > $@; \
@@ -546,9 +532,6 @@ $(objpfx)tst-tls3-malloc: $(libdl) $(shared-thread-library)
LDFLAGS-tst-tls3-malloc = -rdynamic
$(objpfx)tst-tls3-malloc.out: $(objpfx)tst-tls3mod.so
-$(objpfx)tst-tls4: $(libdl) $(shared-thread-library)
-$(objpfx)tst-tls4.out: $(objpfx)tst-tls4moda.so $(objpfx)tst-tls4modb.so
-
$(objpfx)tst-tls5: $(objpfx)tst-tls5mod.so $(shared-thread-library)
LDFLAGS-tst-tls5 = -Wl,--no-as-needed
LDFLAGS-tst-tls5mod.so = -Wl,-soname,tst-tls5mod.so
@@ -565,8 +548,6 @@ endif
$(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library)
-$(objpfx)tst-fini1: $(shared-thread-library) $(objpfx)tst-fini1mod.so
-
ifeq (yes,$(build-shared))
librt = $(common-objpfx)rt/librt.so
else
@@ -579,11 +560,6 @@ $(common-objpfx)rt/librt.so: $(shared-thread-library)
$(objpfx)tst-cancel17: $(librt)
$(objpfx)tst-cancelx17: $(librt)
-$(objpfx)tst-_res1mod2.so: $(objpfx)tst-_res1mod1.so
-LDFLAGS-tst-_res1mod1.so = -Wl,-soname,tst-_res1mod1.so
-LDFLAGS-tst-_res1mod2.so = -Wl,-soname,tst-_res1mod2.so
-$(objpfx)tst-_res1: $(objpfx)tst-_res1mod1.so $(objpfx)tst-_res1mod2.so \
- $(shared-thread-library)
LDLIBS-tst-cancel24 = -Wl,--no-as-needed -lstdc++
LDLIBS-tst-cancel24-static = $(LDLIBS-tst-cancel24)
@@ -593,10 +569,6 @@ $(objpfx)libpthread.so: $(addprefix $(objpfx),$(crti-objs) $(crtn-objs))
$(objpfx)libpthread.so: +preinit += $(addprefix $(objpfx),$(crti-objs))
$(objpfx)libpthread.so: +postinit += $(addprefix $(objpfx),$(crtn-objs))
-ifeq ($(build-shared),yes)
-$(objpfx)tst-atfork2.out: $(objpfx)tst-atfork2mod.so
-endif
-
ifeq ($(build-shared),yes)
$(objpfx)crti.o: $(objpfx)pt-crti.o
ln -f $< $@
@@ -609,10 +581,7 @@ $(objpfx)$(multidir)/crtn.o: $(objpfx)crtn.o $(objpfx)$(multidir)/
ln -f $< $@
endif
-generated += multidir.mk tst-atfork2.mtrace tst-tls6.out
-
-generated += $(objpfx)tst-atfork2.mtrace \
- $(addsuffix .so,$(strip $(modules-names)))
+generated += multidir.mk tst-tls6.out
# Give libpthread.so an entry point and make it directly runnable itself.
LDFLAGS-pthread.so += -e __nptl_main
@@ -627,8 +596,6 @@ $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
LDFLAGS-tst-execstack = -Wl,-z,noexecstack
CFLAGS-tst-execstack-mod.c += -Wno-trampolines
-$(objpfx)tst-fini1mod.so: $(shared-thread-library)
-
tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
index 5f9610ecbf..2d483c8534 100644
--- a/sysdeps/pthread/Makefile
+++ b/sysdeps/pthread/Makefile
@@ -117,6 +117,22 @@ tests += tst-cancelx2 tst-cancelx3 tst-cancelx8 tst-cancelx10 \
tst-cancelx12 tst-cancelx14 tst-cancelx15 tst-cancelx18 \
tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3
+ifeq ($(build-shared),yes)
+tests += tst-atfork2 tst-pt-tls4 tst-_res1 tst-fini1
+tests-nolibpthread += tst-fini1
+endif
+
+modules-names += tst-atfork2mod tst-tls4moda tst-tls4modb \
+ tst-_res1mod1 tst-_res1mod2 tst-fini1mod
+test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
+
+tst-atfork2mod.so-no-z-defs = yes
+
+ifeq ($(build-shared),yes)
+# Build all the modules even when not actually running test programs.
+tests: $(test-modules)
+endif
+
tests-static += tst-locale1 tst-locale2
tests += tst-cond11-static
@@ -150,6 +166,15 @@ CFLAGS-tst-pt-align3.c += $(stack-align-test-flags)
tst-umask1-ARGS = $(objpfx)tst-umask1.temp
+$(objpfx)tst-atfork2: $(libdl) $(shared-thread-library)
+LDFLAGS-tst-atfork2 = -rdynamic
+tst-atfork2-ENV = MALLOC_TRACE=$(objpfx)tst-atfork2.mtrace
+$(objpfx)tst-atfork2mod.so: $(shared-thread-library)
+
+ifeq ($(build-shared),yes)
+$(objpfx)tst-atfork2.out: $(objpfx)tst-atfork2mod.so
+endif
+
ifeq ($(build-shared),yes)
$(objpfx)tst-cleanup0.out: /dev/null $(objpfx)tst-cleanup0
$(make-test-out) > $@ 2>&1; \
@@ -164,7 +189,23 @@ else
$(objpfx)tst-cancel28: $(common-objpfx)rt/librt.a
endif
+$(objpfx)tst-fini1: $(shared-thread-library) $(objpfx)tst-fini1mod.so
+
+$(objpfx)tst-fini1mod.so: $(shared-thread-library)
+
+$(objpfx)tst-_res1mod2.so: $(objpfx)tst-_res1mod1.so
+LDFLAGS-tst-_res1mod1.so = -Wl,-soname,tst-_res1mod1.so
+LDFLAGS-tst-_res1mod2.so = -Wl,-soname,tst-_res1mod2.so
+$(objpfx)tst-_res1: $(objpfx)tst-_res1mod1.so $(objpfx)tst-_res1mod2.so \
+ $(shared-thread-library)
+
+$(objpfx)tst-pt-tls4: $(libdl) $(shared-thread-library)
+$(objpfx)tst-pt-tls4.out: $(objpfx)tst-tls4moda.so $(objpfx)tst-tls4modb.so
+
+generated += tst-atfork2.mtrace
+generated += $(objpfx)tst-atfork2.mtrace \
+ $(addsuffix .so,$(strip $(modules-names)))
tests-internal += tst-robust8
diff --git a/nptl/tst-_res1.c b/sysdeps/pthread/tst-_res1.c
similarity index 100%
rename from nptl/tst-_res1.c
rename to sysdeps/pthread/tst-_res1.c
diff --git a/nptl/tst-_res1mod1.c b/sysdeps/pthread/tst-_res1mod1.c
similarity index 100%
rename from nptl/tst-_res1mod1.c
rename to sysdeps/pthread/tst-_res1mod1.c
diff --git a/nptl/tst-_res1mod2.c b/sysdeps/pthread/tst-_res1mod2.c
similarity index 100%
rename from nptl/tst-_res1mod2.c
rename to sysdeps/pthread/tst-_res1mod2.c
diff --git a/nptl/tst-atfork2.c b/sysdeps/pthread/tst-atfork2.c
similarity index 100%
rename from nptl/tst-atfork2.c
rename to sysdeps/pthread/tst-atfork2.c
diff --git a/nptl/tst-atfork2mod.c b/sysdeps/pthread/tst-atfork2mod.c
similarity index 100%
rename from nptl/tst-atfork2mod.c
rename to sysdeps/pthread/tst-atfork2mod.c
diff --git a/nptl/tst-fini1.c b/sysdeps/pthread/tst-fini1.c
similarity index 100%
rename from nptl/tst-fini1.c
rename to sysdeps/pthread/tst-fini1.c
diff --git a/nptl/tst-fini1mod.c b/sysdeps/pthread/tst-fini1mod.c
similarity index 100%
rename from nptl/tst-fini1mod.c
rename to sysdeps/pthread/tst-fini1mod.c
diff --git a/nptl/tst-tls4.c b/sysdeps/pthread/tst-pt-tls4.c
similarity index 100%
rename from nptl/tst-tls4.c
rename to sysdeps/pthread/tst-pt-tls4.c
diff --git a/nptl/tst-tls4moda.c b/sysdeps/pthread/tst-tls4moda.c
similarity index 100%
rename from nptl/tst-tls4moda.c
rename to sysdeps/pthread/tst-tls4moda.c
diff --git a/nptl/tst-tls4modb.c b/sysdeps/pthread/tst-tls4modb.c
similarity index 100%
rename from nptl/tst-tls4modb.c
rename to sysdeps/pthread/tst-tls4modb.c
--
2.26.2
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-06-08 0:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08 0:06 [hurd,commited 0/5] Fix and enable more tests Samuel Thibault
2020-06-08 0:06 ` [hurd,commited 1/5] hurd: Fix unwinding over interruptible RPC Samuel Thibault
2020-06-08 0:06 ` [hurd,commited 2/5] hurd: Make read and pread64 cancellable Samuel Thibault
2020-06-08 0:06 ` [hurd, commited 3/5] htl: Fix tls initialization for already-created threads Samuel Thibault
2020-06-08 0:06 ` [hurd, commited 4/5] htl: Fix registration of atfork handlers in modules Samuel Thibault
2020-06-08 0:06 ` [hurd,commited 5/5] htl: Enable more tests Samuel Thibault
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).