RFR: 8357155: [asan] ZGC does not work (x86_64 and ppc64) [v2]

Axel Boldt-Christmas aboldtch at openjdk.org
Tue Jun 3 06:00:57 UTC 2025


On Mon, 2 Jun 2025 10:38:18 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

>> src/hotspot/cpu/ppc/gc/z/zAddress_ppc.cpp line 95:
>> 
>>> 93:   const size_t max_address_offset_bits = valid_max_address_offset_bits - 3;
>>> 94: #ifdef ADDRESS_SANITIZER
>>> 95:   return max_address_offset_bits;
>> 
>> I think this actually has to be 
>> ```c++
>>   return MIN2(valid_max_address_offset_bits, 44);
>> 
>> 
>> Because the way we probe we may otherwise return 45 here. Which could result in more than 44 bits in a ZOffset which our internal data structures cannot handle. Hopefully this still works for ASAN on PPC. (The `-3` is a left over from non-generational ZGC). Aarch64 could do the same, but it does not have this issue as it starts its probing at bit 46, not bit 47.
>> 
>> _Side note: This makes me realise that there probably is a bug here on PPC and RISCV if running on a NUMA machine with more than 8 TB heap. As after ZGlobalsPointers::min_address_offset_request() was introduced we can return 45 from this function._
>
> @xmas92: Thanks for looking into this! Should we set `DEFAULT_MAX_ADDRESS_BIT = 44` and use the constant?
> Or maybe file a separate issue for fixing that on aarch64, PPC64 and riscv (and also remove the -3 from the `max_address_offset_bits computation`)?

[JDK-8358310](https://bugs.openjdk.org/browse/JDK-8358310) / #25578 is open right now as a quick fix for returning a too large value without cleaning up the implementation. (As a fix for 25)

This was noted back in https://github.com/openjdk/jdk/pull/18941#issuecomment-2079316745 ([JDK-8330275](https://bugs.openjdk.org/browse/JDK-8330275)), but I think fixing this fell through the cracks. 

I currently have a rewrite in the works which overhauls the heap base selection, which I plan to get into 26. In that patch all the non-generational legacy is removed. So we no longer probe based on the assumption that we need 3 extra high order bits.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25549#discussion_r2122787593


More information about the hotspot-dev mailing list