RFR: 8351334: [ubsan] memoryReserver.cpp:552:60: runtime error: applying non-zero offset 1073741824 to null pointer [v10]
Afshin Zafari
azafari at openjdk.org
Thu Oct 30 11:51:02 UTC 2025
> 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
Afshin Zafari has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 10 additional commits since the last revision:
- Merge remote-tracking branch 'origin/master' into _8351334_ubsan_nullptr_add
- removed redundant check of overflow.
- subtraction for checking overflow
- fixed MAX2 template parameter
- fixes.
- uintptr_t -> uint64_t
- fixes
- lowest can be equal to highest
- first round of fixes
- 8351334: [ubsan] memoryReserver.cpp:552:60: runtime error: applying non-zero offset 1073741824 to null pointer
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/26955/files
- new: https://git.openjdk.org/jdk/pull/26955/files/b21cb6ca..5fc2b8a9
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=26955&range=09
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=26955&range=08-09
Stats: 564568 lines in 7813 files changed: 376779 ins; 131311 del; 56478 mod
Patch: https://git.openjdk.org/jdk/pull/26955.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/26955/head:pull/26955
PR: https://git.openjdk.org/jdk/pull/26955
More information about the hotspot-gc-dev
mailing list