RFR: 8361487: [ubsan] test_committed_virtualmemory.cpp check_covered_pages shows overflow [v4]
Paul Hübner
phubner at openjdk.org
Fri Nov 14 08:31:09 UTC 2025
On Thu, 13 Nov 2025 15:31:52 GMT, Afshin Zafari <azafari at openjdk.org> wrote:
>> In the test, page-numbers to be checked are passed to a checker function in which they will be changed to `-1` if they are as expected.
>> Use of these `-1` values for page-numbers in consequent checks result in overflow in pointer arithmetic of `base + (-1) * page_size` which is certainly less than `base`.
>>
>> The fix is to skip cases where page-number under checking is `-1`.
>> Tested under UBSAN build.
>
> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
>
> style and not constexpr
test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp line 97:
> 95: continue;
> 96: }
> 97: address page_addr = base + page_num[index] * page_sz;
What if we `assert(page_num[index] >= 0)` at this point if we know that negative numbers may cause overflows?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28151#discussion_r2526444037
More information about the hotspot-runtime-dev
mailing list