RFR: 8346157: [Ubsan]: runtime error: pointer index expression with base 0x000000001000 overflowed to 0xfffffffffffffff0 [v5]
Thomas Stuefe
stuefe at openjdk.org
Tue Jan 14 14:33:47 UTC 2025
On Mon, 6 Jan 2025 09:07:36 GMT, Amit Kumar <amitkumar at openjdk.org> wrote:
>> Fixes ubsan warning in mallocTracker.cpp
>
> Amit Kumar has updated the pull request incrementally with one additional commit since the last revision:
>
> new year
ok
src/hotspot/share/nmt/mallocTracker.cpp line 247:
> 245: const size_t smallest_possible_alignment = sizeof(void*);
> 246: uintptr_t here = (uintptr_t)align_down(addr, smallest_possible_alignment);
> 247: uintptr_t end = MAX2(smallest_possible_alignment, here - (0x1000 + sizeof(MallocHeader))); // stop searching after 4k
This works since we know that 0x1000 + sizeof(MallocHeader) < 16MB, which is where we bail out above. Otherwise, for here values < 1K+16, we would underflow and end up with a large `end` value.
-------------
Marked as reviewed by stuefe (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/22885#pullrequestreview-2549892154
PR Review Comment: https://git.openjdk.org/jdk/pull/22885#discussion_r1914923531
More information about the hotspot-runtime-dev
mailing list