Andreas Schwab
afe7a231ef
- pthread-rwlock-trylock-stalls.patch: nptl: Fix pthread_rwlock_try*lock stalls (BZ #23844) - arm-systemtap-probe-constraint.patch: arm: Use "nr" constraint for Systemtap probes (BZ #24164) - pthread-mutex-barrier.patch: Add compiler barriers around modifications of the robust mutex list for pthread_mutex_trylock (BZ #24180) - fork-handler-lock.patch: nptl: Avoid fork handler lock for async-signal-safe fork (BZ #24161) - pthread-join-probe.patch: nptl: Fix invalid Systemtap probe in pthread_join (BZ #24211) - riscv-clone-unwind.patch: RISC-V: Fix elfutils testsuite unwind failures (BZ #24040) OBS-URL: https://build.opensuse.org/request/show/677136 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=518
92 lines
3.1 KiB
Diff
92 lines
3.1 KiB
Diff
2019-02-08 Florian Weimer <fweimer@redhat.com>
|
|
|
|
[BZ #24161]
|
|
* sysdeps/nptl/fork.h (__run_fork_handlers): Add multiple_threads
|
|
argument.
|
|
* nptl/register-atfork.c (__run_fork_handlers): Only perform
|
|
locking if the new do_locking argument is true.
|
|
* sysdeps/nptl/fork.c (__libc_fork): Pass multiple_threads to
|
|
__run_fork_handlers.
|
|
|
|
Index: glibc-2.29/nptl/register-atfork.c
|
|
===================================================================
|
|
--- glibc-2.29.orig/nptl/register-atfork.c
|
|
+++ glibc-2.29/nptl/register-atfork.c
|
|
@@ -107,13 +107,14 @@ __unregister_atfork (void *dso_handle)
|
|
}
|
|
|
|
void
|
|
-__run_fork_handlers (enum __run_fork_handler_type who)
|
|
+__run_fork_handlers (enum __run_fork_handler_type who, _Bool do_locking)
|
|
{
|
|
struct fork_handler *runp;
|
|
|
|
if (who == atfork_run_prepare)
|
|
{
|
|
- lll_lock (atfork_lock, LLL_PRIVATE);
|
|
+ if (do_locking)
|
|
+ lll_lock (atfork_lock, LLL_PRIVATE);
|
|
size_t sl = fork_handler_list_size (&fork_handlers);
|
|
for (size_t i = sl; i > 0; i--)
|
|
{
|
|
@@ -133,7 +134,8 @@ __run_fork_handlers (enum __run_fork_han
|
|
else if (who == atfork_run_parent && runp->parent_handler)
|
|
runp->parent_handler ();
|
|
}
|
|
- lll_unlock (atfork_lock, LLL_PRIVATE);
|
|
+ if (do_locking)
|
|
+ lll_unlock (atfork_lock, LLL_PRIVATE);
|
|
}
|
|
}
|
|
|
|
Index: glibc-2.29/sysdeps/nptl/fork.c
|
|
===================================================================
|
|
--- glibc-2.29.orig/sysdeps/nptl/fork.c
|
|
+++ glibc-2.29/sysdeps/nptl/fork.c
|
|
@@ -55,7 +55,7 @@ __libc_fork (void)
|
|
but our current fork implementation is not. */
|
|
bool multiple_threads = THREAD_GETMEM (THREAD_SELF, header.multiple_threads);
|
|
|
|
- __run_fork_handlers (atfork_run_prepare);
|
|
+ __run_fork_handlers (atfork_run_prepare, multiple_threads);
|
|
|
|
/* If we are not running multiple threads, we do not have to
|
|
preserve lock state. If fork runs from a signal handler, only
|
|
@@ -134,7 +134,7 @@ __libc_fork (void)
|
|
__rtld_lock_initialize (GL(dl_load_lock));
|
|
|
|
/* Run the handlers registered for the child. */
|
|
- __run_fork_handlers (atfork_run_child);
|
|
+ __run_fork_handlers (atfork_run_child, multiple_threads);
|
|
}
|
|
else
|
|
{
|
|
@@ -149,7 +149,7 @@ __libc_fork (void)
|
|
}
|
|
|
|
/* Run the handlers registered for the parent. */
|
|
- __run_fork_handlers (atfork_run_parent);
|
|
+ __run_fork_handlers (atfork_run_parent, multiple_threads);
|
|
}
|
|
|
|
return pid;
|
|
Index: glibc-2.29/sysdeps/nptl/fork.h
|
|
===================================================================
|
|
--- glibc-2.29.orig/sysdeps/nptl/fork.h
|
|
+++ glibc-2.29/sysdeps/nptl/fork.h
|
|
@@ -52,9 +52,11 @@ enum __run_fork_handler_type
|
|
- atfork_run_child: run all the CHILD_HANDLER and unlocks the internal
|
|
lock.
|
|
- atfork_run_parent: run all the PARENT_HANDLER and unlocks the internal
|
|
- lock. */
|
|
-extern void __run_fork_handlers (enum __run_fork_handler_type who)
|
|
- attribute_hidden;
|
|
+ lock.
|
|
+
|
|
+ Perform locking only if DO_LOCKING. */
|
|
+extern void __run_fork_handlers (enum __run_fork_handler_type who,
|
|
+ _Bool do_locking) attribute_hidden;
|
|
|
|
/* C library side function to register new fork handlers. */
|
|
extern int __register_atfork (void (*__prepare) (void),
|