RFR: 8341020: Metaspace::contains crashes when Metaspace is not fully initialized

Aleksey Shipilev shade at openjdk.org
Thu Sep 26 11:51:07 UTC 2024


When debugging CDS, I asked for `os::print_location` when Metaspace was not completely initialized. I suspect the same might happen if error handler fires very early in startup sequence.

`os::print_location` got to `Metaspace::contains`, which ended up in `Metaspace::is_in_nonclass_metaspace`, which crashed, since `VirtualSpaceList` was null. Other checks in `Metaspace::contains` seem to only check the address against the boundaries, and are not affected.

Additional testing:
 - [x] The same debugging session did not crash the VM after the patch

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

Commit messages:
 - Fix

Changes: https://git.openjdk.org/jdk/pull/21206/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21206&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8341020
  Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/21206.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21206/head:pull/21206

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


More information about the hotspot-runtime-dev mailing list