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

Coleen Phillimore coleenp at openjdk.org
Wed Sep 3 11:36:46 UTC 2025


On Tue, 2 Sep 2025 21:45:03 GMT, Evgeny Astigeevich <eastigeevich at openjdk.org> 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.
>
> 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

This looks good now.  Thank you for your patience while we found the right solution.

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

Marked as reviewed by coleenp (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/26863#pullrequestreview-3180219072


More information about the serviceability-dev mailing list