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 21:52:08 UTC 2025


On Tue, 18 Mar 2025 20:34:06 GMT, Boris Ulasevich <bulasevich at openjdk.org> wrote:

> This change seems to be a workaround. Setting pointers to nullptr is a standard practice when no meaningful value is available. The RelocationHandler performs pointer arithmetic on the address without checking its validity. Shouldn't the issue be addressed in RelocationHandler instead?

Agree. But we can't simply bailout from `RelocIterator()` constructor because we advertise next API:

//   RelocIterator iter(nm);
//   while (iter.next()) {


Also `RelocIterator::next()` does pointer arithmetic to determine when to stop iterate. So we need to set `_current = _end - 1` if we don't want to modify and complicate it. So we need to set these fields to some valid addresses inside `RelocIterator()` anyway. So why not do that by setting valid address to `_mutable_data` and done?

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

PR Comment: https://git.openjdk.org/jdk/pull/24102#issuecomment-2734820733


More information about the hotspot-compiler-dev mailing list