Integrated: 8367317: ZGC: ZVirtualMemoryReserver::force_reserve_discontiguous arithmetic underflow

Axel Boldt-Christmas aboldtch at openjdk.org
Mon Nov 10 05:57:14 UTC 2025


On Thu, 11 Sep 2025 05:12:42 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

> ZVirtualMemoryReserver::force_reserve_discontiguous is a debug only API used to simulate and test a discontinuous heap. The loop variable `end` is incorrectly checked which may lead to an underflow.
> 
> In our normal testing we never observe this as the address space is always available. We observed this issue when running a hardened build (like ASAN) which had already mmapped the address space we tried to reserve.
> 
> Rather than always jump two reserve sizes in its search, it searches every reserve size, moving an extra reserve size every time it succeeds with a reservation (so that there always is a gap).  Searching in reserve sized steps is not really a requirement here, we could have just used a granule sized step.

This pull request has now been integrated.

Changeset: a8b35bf5
Author:    Axel Boldt-Christmas <aboldtch at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/a8b35bf5a60c26e8975a468d4ebe6aac557e4d85
Stats:     2 lines in 1 file changed: 1 ins; 0 del; 1 mod

8367317: ZGC: ZVirtualMemoryReserver::force_reserve_discontiguous arithmetic underflow

Reviewed-by: jsikstro, eosterlund

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

PR: https://git.openjdk.org/jdk/pull/27207


More information about the hotspot-gc-dev mailing list