RFR: 8346866: [ASAN] memoryReserver.cpp reported applying non-zero offset to non-null pointer produced null pointer [v5]

Stefan Karlsson stefank at openjdk.org
Tue Jan 7 11:36:48 UTC 2025


On Tue, 7 Jan 2025 08:05:19 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> SendaoYan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Replace "(size_t) highest_start" instead as 1
>
> src/hotspot/share/memory/memoryReserver.cpp line 440:
> 
>> 438:   // Try reserve memory from top to bottom.
>> 439:   for (size_t offset = attach_range;
>> 440:        offset <= attach_range; // Avoid wrap around.
> 
> This comment is very misleading and confusing.  This code is *relying* on underflow and the resulting
> wraparound of offset to end the iteration.  That's to prevent potential pointer arithmetic underflow later.

What about `Check for wrap around?` is that good enough?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22897#discussion_r1905326098


More information about the hotspot-runtime-dev mailing list