RFR: 8346157: [Ubsan]: runtime error: pointer index expression with base 0x000000001000 overflowed to 0xfffffffffffffff0 [v3]
Thomas Stuefe
stuefe at openjdk.org
Mon Jan 6 08:34:37 UTC 2025
On Mon, 6 Jan 2025 06:35:17 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:
>
> cap 0 at end and early bailout
src/hotspot/share/nmt/mallocTracker.cpp line 234:
> 232: address addr = (address)p;
> 233:
> 234: if (p2u(addr) < MAX2(os::vm_min_address(), (size_t)16 * 0x100000 /* 16 MB */)) {
Use "M" instead of 0x100000?
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)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22885#discussion_r1903823142
PR Review Comment: https://git.openjdk.org/jdk/pull/22885#discussion_r1903830487
More information about the hotspot-runtime-dev
mailing list