diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-07-31 12:44:37 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2024-06-19 09:05:43 -0300 |
commit | 80f34f5173a29833c4f9e73a9725376448769a99 (patch) | |
tree | 4f14d07fe9a9d5c677818d23bda45f9288a5b02d /manual/startup.texi | |
parent | c49e66c7e507f2d37c4725ce4680f19179cfa44e (diff) | |
download | glibc-azanella/bz26275-abort-as.zip glibc-azanella/bz26275-abort-as.tar.gz glibc-azanella/bz26275-abort-as.tar.bz2 |
stdlib: Make abort AS-safe (BZ 26275)azanella/bz26275-abort-as
The recursive lock used on abort does not synchronize with new
process creation (either by fork-like interfaces or posix_spawn
ones), nor it is reinitialized after fork.
Also, the SIGABRT unblock before raise shows another race-condition,
where a fork or posix_spawn call by another thread just after
the recursive lock release and before the SIGABRT raise might create
programs with a non-expected signal mask.
To fix the AS-safe, the raise is issues without changing the process
signal mask, and an AS-safe lock is used if a SIGABRT is installed or
the process is blocked or ignored. The the signal mask change removal,
there is no need to use a recursive lock. The lock is also on
both _Fork and posix_spawn, to avoid the spawn process to see the
abort handler as SIG_DFL.
The posix_spawn possible issue is if caller sets a SIG_IGN for
SIGABRT, calls abort, and another thread issues posix_spawn just
after the sigaction returns. With default options (not setting
POSIX_SPAWN_SETSIGDEF), the process can still see SIG_DFL for
SIGABRT, where it should be SIG_IGN.
The fallback is also simplified, there is no nned to use a loop of
ABORT_INSTRUCTION after _exit (if the syscall does not terminate the
process, the system is really broken).
Checked on x86_64-linux-gnu and aarch64-linux-gnu.
Diffstat (limited to 'manual/startup.texi')
-rw-r--r-- | manual/startup.texi | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/manual/startup.texi b/manual/startup.texi index 224dd98..145acf0 100644 --- a/manual/startup.texi +++ b/manual/startup.texi @@ -991,9 +991,6 @@ for this function is in @file{stdlib.h}. @deftypefun void abort (void) @standards{ISO, stdlib.h} @safety{@prelim{}@mtsafe{}@asunsafe{@asucorrupt{}}@acunsafe{@aculock{} @acucorrupt{}}} -@c The implementation takes a recursive lock and attempts to support -@c calls from signal handlers, but if we're in the middle of flushing or -@c using streams, we may encounter them in inconsistent states. The @code{abort} function causes abnormal program termination. This does not execute cleanup functions registered with @code{atexit} or @code{on_exit}. |