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

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


On Fri, 17 Feb 2023 17:15:04 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> 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, `FileMapRegion::mapped_base()` will be NULL for the heap regions, and thus we will skip the relocation in [`ArchiveHeapLoader::patch_native_pointers()`](https://github.com/openjdk/jdk/blob/a917fb3fcf0fe1a4c4de86c08ae4041462848b82/src/hotspot/share/cds/archiveHeapLoader.cpp#L535-L550).
> 
> However, since [JDK-8296158](https://bugs.openjdk.org/browse/JDK-8296158), `FileMapRegion::mapped_base()`  might be non-zero after CRC check has failed.
> 
> A proper fix is in [JDK-8302790](https://bugs.openjdk.org/browse/JDK-8302790) -- we should clear `FileMapRegion::mapped_base()`  when mapping fails.
> 
> However, that's a more involved fix and requires more testing. 
> 
> In the meantime, this PR will fix this crash. Also, it's a good idea to make sure the archive heap is available before doing anything with it.

This pull request has now been integrated.

Changeset: a263f283
Author:    Ioi Lam <iklam at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/a263f28368951e2352ee983d318d83c92ddf8e4d
Stats:     3 lines in 1 file changed: 2 ins; 0 del; 1 mod

8302777: CDS should not relocate heap if mapping fails

Reviewed-by: ccheung

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

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


More information about the hotspot-runtime-dev mailing list