Integrated: 8367485: os::physical_memory is broken in 32-bit JVMs when running on 64-bit OSes

Anton Artemov duke at openjdk.org
Tue Sep 30 05:13:04 UTC 2025


On Wed, 17 Sep 2025 08:42:11 GMT, Anton Artemov <duke at openjdk.org> wrote:

> Hi, please consider the following changes:
> 
> In this PR we address the overflow issue in `os::physical_memory()` on Linux, which can occur when running a 32-bit JVM on a 64-bit machine, introduced by https://bugs.openjdk.org/browse/JDK-8357086. The problem is that the product of _SC_PHYS_PAGES and _SC_PAGESIZE can overflow according to the documentation. 
> 
> The issue is addressed by changing the output type of all related functions to `physical_memory_size_type`, which is an alias to `uint64_t`.
> 
> Tested in tiers 1 - 5.

This pull request has now been integrated.

Changeset: 2746c1a5
Author:    Anton Artemov <anton.artemov at oracle.com>
Committer: Thomas Stuefe <stuefe at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/2746c1a555891564963299182b3b0293eaefc901
Stats:     152 lines in 20 files changed: 7 ins; 0 del; 145 mod

8367485: os::physical_memory is broken in 32-bit JVMs when running on 64-bit OSes

Reviewed-by: jsikstro, sgehwolf, stefank, stuefe, aph

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

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


More information about the hotspot-dev mailing list