RFR: 8279969: NULL return from map_bitmap_region() needs to be checked
Ioi Lam
iklam at openjdk.java.net
Wed Feb 16 05:51:27 UTC 2022
The CDS-related function `FileMapInfo::map_bitmap_region()` could return `NULL` if CRC check fails, or if we run out of memory. There are two call sites of map_bitmap_region() that did not check for `NULL` , and the VM subsequently would crash. However, there was a bug in the test case that ignored such crashes, and we only found out by chance because jtreg timed out while trying to copy the core file.
The fix is to add the missing NULL checks. Also, since `FileMapInfo::patch_heap_embedded_pointers()` cannot handle the mapping failure, I moved the mapping to an earlier stage (`FileMapInfo::map_heap_regions_impl()`) where the error can be handled.
I also added a VM crash check in the test case.
Note: there's a single bitmap region in the CDS archive. It will be mapped on the first call to `FileMapInfo::map_bitmap_region()`, and will remain mapped until after the loading of the CDS archive is completed.
Passed tiers 1-4.
-------------
Commit messages:
- 8279969: NULL check missing in HeapShared::load_regions()
Changes: https://git.openjdk.java.net/jdk/pull/7487/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7487&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8279969
Stats: 24 lines in 3 files changed: 21 ins; 2 del; 1 mod
Patch: https://git.openjdk.java.net/jdk/pull/7487.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/7487/head:pull/7487
PR: https://git.openjdk.java.net/jdk/pull/7487
More information about the hotspot-runtime-dev
mailing list