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

Dean Long dlong at openjdk.org
Thu Mar 20 02:22:07 UTC 2025


On Wed, 19 Mar 2025 17:52:46 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> 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.
>
> Vladimir Kozlov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update field default setting

src/hotspot/share/code/codeBlob.cpp line 187:

> 185:   if (_mutable_data != blob_end()) {
> 186:     os::free(_mutable_data);
> 187:     _mutable_data = blob_end(); // Valid not null address

Do we still need this to be a valid address after purge(), or can we set it to nullptr here?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24102#discussion_r2004678576


More information about the hotspot-compiler-dev mailing list