RFR: 8277444: Data race between JvmtiClassFileReconstituter::copy_bytecodes and class linking [v4]

Evgeny Astigeevich eastigeevich at openjdk.org
Fri Aug 29 22:48:06 UTC 2025


> There is a race between `JvmtiClassFileReconstituter::copy_bytecodes` and `InstanceKlass::link_class_impl`.  `InstanceKlass::link_class_impl` can be rewriting bytecodes. `JvmtiClassFileReconstituter::copy_bytecodes` will not restore them to the original ones because the flag `rewritten` is `false`. This will result in invalid bytecode.
> 
> This PR adds linking a class before the `copy_bytecodes` method is called.
> The PR also adds a regression test.
> 
> Tested fastdebug and release builds: Linux x86_64 and arm64
> - The reproducer from JDK-8277444 passed.
> - The regression test passed.
> - Tier1 - tier3 passed.

Evgeny Astigeevich 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 five additional commits since the last revision:

 - Merge branch 'master' into JDK-8277444
 - Link classes before copy_bytecodes; Add regression test
 - Symplify comments; Get JavaThread::current in variable
 - Add missing include runtime/synchronizer.hpp
 - 8277444: Race condition on Instrumentation.retransformClasses() and class linking

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/26863/files
  - new: https://git.openjdk.org/jdk/pull/26863/files/293d81ff..f5019d97

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=26863&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26863&range=02-03

  Stats: 21687 lines in 641 files changed: 14684 ins; 4507 del; 2496 mod
  Patch: https://git.openjdk.org/jdk/pull/26863.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26863/head:pull/26863

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


More information about the hotspot-dev mailing list