Integrated: 8369506: Bytecode rewriting causes Java heap corruption on AArch64

Justin King jcking at openjdk.org
Thu Oct 16 20:01:50 UTC 2025


On Fri, 10 Oct 2025 16:21:17 GMT, Justin King <jcking at openjdk.org> wrote:

> Fix JDK-8369506 by adding `STLR` when updating the bytecode. Additionally I added a quick debug only check which verifies the field offset we get from `ResolvedFieldEntry` in `TemplateTable::fast_*` will not clobber the header or Klass pointer. The added `STLR`, a long with the already existing `DMB ISHLD` in `InterpreterMacroAssembler::load_field_entry`, guarantees that the fully filled out `ResolvedFieldEntry` is observable if the patched bytecode is observable. We do not need to add `LDAR` for bytecode loading or `LDAR` in `TemplateTable::fast_*` for that reason. If another observer happens to observe a `0` field offset, its guaranteed then that they will also observe the non-patched bytecode which will ultimately end up doing the resolution again, which is okay.

This pull request has now been integrated.

Changeset: 18fd0477
Author:    Justin King <jcking at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/18fd04770294e27011bd576b5ea5fe43fa03e5e3
Stats:     25 lines in 3 files changed: 22 ins; 0 del; 3 mod

8369506: Bytecode rewriting causes Java heap corruption on AArch64

Co-authored-by: Man Cao <manc at openjdk.org>
Co-authored-by: Chuck Rasbold <rasbold at openjdk.org>
Reviewed-by: shade, aph, manc

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

PR: https://git.openjdk.org/jdk/pull/27748


More information about the hotspot-compiler-dev mailing list