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

Ioi Lam iklam at openjdk.java.net
Thu Feb 17 06:45:11 UTC 2022


On Wed, 16 Feb 2022 18:05:36 GMT, Calvin Cheung <ccheung 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

Thanks @calvinccheung and @coleenp for the review.

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

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


More information about the hotspot-runtime-dev mailing list