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 /inet | |
parent | c49e66c7e507f2d37c4725ce4680f19179cfa44e (diff) | |
download | glibc-azanella/bz26275-abort-as.tar.gz glibc-azanella/bz26275-abort-as.tar.xz glibc-azanella/bz26275-abort-as.zip |
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 'inet')
0 files changed, 0 insertions, 0 deletions