RFR: 8352112: [ubsan] hotspot/share/code/relocInfo.cpp:130:37: runtime error: applying non-zero offset 18446744073709551614 to null pointer

Vladimir Kozlov kvn at openjdk.org
Tue Mar 18 18:09:35 UTC 2025


Before [JDK-8343789](https://bugs.openjdk.org/browse/JDK-8343789) `relocation_begin()` was never null even when there was no relocations - it pointed to the beginning of constant or code section in such case. It was used by relocation code to simplify code and avoid null checks.
With that fix `relocation_begin()` points to address in `CodeBlob::_mutable_data` field which could be `nullptr` if there is no relocation and metadata.

There easy fix is to avoid `nullptr` in `CodeBlob::_mutable_data`. We could do that similar to what we do for `nmethod::_immutable_data`: [nmethod.cpp#L1514](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/code/nmethod.cpp#L1514).

Tested tier1-4, stress, xcomp. Verified with failed tests listed in bug report.

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

Commit messages:
 - [ubsan] hotspot/share/code/relocInfo.cpp:130:37: runtime error: applying non-zero offset 18446744073709551614 to null pointer

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

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


More information about the hotspot-compiler-dev mailing list