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

Aleksey Shipilev shade at openjdk.org
Thu Aug 28 15:10:03 UTC 2025


> 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

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

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/26978/files
  - new: https://git.openjdk.org/jdk/pull/26978/files/918551f3..ddaf50f5

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=26978&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26978&range=00-01

  Stats: 12060 lines in 238 files changed: 9865 ins; 1217 del; 978 mod
  Patch: https://git.openjdk.org/jdk/pull/26978.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26978/head:pull/26978

PR: https://git.openjdk.org/jdk/pull/26978


More information about the core-libs-dev mailing list