RFR: 8367485: os::physical_memory is broken in 32-bit JVMs when running on 64-bit OSes [v10]
Anton Artemov
duke at openjdk.org
Thu Sep 25 08:47:44 UTC 2025
> 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 `uint64_t`.
>
> Tested in tiers 1 - 5.
Anton Artemov has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 12 additional commits since the last revision:
- Merge remote-tracking branch 'origin/master' into JDK-8367485-os-physical-memory-broken-32bit-on-64bit
- 8367485: Alignment of vars in os_windows.cpp
- 8367485: Indentation in GCInitLogger::print_memory()
- 8367485: Changed output format in GCInitLogger::print_memory()
- 8367485: Addressed reviewers' comments.
- 8367485: Indentation fix.
- 8367485: Addressed reviewer's comments.
- 8367485: Addressed reviewer's comments
- 8367485: Addressed reviewer's comments.
- 8367485: Refactoring with uint64_t
- ... and 2 more: https://git.openjdk.org/jdk/compare/5cd3c0c5...b39817de
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/27335/files
- new: https://git.openjdk.org/jdk/pull/27335/files/791faaeb..b39817de
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=27335&range=09
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=27335&range=08-09
Stats: 141494 lines in 1287 files changed: 121533 ins; 11590 del; 8371 mod
Patch: https://git.openjdk.org/jdk/pull/27335.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27335/head:pull/27335
PR: https://git.openjdk.org/jdk/pull/27335
More information about the hotspot-runtime-dev
mailing list