Last commit made on 2021-01-21
Get this branch:
git clone -b azanella/_Fork

Branch merges

Branch information


Recent commits

aa0b91a... by Adhemerval Zanella on 2021-01-19

posix: Add _Fork [BZ #4737]

Austin Group issue 62 [1] droped the async-signal-safe requirement
for fork and provided a asignal-signal-safe _Fork replacement that
does not run the atfork handlers. It will be included in the future
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).


ab406f4... by Adhemerval Zanella on 2021-01-20

support: Add xpthread_kill

Checked on x86_64-linux-gnu.

9540f9a... by Adhemerval Zanella on 2021-01-20

Consolidate pthread_atfork

The pthread_atfork is similar between Linux and Hurd, only the compat
version bits differs. The generic version is place at sysdeps/pthread
with a common name.

It also fixes an issue with Hurd license, where the static-only object
did not use LGPL.

Checked on x86_64-linux-gnu, i686-linux-gnu, and with a build for

eaff71a... by Adhemerval Zanella on 2021-01-21

posix: Do not clobber errno by atfork handlers

Checked on x86_64-linux-gnu.

606255f... by Adhemerval Zanella on 2021-01-19

nptl: Move fork into libc

This is part of the libpthread removal project:


Checked on x86_64-linux-gnu.

4072b4f... by Adhemerval Zanella on 2021-01-18

posix: Consolidate fork implementation

The Linux nptl implementation is used as base for generic fork
implementation to handle the internal locks and mutexes. The
system specific bits are moved a new internal _Fork symbol.

(This new implementation will be used to provide a async-signal-safe
_Fork now that POSIX has clarified that fork might not be
async-signal-safe [1]).

For Hurd it means hat the __nss_database_fork_prepare_parent and
__nss_database_fork_subprocess will be run in a slight different


0c2e4e6... by Adhemerval Zanella on 2021-01-18

linux: Use __libc_single_threaded on fork

Checked on x86_64-linux-gnu.

2f660be... by Adhemerval Zanella on 2021-01-18

posix: Consolidate register-atfork

Both htl and nptl uses a different data structure to implement atfork
handlers. The nptl one was refactored by 27761a1042d to use a dynarray
which simplifies the code.

This patch moves the nptl one to be the generic implementation and
replace Hurd linked one. Different than previous NPTL, Hurd also uses
a global lock, so performance should be similar.

Checked on x86_64-linux-gnu, i686-linux-gnu, and with a build for

d7ee6bd... by Adhemerval Zanella on 2021-01-20

posix: Fix fnmatch.c on bootstrap

Only define FALLTHROUGH for _LIBC and do not check __clang_major__

It partially syncs with gnulib 5c52f00c69f39fe.

Checked with for aarch64-linux-gnu.

961d7cf... by Adhemerval Zanella on 2020-12-29

stdlib: Add testcase for BZ #26241

Old implementation of realpath allocates a PATH_MAX using alloca for
each symlink in the path, leading to MAXSYMLINKS times PATH_MAX
maximum stack usage.

The test create a symlink with __eloop_threshold() loops and creates
a thread with minimum stack size (obtained through
support_small_stack_thread_attribute). The thread issues a stack
allocations that fill the thread allocated stack minus some slack
plus and the realpath usage (which assumes a bounded stack usage).
If realpath uses more than about 2 * PATH_MAX plus some slack it
triggers a stackoverflow.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: DJ Delorie <email address hidden>