From: Adhemerval Zanella Date: Mon, 18 Jan 2021 18:32:02 +0000 (-0300) Subject: linux: Use __libc_single_threaded on fork X-Git-Tag: glibc-2.34~840 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2883de072093ecdb3369cdcd72d69d4fc7b5ae71;p=thirdparty%2Fglibc.git linux: Use __libc_single_threaded on fork Checked on x86_64-linux-gnu. --- diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c index 4fb4c2d254a..f78267b68c5 100644 --- a/sysdeps/nptl/fork.c +++ b/sysdeps/nptl/fork.c @@ -34,6 +34,7 @@ #include #include #include +#include static void fresetlockfiles (void) @@ -55,7 +56,7 @@ __libc_fork (void) handlers in the single-thread case, to make fork safer to use in signal handlers. POSIX requires that fork is async-signal-safe, but our current fork implementation is not. */ - bool multiple_threads = THREAD_GETMEM (THREAD_SELF, header.multiple_threads); + bool multiple_threads = __libc_single_threaded == 0; __run_fork_handlers (atfork_run_prepare, multiple_threads);