RFR: JDK-8283326: Implement SafeFetch statically
Thomas Stuefe
stuefe at openjdk.java.net
Mon Apr 11 12:00:39 UTC 2022
On Mon, 11 Apr 2022 09:58:16 GMT, Florian Weimer <fweimer at openjdk.org> wrote:
>> 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?
@fweimer-rh I'll move `pthread_setspecific` out of signal handling, thanks for the hint.
`pthread_getspecific` may not be signal safe, but it has been in use in JVM signal handlers for decades (signal handlers call `Thread::current`, which uses TLS) and it works in practice on all Posix platforms.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7865
More information about the hotspot-dev
mailing list