glibc/sysdeps
Jakub Jelinek f0419e6a10 [PATCH] pthread_once hangs when init routine throws an exception [BZ #18435]
This is another attempt at making pthread_once handle throwing exceptions
from the init routine callback.  As the new testcases show, just switching
to the cleanup attribute based cleanup does fix the tst-once5 test, but
breaks the new tst-oncey3 test.  That is because when throwing exceptions,
only the unwind info registered cleanups (i.e. C++ destructors or cleanup
attribute), when cancelling threads and there has been unwind info from the
cancellation point up to whatever needs cleanup both unwind info registered
cleanups and THREAD_SETMEM (self, cleanup, ...) registered cleanups are
invoked, but once we hit some frame with no unwind info, only the
THREAD_SETMEM (self, cleanup, ...) registered cleanups are invoked.
So, to stay fully backwards compatible (allow init routines without
unwind info which encounter cancellation points) and handle exception throwing
we actually need to register the pthread_once cleanups in both unwind info
and in the THREAD_SETMEM (self, cleanup, ...) way.
If an exception is thrown, only the former will happen and we in that case
need to also unregister the THREAD_SETMEM (self, cleanup, ...) registered
handler, because otherwise after catching the exception the user code could
call deeper into the stack some cancellation point, get cancelled and then
a stale cleanup handler would clobber stack and probably crash.
If a thread calling init routine is cancelled and unwind info ends before
the pthread_once frame, it will be cleaned up through self->cleanup as
before.  And if unwind info is present, unwind_stop first calls the
self->cleanup registered handler for the frame, then it will call the
unwind info registered handler but that will already see __do_it == 0
and do nothing.
2021-03-04 15:15:33 +01:00
..
aarch64 aarch64: update ulps. 2021-03-01 12:29:42 +00:00
alpha Implement <unwind-link.h> for dynamically loading the libgcc_s unwinder 2021-03-01 15:58:01 +01:00
arc Reduce the statically linked startup code [BZ #23323] 2021-02-25 12:13:02 +01:00
arm nptl: Use <unwind-link.h> for accessing the libgcc_s unwinder 2021-03-01 16:00:22 +01:00
csky Reduce the statically linked startup code [BZ #23323] 2021-02-25 12:13:02 +01:00
generic Implement _Unwind_Resume in libc on top of <unwind-link.h> 2021-03-01 16:00:03 +01:00
gnu Move sysdeps/gnu/unwind-resume.c to sysdeps/generic/unwind-resume.c 2021-03-01 15:59:49 +01:00
hppa Reduce the statically linked startup code [BZ #23323] 2021-02-25 12:13:02 +01:00
htl linux: Require /dev/shm as the shared memory file system 2021-02-08 14:10:42 -03:00
hurd Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
i386 i386: Regenerate ulps 2021-03-02 15:41:29 +01:00
ia64 Implement <unwind-link.h> for dynamically loading the libgcc_s unwinder 2021-03-01 15:58:01 +01:00
ieee754 math: Add BZ#18980 fix back on dbl-64 cosh 2021-01-11 16:56:33 -03:00
m68k m68k: Implement backtrace on top of <unwind-link.h> 2021-03-01 15:59:12 +01:00
mach Implement <unwind-link.h> for dynamically loading the libgcc_s unwinder 2021-03-01 15:58:01 +01:00
microblaze Reduce the statically linked startup code [BZ #23323] 2021-02-25 12:13:02 +01:00
mips Implement <unwind-link.h> for dynamically loading the libgcc_s unwinder 2021-03-01 15:58:01 +01:00
nios2 Reduce the statically linked startup code [BZ #23323] 2021-02-25 12:13:02 +01:00
nptl nptl: __libc_cleanup_push/__libc_cleanup_pop require -fexceptions 2021-03-02 11:56:33 +01:00
posix linux: Require /dev/shm as the shared memory file system 2021-02-08 14:10:42 -03:00
powerpc powerpc: Regenerate ulps 2021-03-03 18:39:17 +01:00
pthread [PATCH] pthread_once hangs when init routine throws an exception [BZ #18435] 2021-03-04 15:15:33 +01:00
riscv Reduce the statically linked startup code [BZ #23323] 2021-02-25 12:13:02 +01:00
s390 s390x: Regenerate ulps 2021-03-03 12:44:21 +01:00
sh Implement <unwind-link.h> for dynamically loading the libgcc_s unwinder 2021-03-01 15:58:01 +01:00
sparc sparc: Implement backtrace on top <unwind-link.h> 2021-03-01 15:59:25 +01:00
unix tst: Fix tst-timerfd test 2021-03-02 16:55:05 +01:00
wordsize-32 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
wordsize-64 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
x86 x86: Add CPU-specific diagnostics to ld.so --list-diagnostics 2021-03-02 15:01:10 +01:00
x86_64 Add inputs that generate larger error bounds 2021-02-27 06:32:11 +01:00