RFR: 8360942: [ubsan] aotCache tests trigger runtime error: applying non-zero offset 16 to null pointer in CodeBlob::relocation_end()

Vladimir Kozlov kvn at openjdk.org
Mon Jul 7 23:52:48 UTC 2025


`CodeBlob::relocation_size()` is calculated as `(_mutable_data + _relocation_size - _mutable_data)`. `CodeBlob::relocation_size()` is called during AOT code loading before we allocate space for mutable data (the size is used to find how big space should be allocated). The expression at that point is `(NULL + _relocation_size - NULL)` which returns correct result. But we should just return `_relocation_size` which is recorded anyway in AOT data.

Added missing  `_mutable_data = blob_end();` initialization when we restore AOT code blob.

Fixed embarrassing typo in asserts.

Tested: tier1-6,8,10,xcomp,stress

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

Commit messages:
 - 8360942: [ubsan] aotCache tests trigger runtime error: applying non-zero offset 16 to null pointer in CodeBlob::relocation_end()

Changes: https://git.openjdk.org/jdk/pull/26175/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26175&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8360942
  Stats: 7 lines in 2 files changed: 4 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/26175.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26175/head:pull/26175

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


More information about the hotspot-compiler-dev mailing list