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

David Holmes dholmes at openjdk.org
Thu Nov 20 05:13:52 UTC 2025


On Wed, 19 Nov 2025 13:45:11 GMT, Afshin Zafari <azafari at openjdk.org> wrote:

>> src/hotspot/share/memory/memoryReserver.cpp line 586:
>> 
>>> 584:                                           lowest_start, highest_start);
>>> 585:       reserved = try_reserve_range((char*)highest_start, (char*)lowest_start, attach_point_alignment,
>>> 586:                                    (char*)aligned_heap_base_min_address, (char*)UnscaledOopHeapMax, size, alignment, page_size);
>> 
>> Not obvious to me this actually improves anything - what is it fixing?
>
> First, the pointer arithmetics are done on `uintptr_t` types to avoid UB.
> Second, it is checked that `lowest` and `highest` are still valid after becoming larger or smaller, respectively.

I think it would be more accurate to say we are avoiding actual pointer arithmetic here.

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

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


More information about the hotspot-gc-dev mailing list