RFR: 8345810: Custom launchers must be linked with pthread to avoid dynamic linker issues [v2]

Alexey Semenyuk asemenyuk at openjdk.org
Thu Aug 28 21:17:44 UTC 2025


On Thu, 28 Aug 2025 15:10:03 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
>>  - [ ] Linux AArch64 server fastdebug, `tools/jpackage`, 20x, no failures
>>  - [x] Linux AArch64 server fastdebug, `jdk_all`, no failures
>
> Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
> 
>  - Broader pthread linkage for all JDK jtreg executables, similar to how Hotspot jtreg executables do it
>  - Merge branch 'master' into JDK-8345810-custom-launcher-dlerror
>  - Change to LIB* variables
>  - Fix

jpackage changes look good.

-------------

Marked as reviewed by asemenyuk (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/26978#pullrequestreview-3166566092


More information about the core-libs-dev mailing list