RFR: 8354428: [ubsan] g1BiasedArray.hpp: pointer overflow in address calculation
Albert Mingkun Yang
ayang at openjdk.org
Tue May 27 08:24:51 UTC 2025
On Mon, 26 May 2025 10:15:01 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:
> Hi all,
>
> please review this fix for an ubsan error related to pointer under- or overflows when using the biased array helper.
>
> The fix is, instead of using direct address calculations that can cause these errors, use `uintptr_t` where the overflow behavior is defined in C++. Only convert to pointer at the actual access.
>
> Testing: gha, tier1
src/hotspot/share/gc/g1/vmStructs_g1.hpp line 51:
> 49: nonstatic_field(G1HeapRegionTable, _base, address) \
> 50: nonstatic_field(G1HeapRegionTable, _length, size_t) \
> 51: nonstatic_field(G1HeapRegionTable, _biased_base, size_t) \
Why `size_t` for `uintptr_t _biased_base;`?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25447#discussion_r2108557618
More information about the hotspot-gc-dev
mailing list