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

David Holmes dholmes at openjdk.org
Tue Oct 28 10:34:06 UTC 2025


On Tue, 28 Oct 2025 09:32:04 GMT, Afshin Zafari <azafari at openjdk.org> wrote:

>> src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp line 288:
>> 
>>> 286:   // If an overflow happened in Arguments::set_heap_size(), MaxHeapSize will have too large a value.
>>> 287:   // Check for this by ensuring that MaxHeapSize plus the requested min base address still fit within max_uintx.
>>> 288:   if (std::numeric_limits<size_t>::max() - value < MaxHeapSize) { // overflow
>> 
>> Sorry but I still don't see how this new check is in practice any different to the existing (albeit conditional) `(value > (max_uintx - MaxHeapSize))`?
>
> No difference other than not depends on the other conditions. The existing condition needs two more conjunctions to be true.
> Without this change here, when we run jvm with the options as shown in this [comment](https://github.com/openjdk/jdk/pull/26955#issuecomment-3241790796 
> ) (to make the HeapMinBaseAddress overflow) it crashes with an assertion.

If they are the same then we no longer need the conditional one surely. ??

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26955#discussion_r2468950628


More information about the hotspot-gc-dev mailing list