RFR: 8330027: Identity hashes of archived objects must be based on a reproducible random seed [v6]

Calvin Cheung ccheung at openjdk.org
Thu May 9 20:49:15 UTC 2024


On Tue, 7 May 2024 04:58:20 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> CDS archive contains archived objects with identity hashes.
>> 
>> These hashes are deliberately preserved or even generated during dumping. They are generated based on a seed that is initialized randomly on a per-thread basis. These generations precede CDS dump initialization, so they are not affected by the init_random call there, nor would they be affected by [JDK-8323900](https://bugs.openjdk.org/browse/JDK-8323900).
>> 
>> A random seed will not work for dumping archives since it prevents reproducible archive generation. Therefore, when dumping, these seeds must be initiated in a reproducible way.
>> 
>> --- Update
>> 
>> After discussions with Ioi, and several redos, we settled on:
>> 
>> - make sure CDS dump only ever calls ihash generation from one thread. Means, we disable the explicit hash generation we had been doing before, since that one was called from the VM thread, not from the single java thread
>> - Start out with a constant seed for all threads. This is fine and does not cause collisions between threads, since - see above - we only call ihash generation from a single threads.
>> - We also assert that we only use a single thread
>
> Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
> 
>  - remove changes from synchronizer
>  - remove assert
>  - use is_dumping_static_archive
>  - Merge branch 'master' into JDK-JDK-8330027-cds-ihash-reproducability
>  - JDK-8330027-cds-ihash-reproducability.patch

The latest version looks good. Thanks!

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

Marked as reviewed by ccheung (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18735#pullrequestreview-2048811913


More information about the hotspot-runtime-dev mailing list