RFR: 8273152: Store base archive path in CDSFileMapHeaderBase [v2]

Yumin Qi minqi at openjdk.java.net
Wed Sep 22 23:28:00 UTC 2021


On Wed, 22 Sep 2021 19:42:08 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Yumin Qi has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Fixed typo
>>  - Moved _header_size from FileMapHeader to CDSFileMapHeaderBase and added tests
>
> src/hotspot/share/cds/filemap.cpp line 1159:
> 
>> 1157:     }
>> 1158:   }
>> 1159: 
> 
> The check from 1144-1158 should be done inside `FileMapInfo::check_archive()`. This function  (`FileMapInfo::init_from_file`) is called *after* we have successfully loaded the header of an archive created by the current JDK. However, -- with JDK-8261455, we will need to read the headers of an archive created by a different JDK version, so we need to do the check at the very beginning, when we are examining the magic value, etc.
> 
> Also, the base archive's name should be considered as part of the header, so `header()->header_size()` should include the size of the base archive's name as well. Otherwise, we won't be able to read the entire header, including the base archive name, of an archive created by a different JDK version.
> 
> The check for header()->base_archive_path_offset() needs to be expanded:
> - it must be smaller than header()->header_size()
> - it must point to a valid 0-terminated string -- the string cannot run past the end of the header.

The base archive name size should be included in CDSFileMapHeaderBase, not the base archive name itself. If the name as a part of header size, it will complicate the code. We want to read the base archive name from the archive file, this should be done by only reading CDSFileMapHeaderBase from the archive file to get enough information.

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

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


More information about the hotspot-runtime-dev mailing list