[jdk21u-dev] RFR: 8369506: Bytecode rewriting causes Java heap corruption on AArch64 [v2]

Martin Doerr mdoerr at openjdk.org
Mon Oct 27 15:58:15 UTC 2025


On Fri, 17 Oct 2025 19:09:22 GMT, Justin King <jcking at openjdk.org> wrote:

>> src/hotspot/cpu/aarch64/templateTable_aarch64.cpp line 3152:
>> 
>>> 3150:   __ ldr(r0, aaddress(0));
>>> 3151:   // access constant pool cache
>>> 3152:   __ get_cache_and_index_at_bcp(r2, r3, 2);
>> 
>> I spent a little while looking at the other uses of `get_cache_and_index_at_bcp` and I couldn't find anything obviously wrong, but that might not mean we're OK.
>
> Ran this change with our reproducer, and no observable failures. I also made `verify_field_offset` be present in the optimized build to be sure. So I think we are good. This is as approximate of a fix we can get I think.

Correct, `fast_accessfield`, `fast_storefield`, `fast_xaccess` and `fast_invokevfinal` need the memory barrier. `fast_invokevfinal` is not implemented on most platforms and `fast_accessfield` and `fast_storefield` already have the barrier on aarch64.

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

PR Review Comment: https://git.openjdk.org/jdk21u-dev/pull/2355#discussion_r2466212275


More information about the jdk-updates-dev mailing list