]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
posix: Add _Fork [BZ #4737]
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 19 Jan 2021 12:26:31 +0000 (09:26 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 28 Jun 2021 18:55:56 +0000 (15:55 -0300)
Austin Group issue 62 [1] dropped the async-signal-safe requirement
for fork and provided a async-signal-safe _Fork replacement that
does not run the atfork handlers.  It will be included in the next
POSIX standard.

It allow to close a long standing issue to make fork AS-safe (BZ#4737).
As indicated on the bug, besides the internal lock for the atfork
handlers itself; there is no guarantee that the handlers itself will
not introduce more AS-safe issues.

The idea is synchronize fork with the required internal locks to allow
children in multithread processes to use mostly of standard function
(even though POSIX states only AS-safe function should be used).  On
signal handles, _Fork should be used intead and only AS-safe functions
should be used.

For testing, the new tst-_Fork only check basic usage.  I also added
a new tst-mallocfork3 which uses the same strategy to check for
deadlock of tst-mallocfork2 but using threads instead of subprocesses
(and it does deadlock if it replaces _Fork with fork).

[1] https://austingroupbugs.net/view.php?id=62

42 files changed:
NEWS
malloc/Makefile
malloc/tst-mallocfork3.c [new file with mode: 0644]
manual/process.texi
posix/Makefile
posix/Versions
posix/fork.c
posix/tst-_Fork.c [new file with mode: 0644]
posix/unistd.h
sysdeps/mach/hurd/i386/libc.abilist
sysdeps/unix/sysv/linux/aarch64/libc.abilist
sysdeps/unix/sysv/linux/alpha/libc.abilist
sysdeps/unix/sysv/linux/arc/libc.abilist
sysdeps/unix/sysv/linux/arm/be/libc.abilist
sysdeps/unix/sysv/linux/arm/le/libc.abilist
sysdeps/unix/sysv/linux/csky/libc.abilist
sysdeps/unix/sysv/linux/hppa/libc.abilist
sysdeps/unix/sysv/linux/i386/libc.abilist
sysdeps/unix/sysv/linux/ia64/libc.abilist
sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
sysdeps/unix/sysv/linux/microblaze/be/libc.abilist
sysdeps/unix/sysv/linux/microblaze/le/libc.abilist
sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
sysdeps/unix/sysv/linux/nios2/libc.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist
sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist
sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
sysdeps/unix/sysv/linux/sh/be/libc.abilist
sysdeps/unix/sysv/linux/sh/le/libc.abilist
sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist

diff --git a/NEWS b/NEWS
index 6931135ab9eca9b4de8643e465995d860bf6ce79..60933bd975b88e5e44cf576196e20eedea23d4b5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -52,6 +52,14 @@ Major new features:
 * On Linux, a new tunable, glibc.pthread.stack_cache_size, can be used
   to configure the size of the thread stack cache.
 
+* The function _Fork has been added as an async-signal-safe fork replacement
+  since Austin Group issue 62 droped the async-signal-safe requirement for
+  fork (and it will be included in the future POSIX standard).  The new _Fork
+  function does not run any atfork function neither resets any internal state
+  or lock (such as the malloc one), and only sets up a minimal state required
+  to call async-signal-safe functions (such as raise or execve).  This function
+  is currently a GNU extension.
+
 Deprecated and removed features, and other changes affecting compatibility:
 
 * The function pthread_mutex_consistent_np has been deprecated; programs
index 3162301fba3d605534049322b5a537c406159252..9bc2e50a9acc4414a5facb668cedaa62cda3c19c 100644 (file)
@@ -31,6 +31,7 @@ tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
         tst-malloc-backtrace tst-malloc-thread-exit \
         tst-malloc-thread-fail tst-malloc-fork-deadlock \
         tst-mallocfork2 \
+        tst-mallocfork3 \
         tst-interpose-nothread \
         tst-interpose-thread \
         tst-alloc_buffer \
@@ -113,6 +114,8 @@ libmemusage-inhibit-o = $(filter-out .os,$(object-suffixes))
 $(objpfx)tst-malloc-backtrace: $(shared-thread-library)
 $(objpfx)tst-malloc-thread-exit: $(shared-thread-library)
 $(objpfx)tst-malloc-thread-fail: $(shared-thread-library)
+$(objpfx)tst-mallocfork3: $(shared-thread-library)
+$(objpfx)tst-mallocfork3-mcheck: $(shared-thread-library)
 $(objpfx)tst-malloc-fork-deadlock: $(shared-thread-library)
 $(objpfx)tst-malloc-stats-cancellation: $(shared-thread-library)
 $(objpfx)tst-malloc-backtrace-malloc-check: $(shared-thread-library)
diff --git a/malloc/tst-mallocfork3.c b/malloc/tst-mallocfork3.c
new file mode 100644 (file)
index 0000000..4ac99ee
--- /dev/null
@@ -0,0 +1,213 @@
+/* Test case for async-signal-safe _Fork (with respect to malloc).
+   Copyright (C) 2021 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; see the file COPYING.LIB.  If
+   not, see <https://www.gnu.org/licenses/>.  */
+
+/* This test is similar to tst-mallocfork2.c, but specifically stress
+   the async-signal-safeness of _Fork on multithread environment.  */
+
+#include <array_length.h>
+#include <errno.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <support/check.h>
+#include <support/support.h>
+#include <support/xsignal.h>
+#include <support/xthread.h>
+#include <support/xunistd.h>
+#include <sys/wait.h>
+
+/* How many malloc objects to keep arond.  */
+enum { malloc_objects = 1009 };
+
+/* The maximum size of an object.  */
+enum { malloc_maximum_size = 70000 };
+
+/* How many iterations the test performs before exiting.  */
+enum { iterations = 10000 };
+
+/* Barrier for synchronization with the threads sending SIGUSR1
+   signals, to make it more likely that the signals arrive during a
+   fork/free/malloc call.  */
+static pthread_barrier_t barrier;
+
+/* Set to 1 if SIGUSR1 is received.  Used to detect a signal during
+   fork/free/malloc.  */
+static volatile sig_atomic_t sigusr1_received;
+
+/* Periodically set to 1, to indicate that the thread is making
+   progress.  Checked by liveness_signal_handler.  */
+static volatile sig_atomic_t progress_indicator = 1;
+
+/* Set to 1 if an error occurs in the signal handler.  */
+static volatile sig_atomic_t error_indicator = 0;
+
+static void
+sigusr1_handler (int signo)
+{
+  sigusr1_received = 1;
+
+  /* Perform a fork with a trivial subprocess.  */
+  pid_t pid = _Fork ();
+  if (pid == -1)
+    {
+      write_message ("error: fork\n");
+      error_indicator = 1;
+      return;
+    }
+  if (pid == 0)
+    _exit (0);
+  int status;
+  int ret = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0));
+  if (ret < 0)
+    {
+      write_message ("error: waitpid\n");
+      error_indicator = 1;
+      return;
+    }
+  if (status != 0)
+    {
+      write_message ("error: unexpected exit status from subprocess\n");
+      error_indicator = 1;
+      return;
+    }
+}
+
+static void
+liveness_signal_handler (int signo)
+{
+  if (progress_indicator)
+    progress_indicator = 0;
+  else
+    write_message ("warning: thread seems to be stuck\n");
+}
+
+struct signal_send_args
+{
+  pthread_t target;
+  int signo;
+  bool sleep;
+};
+#define SIGNAL_SEND_GET_ARG(arg, field) \
+  (((struct signal_send_args *)(arg))->field)
+
+/* Send SIGNO to the parent thread.  If SLEEP, wait a second between
+   signals, otherwise use barriers to delay sending signals.  */
+static void *
+signal_sender (void *args)
+{
+  int signo = SIGNAL_SEND_GET_ARG (args, signo);
+  bool sleep = SIGNAL_SEND_GET_ARG (args, sleep);
+
+  pthread_t target = SIGNAL_SEND_GET_ARG (args, target);
+  while (true)
+    {
+      if (!sleep)
+        xpthread_barrier_wait (&barrier);
+      xpthread_kill (target, signo);
+      if (sleep)
+        usleep (1 * 1000 * 1000);
+      else
+        xpthread_barrier_wait (&barrier);
+    }
+  return NULL;
+}
+
+static pthread_t sigusr1_sender[5];
+static pthread_t sigusr2_sender;
+
+static int
+do_test (void)
+{
+  xsignal (SIGUSR1, sigusr1_handler);
+  xsignal (SIGUSR2, liveness_signal_handler);
+
+  pthread_t self = pthread_self ();
+
+  struct signal_send_args sigusr2_args = { self, SIGUSR2, true };
+  sigusr2_sender = xpthread_create (NULL, signal_sender, &sigusr2_args);
+
+  /* Send SIGUSR1 signals from several threads.  Hopefully, one
+     signal will hit one of the ciritical functions.  Use a barrier to
+     avoid sending signals while not running fork/free/malloc.  */
+  struct signal_send_args sigusr1_args = { self, SIGUSR1, false };
+  xpthread_barrier_init (&barrier, NULL,
+                         array_length (sigusr1_sender) + 1);
+  for (size_t i = 0; i < array_length (sigusr1_sender); ++i)
+    sigusr1_sender[i] = xpthread_create (NULL, signal_sender, &sigusr1_args);
+
+  void *objects[malloc_objects] = {};
+  unsigned int fork_signals = 0;
+  unsigned int free_signals = 0;
+  unsigned int malloc_signals = 0;
+  unsigned int seed = 1;
+  for (int i = 0; i < iterations; ++i)
+    {
+      progress_indicator = 1;
+      int slot = rand_r (&seed) % malloc_objects;
+      size_t size = rand_r (&seed) % malloc_maximum_size;
+
+      /* Occasionally do a fork first, to catch deadlocks there as
+         well (see bug 24161).  */
+      bool do_fork = (rand_r (&seed) % 7) == 0;
+
+      xpthread_barrier_wait (&barrier);
+      if (do_fork)
+        {
+          sigusr1_received = 0;
+          pid_t pid = _Fork ();
+          TEST_VERIFY_EXIT (pid != -1);
+          if (sigusr1_received)
+            ++fork_signals;
+          if (pid == 0)
+            _exit (0);
+          int status;
+          int ret = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0));
+          if (ret < 0)
+            FAIL_EXIT1 ("waitpid: %m");
+          TEST_COMPARE (status, 0);
+        }
+      sigusr1_received = 0;
+      free (objects[slot]);
+      if (sigusr1_received)
+        ++free_signals;
+      sigusr1_received = 0;
+      objects[slot] = malloc (size);
+      if (sigusr1_received)
+        ++malloc_signals;
+      xpthread_barrier_wait (&barrier);
+
+      if (objects[slot] == NULL || error_indicator != 0)
+        {
+          printf ("error: malloc: %m\n");
+          return 1;
+        }
+    }
+
+  /* Clean up allocations.  */
+  for (int slot = 0; slot < malloc_objects; ++slot)
+    free (objects[slot]);
+
+  printf ("info: signals received during fork: %u\n", fork_signals);
+  printf ("info: signals received during free: %u\n", free_signals);
+  printf ("info: signals received during malloc: %u\n", malloc_signals);
+
+  return 0;
+}
+
+#define TIMEOUT 100
+#include <support/test-driver.c>
index 134d5c61430fe9addc3e9f246410f906050c7f19..28c9531f4294f56eaa06b033228c180a92f9ec30 100644 (file)
@@ -137,8 +137,8 @@ creating a process and making it run another program.
 @cindex parent process
 @cindex subprocess
 A new processes is created when one of the functions
-@code{posix_spawn}, @code{fork}, or @code{vfork} is called.  (The
-@code{system} and @code{popen} also create new processes internally.)
+@code{posix_spawn}, @code{fork}, @code{_Fork} or @code{vfork} is called.
+(The @code{system} and @code{popen} also create new processes internally.)
 Due to the name of the @code{fork} function, the act of creating a new
 process is sometimes called @dfn{forking} a process.  Each new process
 (the @dfn{child process} or @dfn{subprocess}) is allocated a process
@@ -154,9 +154,10 @@ limited information about why the child terminated---for example, its
 exit status code.
 
 A newly forked child process continues to execute the same program as
-its parent process, at the point where the @code{fork} call returns.
-You can use the return value from @code{fork} to tell whether the program
-is running in the parent process or the child.
+its parent process, at the point where the @code{fork} or @code{_Fork}
+call returns.  You can use the return value from @code{fork} or
+@code{_Fork} to tell whether the program is running in the parent process
+or the child.
 
 @cindex process image
 Having several processes run the same program is only occasionally
@@ -248,16 +249,13 @@ It is declared in the header file @file{unistd.h}.
 @deftypefun pid_t fork (void)
 @standards{POSIX.1, unistd.h}
 @safety{@prelim{}@mtsafe{}@asunsafe{@ascuplugin{}}@acunsafe{@aculock{}}}
-@c The nptl/.../linux implementation safely collects fork_handlers into
-@c an alloca()ed linked list and increments ref counters; it uses atomic
-@c ops and retries, avoiding locking altogether.  It then takes the
-@c IO_list lock, resets the thread-local pid, and runs fork.  The parent
-@c restores the thread-local pid, releases the lock, and runs parent
-@c handlers, decrementing the ref count and signaling futex wait if
-@c requested by unregister_atfork.  The child bumps the fork generation,
-@c sets the thread-local pid, resets cpu clocks, initializes the robust
-@c mutex list, the stream locks, the IO_list lock, the dynamic loader
-@c lock, runs the child handlers, reseting ref counters to 1, and
+@c The posix/fork.c implementation iterates over the fork_handlers
+@c using a lock.  It then takes the IO_list lock, resets the thread-local
+@c pid, and runs fork.  The parent releases the lock, and runs parent
+@c handlers, and unlocks the internal lock.  The child bumps the fork
+@c generation, sets the thread-local pid, resets cpu clocks, initializes
+@c the robust mutex list, the stream locks, the IO_list lock, the dynamic
+@c loader lock, runs the child handlers, reseting ref counters to 1, and
 @c initializes the fork lock.  These are all safe, unless atfork
 @c handlers themselves are unsafe.
 The @code{fork} function creates a new process.
@@ -321,6 +319,19 @@ process is cleared.  (The child process inherits its mask of blocked
 signals and signal actions from the parent process.)
 @end itemize
 
+@deftypefun pid_t _Fork (void)
+@standards{GNU, unistd.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+The @code{_Fork} function is similar to @code{fork}, but it does not invoke
+any callbacks registered with @code{pthread_atfork}, nor does it reset
+any internal state or locks (such as the @code{malloc} locks).  In the
+new subprocess, only async-signal-safe functions may be called, such as
+@code{dup2} or @code{execve}.
+
+The @code{_Fork} function is an async-signal-safe replacement of @code{fork}.
+It is a GNU extension.
+
+@end deftypefun
 
 @deftypefun pid_t vfork (void)
 @standards{BSD, unistd.h}
index 3bd7d605dfb4143bbe3b864234bb17702c9aea30..e91ea25ba14826890d3494090e1d5159a95508a2 100644 (file)
@@ -130,7 +130,7 @@ test-srcs   := globtest
 tests           += wordexp-test tst-exec tst-spawn tst-spawn2 tst-spawn3
 endif
 ifeq (yesyes,$(build-shared)$(have-thread-library))
-tests          += tst-getopt-cancel
+tests          += tst-getopt-cancel tst-_Fork
 endif
 tests-static   = tst-exec-static tst-spawn-static
 tests          += $(tests-static)
@@ -299,6 +299,7 @@ $(objpfx)ptestcases.h: PTESTS PTESTS2C.sed
 $(objpfx)runptests.o: $(objpfx)ptestcases.h
 
 $(objpfx)tst-getopt-cancel: $(shared-thread-library)
+$(objpfx)tst-_Fork: $(shared-thread-library)
 
 test-xfail-annexc = yes
 $(objpfx)annexc.out: $(objpfx)annexc
index 5983144d01b9b2a730a681c5597e1f39569d12ea..ee1f41218524c76fa8d6e3dbc624c50a3c99f6bd 100644 (file)
@@ -152,6 +152,7 @@ libc {
   GLIBC_2.30 {
   }
   GLIBC_2.34 {
+    _Fork;
     execveat;
   }
   GLIBC_PRIVATE {
index 940d6a095564df8e7bd1384a30f4e2c2724d61ef..c471f7b15fe4290de6af5a36b18f340e142ae63b 100644 (file)
@@ -41,7 +41,10 @@ __libc_fork (void)
 {
   /* Determine if we are running multiple threads.  We skip some fork
      handlers in the single-thread case, to make fork safer to use in
-     signal handlers.  */
+     signal handlers.  Although POSIX has dropped async-signal-safe
+     requirement for fork (Austin Group tracker issue #62) this is
+     best effort to make is async-signal-safe at least for single-thread
+     case.  */
   bool multiple_threads = __libc_single_threaded == 0;
 
   __run_fork_handlers (atfork_run_prepare, multiple_threads);
diff --git a/posix/tst-_Fork.c b/posix/tst-_Fork.c
new file mode 100644 (file)
index 0000000..43a65c0
--- /dev/null
@@ -0,0 +1,154 @@
+/* Basic tests for _Fork.
+   Copyright (C) 2021 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 <array_length.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <support/check.h>
+#include <support/xsignal.h>
+#include <support/temp_file.h>
+#include <support/xunistd.h>
+#include <support/xthread.h>
+
+/* For single-thread, _Fork behaves like fork.  */
+static int
+singlethread_test (void)
+{
+  const char testdata1[] = "abcdefghijklmnopqrtuvwxz";
+  enum { testdatalen1 = array_length (testdata1) };
+  const char testdata2[] = "01234567890";
+  enum { testdatalen2 = array_length (testdata2) };
+
+  pid_t ppid = getpid ();
+
+  int tempfd = create_temp_file ("tst-_Fork", NULL);
+
+  /* Check if the opened file is shared between process by read and write
+     some data on parent and child processes.  */
+  xwrite (tempfd, testdata1, testdatalen1);
+  off_t off = xlseek (tempfd, 0, SEEK_CUR);
+  TEST_COMPARE (off, testdatalen1);
+
+  pid_t pid = _Fork ();
+  TEST_VERIFY_EXIT (pid != -1);
+  if (pid == 0)
+    {
+      TEST_VERIFY_EXIT (getpid () != ppid);
+      TEST_COMPARE (getppid(), ppid);
+
+      TEST_COMPARE (xlseek (tempfd, 0, SEEK_CUR), testdatalen1);
+
+      xlseek (tempfd, 0, SEEK_SET);
+      char buf[testdatalen1];
+      TEST_COMPARE (read (tempfd, buf, sizeof (buf)), testdatalen1);
+      TEST_COMPARE_BLOB (buf, testdatalen1, testdata1, testdatalen1);
+
+      xlseek (tempfd, 0, SEEK_SET);
+      xwrite (tempfd, testdata2, testdatalen2);
+
+      xclose (tempfd);
+
+      _exit (EXIT_SUCCESS);
+    }
+
+  int status;
+  xwaitpid (pid, &status, 0);
+  TEST_VERIFY (WIFEXITED (status));
+  TEST_COMPARE (WEXITSTATUS (status), EXIT_SUCCESS);
+
+  TEST_COMPARE (xlseek (tempfd, 0, SEEK_CUR), testdatalen2);
+
+  xlseek (tempfd, 0, SEEK_SET);
+  char buf[testdatalen2];
+  TEST_COMPARE (read (tempfd, buf, sizeof (buf)), testdatalen2);
+
+  TEST_COMPARE_BLOB (buf, testdatalen2, testdata2, testdatalen2);
+
+  return 0;
+}
+
+
+static volatile sig_atomic_t sigusr1_handler_ran;
+#define SIG_PID_EXIT_CODE 20
+
+static bool atfork_prepare_var;
+static bool atfork_parent_var;
+static bool atfork_child_var;
+
+static void
+atfork_prepare (void)
+{
+  atfork_prepare_var = true;
+}
+
+static void
+atfork_parent (void)
+{
+  atfork_parent_var = true;
+}
+
+static void
+atfork_child (void)
+{
+  atfork_child_var = true;
+}
+
+/* Different than fork, _Fork does not execute any pthread_atfork
+   handlers.  */
+static int
+singlethread_atfork_test (void)
+{
+  pthread_atfork (atfork_prepare, atfork_parent, atfork_child);
+  singlethread_test ();
+  TEST_VERIFY (!atfork_prepare_var);
+  TEST_VERIFY (!atfork_parent_var);
+  TEST_VERIFY (!atfork_child_var);
+
+  return 0;
+}
+
+static void *
+mt_atfork_test (void *args)
+{
+  singlethread_atfork_test ();
+
+  return NULL;
+}
+
+static int
+multithread_atfork_test (void)
+{
+  pthread_t thr = xpthread_create (NULL, mt_atfork_test, NULL);
+  xpthread_join (thr);
+
+  return 0;
+}
+
+
+static int
+do_test (void)
+{
+  singlethread_atfork_test ();
+  multithread_atfork_test ();
+
+  return 0;
+}
+
+#include <support/test-driver.c>
index d9d8929f7165111bb7cbd522cdfcba503c6cbb3d..217c6c5363be1ee1086475f86d9e6bd9672683f7 100644 (file)
@@ -781,6 +781,13 @@ extern __pid_t fork (void) __THROWNL;
 extern __pid_t vfork (void) __THROW;
 #endif /* Use misc or XPG < 7. */
 
+#ifdef __USE_GNU
+/* This is similar to fork, however it does not run the atfork handlers
+   neither reinitialize any internal locks in multithread case.
+   Different than fork, _Fork is async-signal-safe.  */
+extern __pid_t _Fork (void) __THROW;
+#endif
+
 
 /* Return the pathname of the terminal FD is open on, or NULL on errors.
    The returned storage is good only until the next call to this function.  */
index c3232ba32ec820ad200d9ac4e6a45d5059a4b674..120131a76884f247a9e65a0c45c5745689e0fa51 100644 (file)
@@ -2215,6 +2215,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 __isnanf128 F
 GLIBC_2.34 __libc_start_main F
 GLIBC_2.34 _hurd_libc_proc_init F
index 5ff33f63e320f3ab063f0fe89d3b2aa40badcb95..4736a5966f8ab179eb2636f43c309eaf2f70ba4a 100644 (file)
@@ -2369,6 +2369,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 __libc_start_main F
 GLIBC_2.34 __mq_open_2 F
 GLIBC_2.34 __pthread_cleanup_routine F
index 503a96b255956afc7a6012c00a371506c6db00e0..89257e39c15aab298148846b800aef2e7828cc74 100644 (file)
@@ -2468,6 +2468,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 __libc_start_main F
 GLIBC_2.34 __mq_open_2 F
 GLIBC_2.34 __pthread_cleanup_routine F
index e29bd7cd5583d55c2fec5be70c7bd5d2f7fce70c..e1eef2487796a8e4af64f56ee4f6ecab527dba3d 100644 (file)
@@ -2128,6 +2128,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 __libc_start_main F
 GLIBC_2.34 __mq_open_2 F
 GLIBC_2.34 __pthread_cleanup_routine F
index ac89f19c0ac552193a5957218d90cad78a1ae8ad..19d609e058de446d750f270076a3657ab0f1c8ec 100644 (file)
@@ -190,6 +190,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index 07fce73516068d99d04eb0cda75a7fd29b948940..371274917a86e133b751894bfcbd9b065f34c2b6 100644 (file)
@@ -187,6 +187,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index d06f38eba0c9b4e63baadfe8ed607ff0aa7821f2..ee2ffbabc4a9db0fe35c47368aec5d63d01d1e2b 100644 (file)
@@ -2312,6 +2312,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index 2f5dfd66ad92afda37d6c829a9d9ab3bc447e7ce..c6d4d2478e56cd6e88a5af96d2f98c2cccad84a7 100644 (file)
@@ -2265,6 +2265,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index 1accf0a9c1b7a82ffa98a08fdef2e6792cf82476..f4e30827849c183a51b499dded5314b98205f90d 100644 (file)
@@ -2448,6 +2448,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index 79b4153e63d1bb2f1228dad2791f025e3d158a6d..8c13d8805299cd32c2fe51db8edf5e25ed46165c 100644 (file)
@@ -2305,6 +2305,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 __isnanf128 F
 GLIBC_2.34 __libc_start_main F
 GLIBC_2.34 __mq_open_2 F
index ddbaeb3660b5f7782cfb5fbb4033d2cd71986958..43a692714f7174e419adc22439202b5e81ae2cec 100644 (file)
@@ -191,6 +191,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index 3295de3102e67fdb86a694b5a868acdce0ab1e31..901f086bfaa18c2097ac42c96ef5e2e38df3ee75 100644 (file)
@@ -2392,6 +2392,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index 18d8e9d748e6b82b63d6b598b730436ac6a2ca46..d14576eb2e817ddd633e30cb6f42e63834036450 100644 (file)
@@ -2363,6 +2363,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index 2de03396ddf9c73bcec2b139a19fe0af36671737..b01add6f6c46088abcbe77f0860d78b371b94151 100644 (file)
@@ -2360,6 +2360,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index 302af0376d2320429a34c6f47d131f9ac985dfdf..ea5fee313d260132ae421e3299eca2c3ed11bcb8 100644 (file)
@@ -2357,6 +2357,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index 50e51bf15d9f0852fa2c5431a49a4ad89c63c0e2..5f20e5f3fcce0836e8e5f15fc43ab51e451f2568 100644 (file)
@@ -2355,6 +2355,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index 99be006a91b3544b680fa99c9623d35494dfb727..f3c908124269b3d7d34ea09483d709c230594af9 100644 (file)
@@ -2363,6 +2363,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index f3c39841dd38384b8520023d34dd07966a51757c..2e10c747a25e76c27f54fc89d48598322a86d47a 100644 (file)
@@ -2357,6 +2357,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 __libc_start_main F
 GLIBC_2.34 __mq_open_2 F
 GLIBC_2.34 __pthread_cleanup_routine F
index 55f3102cbf0b245e7863c3d09b4b8d289d4af6a3..36563055a8a97f337351317bf383faa14bdd5e56 100644 (file)
@@ -2402,6 +2402,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index 82144c268ee96a861f6e1f471999ac0b1904e8fb..229731b5756c2eb45f220b3fdb60e514c51a60f6 100644 (file)
@@ -2419,6 +2419,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index 4545f49ceedd7b1c9c3784f62024b4cd33b9d78c..8b3bdc0909df568e98a161e9bd7187836d8503c7 100644 (file)
@@ -2452,6 +2452,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index d47efa98ffb2d86b0d3b632d17df449d98745e83..5797cc29c17b451b63e25f3d3e7d779b70a2d15d 100644 (file)
@@ -2270,6 +2270,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 __libc_start_main F
 GLIBC_2.34 __mq_open_2 F
 GLIBC_2.34 __pthread_cleanup_routine F
index e08cbf7b2a540085e416023c8d1ab4874d2c6fa8..a60d9b5d128f206a9fd39febe78bb9551eec2659 100644 (file)
@@ -2564,6 +2564,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 __isnanf128 F
 GLIBC_2.34 __libc_start_main F
 GLIBC_2.34 __mq_open_2 F
index a8482733cd1e5d45c44618fb57f5f716e79af07f..0c32c81af0864d48a728e3e4f1d1dbf2dc684404 100644 (file)
@@ -2130,6 +2130,7 @@ GLIBC_2.33 wprintf F
 GLIBC_2.33 write F
 GLIBC_2.33 writev F
 GLIBC_2.33 wscanf F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 __libc_start_main F
 GLIBC_2.34 __mq_open_2 F
 GLIBC_2.34 __pthread_cleanup_routine F
index a2448c1c749073eb4a4a5f24fb260ba11095656d..df65b69374672c6fe0de1a4c62fbf708f85cae3d 100644 (file)
@@ -2330,6 +2330,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 __libc_start_main F
 GLIBC_2.34 __mq_open_2 F
 GLIBC_2.34 __pthread_cleanup_routine F
index 5ee1e093911b31dc833b3ef9da084c9944cde337..5497df2f618bc06a229e0983eabb82692e600b61 100644 (file)
@@ -2417,6 +2417,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index 1cd10e7e77f29fc34dad3c9db51e0656606d2f69..8a050a937476a365b276bbeb7b655271d3756753 100644 (file)
@@ -2307,6 +2307,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 __libc_start_main F
 GLIBC_2.34 __mq_open_2 F
 GLIBC_2.34 __pthread_cleanup_routine F
index c621caae80a5ab2a4edd3b77dedfe847003229ba..8de0cd37f38ce830c8f6af59ae3a295666758621 100644 (file)
@@ -2272,6 +2272,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index ba459df43a3907588e143a770db9bfef7871b1e2..ef67585b2ad6bd1b9529ecdc219a8b9119072374 100644 (file)
@@ -2269,6 +2269,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index 5e0eed47e34d19ba1a00413bb63d1fe1aba35778..ee2aa17bcafcd911d1da5b7446598a842cdb9182 100644 (file)
@@ -2412,6 +2412,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 ___adjtimex64 F
 GLIBC_2.34 __adjtime64 F
 GLIBC_2.34 __aio_suspend_time64 F
index 99e6181e24d265b2291e61d6bcc6b7bde0ba9276..8a0cd15b42876f57d912aaba701a0fb6f9965d08 100644 (file)
@@ -2329,6 +2329,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 __libc_start_main F
 GLIBC_2.34 __mq_open_2 F
 GLIBC_2.34 __pthread_cleanup_routine F
index 2460b47dc79396509ae79ac65ee3168fbbad6b3e..63a7bc8388bc0d0fd55fb21a9e005cc2253ef60d 100644 (file)
@@ -2284,6 +2284,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 __isnanf128 F
 GLIBC_2.34 __libc_start_main F
 GLIBC_2.34 __mq_open_2 F
index 8789b1edb2f42128163a1f26a577f96e03ffb4df..cc128a6b9be80b9ea1de397cb77006130f59dff6 100644 (file)
@@ -2383,6 +2383,7 @@ GLIBC_2.33 mknod F
 GLIBC_2.33 mknodat F
 GLIBC_2.33 stat F
 GLIBC_2.33 stat64 F
+GLIBC_2.34 _Fork F
 GLIBC_2.34 __isnanf128 F
 GLIBC_2.34 __libc_start_main F
 GLIBC_2.34 __mq_open_2 F