RFR: 8346157: [Ubsan]: runtime error: pointer index expression with base 0x000000001000 overflowed to 0xfffffffffffffff0 [v3]

Amit Kumar amitkumar at openjdk.org
Mon Jan 6 08:52:13 UTC 2025


On Mon, 6 Jan 2025 08:30:48 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Amit Kumar has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   cap 0 at end and early bailout
>
> src/hotspot/share/nmt/mallocTracker.cpp line 252:
> 
>> 250:     uintptr_t end = (here > (0x1000 + sizeof(MallocHeader)))
>> 251:                       ? here - (0x1000 + sizeof(MallocHeader)) // stop searching after 4k
>> 252:                       : 0;
> 
> `here` will always be > 0, overflowed or not. You need to check the decrement amount before decrementing. With "capping end" I meant setting it at or above the decrement amount, e.g.
> 
> end = MAX2(smallest_possible_alignment, here - (0x1000 + sizeof(MallocHeader))
> 
> (sorry if I wasn't clear)

oh, I saw 0 and thought that I need to consider that as minimum value possible. Sorry. I have updated code now.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22885#discussion_r1903859169


More information about the hotspot-runtime-dev mailing list