RFR: 8369506: Bytecode rewriting causes Java heap corruption on AArch64 [v3]
    Justin King 
    jcking at openjdk.org
       
    Wed Oct 15 14:54:36 UTC 2025
    
    
  
> 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.
Justin King 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 'openjdk:master' into aarch64-rewrite-bytecodes
 - Suggestions from shipilev
   
   Signed-off-by: Justin King <jcking at google.com>
 - Remove trailing whitespace added by Github
   
   Signed-off-by: Justin King <jcking at google.com>
 - Update src/hotspot/cpu/aarch64/templateTable_aarch64.cpp
   
   Co-authored-by: Andrew Haley <aph-open at littlepinkcloud.com>
 - JDK-8369506: Bytecode rewriting causes Java heap corruption on AArch64
   
   Signed-off-by: Justin King <jcking at google.com>
-------------
Changes:
  - all: https://git.openjdk.org/jdk/pull/27748/files
  - new: https://git.openjdk.org/jdk/pull/27748/files/3575e7ba..95d4831f
Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=27748&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27748&range=01-02
  Stats: 10780 lines in 273 files changed: 5974 ins; 4231 del; 575 mod
  Patch: https://git.openjdk.org/jdk/pull/27748.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27748/head:pull/27748
PR: https://git.openjdk.org/jdk/pull/27748
    
    
More information about the hotspot-compiler-dev
mailing list