RFR: 8345810: Custom launchers must be linked with pthread to avoid dynamic linker issues
Alexey Semenyuk
asemenyuk at openjdk.org
Thu Aug 28 13:37:41 UTC 2025
On Thu, 28 Aug 2025 07:43:19 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> See the bug for more investigation.
>
> The symptom of the problem is apparent `SIGSEGV` in `dlerror`. We were able to debug it to older glibc issue, which makes `dlerror` not thread-safe when pthreads are not yet loaded. This bug seems to uniquely affect custom launchers. We figured this is because custom launchers are not linked with `pthread`. JLI seems to be avoiding this issue, because it does link with `pthread`. Therefore the fix on the JDK side is to always link custom launchers with `pthread`.
>
> Reproducing the issue is a bit awkward. It requires compiling with older GCC (7.3.1 in my case), so that `libsimdsort` would not expose `avx2_sort` symbol, so that compiler stub initialization sequence would get its own erroneous `dlerror`, which would conflict inside of glibc. The compilations with newer GCC (10, at very least) are not exposed to this. This is why the issue is so elusive. But now that we understand it, we know this is a ticking time bomb that can fire at any time in the future, once any concurrent thread inside of VM gets a non-zero `dlerror` for whatever reason.
>
> Additional testing:
> - [x] Linux AArch64 server fastdebug, `sun/management/jmxremote`, 100x, no failures
> - [x] Linux AArch64 server fastdebug, `tools/jpackage`, 20x, no failures
Marked as reviewed by asemenyuk (Reviewer).
-------------
PR Review: https://git.openjdk.org/jdk/pull/26978#pullrequestreview-3164899835
More information about the core-libs-dev
mailing list