RFR: 8360941: [ubsan] MemRegion::end() shows runtime error: applying non-zero offset 8388608 to null pointer [v3]

Kim Barrett kbarrett at openjdk.org
Thu Jul 17 14:38:48 UTC 2025


On Thu, 17 Jul 2025 07:22:18 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> Taking 'some other address' than nullptr / 0 as suggested just fails (I worked yesterday with opt build where no failure was seen). But fastdebug leads to this assert , any ideas ? Or suggestions for a 'better' address (!= 0) that works ?

It needs to be at least page-aligned.  I'm not finding any other alignment requirement just now, but there might
be a minimum region alignment that is more restrictive than page-aligned that I'm forgetting and haven't found.

So `align_up(addr, os::vm_page_size())` may work.

The other likely alignment possibility is `G1HeapRegion::GrainWord * BytesPerWord`.

I still think allocating the space might be safer.  So os::malloc space for one more region than the test calls for, and
align the result up to GrainWord alignment.

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

PR Comment: https://git.openjdk.org/jdk/pull/26216#issuecomment-3083940896


More information about the hotspot-runtime-dev mailing list