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

Evgeny Astigeevich eastigeevich at openjdk.org
Tue Sep 2 21:45:03 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 incrementally with one additional commit since the last revision:

  Switch to macros HAS_PENDING_EXCEPTION, CLEAR_PENDING_EXCEPTION

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

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

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

  Stats: 9 lines in 2 files changed: 2 ins; 1 del; 6 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