Integrated: 8351334: [ubsan] memoryReserver.cpp:552:60: runtime error: applying non-zero offset 1073741824 to null pointer

Afshin Zafari azafari at openjdk.org
Fri Nov 28 13:06:04 UTC 2025


On Wed, 27 Aug 2025 11:24:07 GMT, Afshin Zafari <azafari at openjdk.org> wrote:

> The issue happens when the HeapMinBaseAddress option gets 0 as input value. Since this option is used as an address, then using 0 in pointer arithmetics is UB.
> The fix is using `unitptr_t` instead of `address`/`char*`, etc.  In doing that, it is found that an overflow check does not work in all cases due to checking more conditions. That overflow check is changed too. We also need to check overflow after aligning addresses and sizes of memory regions in this context. Assertions are added to check these cases.
> 
> Tests:
> linux-x64 tier1

This pull request has now been integrated.

Changeset: e071afbf
Author:    Afshin Zafari <azafari at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/e071afbfe4507b6b3a306f90bb645465fdab0070
Stats:     32 lines in 3 files changed: 4 ins; 1 del; 27 mod

8351334: [ubsan] memoryReserver.cpp:552:60: runtime error: applying non-zero offset 1073741824 to null pointer

Reviewed-by: aboldtch, dholmes, jsjolen

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

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


More information about the hotspot-dev mailing list