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

Afshin Zafari azafari at openjdk.org
Thu Oct 30 12:06:00 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 incrementally with one additional commit since the last revision:

  fix arguments.cpp for HeapMinBaseAddress type.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/26955/files
  - new: https://git.openjdk.org/jdk/pull/26955/files/5fc2b8a9..0aae9a42

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=26955&range=10
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26955&range=09-10

  Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 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