On Wed, 20 Aug 2025 15:36:14 GMT, Evgeny Astigeevich <[email protected]> wrote:
> 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. This pull request has now been integrated. Changeset: 46ae1ee8 Author: Evgeny Astigeevich <[email protected]> URL: https://git.openjdk.org/jdk/commit/46ae1ee87152742082e6047d0556944d7ae4567d Stats: 187 lines in 3 files changed: 186 ins; 0 del; 1 mod 8277444: Data race between JvmtiClassFileReconstituter::copy_bytecodes and class linking Reviewed-by: dholmes, amenkov, coleenp ------------- PR: https://git.openjdk.org/jdk/pull/26863
