RFR: 8279969: NULL return from map_bitmap_region() needs to be checked

Calvin Cheung ccheung at openjdk.java.net
Wed Feb 16 18:09:10 UTC 2022


On Wed, 16 Feb 2022 05:39:58 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> 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.

LGTM

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

Marked as reviewed by ccheung (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/7487


More information about the hotspot-runtime-dev mailing list