RFR: 8277444: Data race between JvmtiClassFileReconstituter::copy_bytecodes and class linking [v4]
Jaikiran Pai
jpai at openjdk.org
Tue Sep 2 09:36:46 UTC 2025
On Fri, 29 Aug 2025 22:48:06 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 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
> The virtual thread test that is failing in this PR's GitHub actions job is `java/lang/Thread/virtual/stress/GetStackTraceALotWhenBlocking#id0`
> It looks like it's taking long to complete and that's causing the test timeout. I recollect that this test failure was addressed some time back, so this appears to be a new occurrence. In any case, this failure doesn't look related to the changes in this PR because I see some other PRs having failed with this same issue. I'll check and file an issue later today/tomorrow (unless anyone else gets to it first).
I've filed https://bugs.openjdk.org/browse/JDK-8366669 to track this failure.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26863#issuecomment-3244555487
More information about the hotspot-dev
mailing list