RFR: JDK-8283326: Implement SafeFetch statically
Florian Weimer
fweimer at openjdk.java.net
Mon Apr 11 10:13:44 UTC 2022
On Mon, 11 Apr 2022 09:03:58 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> src/hotspot/os/posix/safefetch_sigjmp.cpp line 35:
>>
>>> 33:
>>> 34: // For SafeFetch we need POSIX TLS and sigsetjmp/longjmp.
>>> 35: // (Note: We would prefer compiler level TLS but for some reason __thread does not
>>
>> __thread cannot be safely used from a signal handler.
>
> Ah, that explains the weird errors I got. I'll change the comment.
`pthread_getspecific` and `pthread_setspecific` cannot be called from a signal handler, either. In particular, `pthread_setspecific` may call `malloc`.
On GNU/Linux, if you use initial-exec TLS, it is fully async-signal-safe. Less so for the other variants. But maybe this does not matter because the assembler implementation uses `os::Posix::ucontext_set_pc` to redirect the execution in a more direction fashion?
-------------
PR: https://git.openjdk.java.net/jdk/pull/7865
More information about the hotspot-dev
mailing list