RFR: 8302777: CDS should not relocate heap if mapping fails

Ioi Lam iklam at openjdk.org
Fri Feb 17 17:38:20 UTC 2023


Please review this trivial fix: if the CDS archive heap is not available due to CRC errors, we shouldn't try to relocate its contents.

The bug was introduced in [JDK-8296158](https://bugs.openjdk.org/browse/JDK-8296158). Previously, if the CRC check fails, `MetaspaceShared::relocation_delta()` would be zero, so [`ArchiveHeapLoader::patch_native_pointers()`](https://github.com/openjdk/jdk/blob/a917fb3fcf0fe1a4c4de86c08ae4041462848b82/src/hotspot/share/cds/archiveHeapLoader.cpp#L535-L538) would return immediately. However, since [JDK-8296158](https://bugs.openjdk.org/browse/JDK-8296158), `MetaspaceShared::relocation_delta()` might be non-zero after CRC check has failed.

So the correct thing to do is to make sure the archive heap is available before doing anything with it.

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

Commit messages:
 - 8302777: CDS should not relocate heap if mapping fails

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

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


More information about the hotspot-runtime-dev mailing list