Integrated: 8330027: Identity hashes of archived objects must be based on a reproducible random seed

Thomas Stuefe stuefe at openjdk.org
Fri May 10 09:51:14 UTC 2024


On Thu, 11 Apr 2024 09:24:16 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
> 
> --- Update Update
> 
> The final version I plan to push does not have above mentioned assert, since it turned out to be too tricky and complex to get right, not worth the trouble.

This pull request has now been integrated.

Changeset: 9f43ce5a
Author:    Thomas Stuefe <stuefe at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/9f43ce5a725b212cec0f3cd17491c4bada953676
Stats:     15 lines in 3 files changed: 4 ins; 8 del; 3 mod

8330027: Identity hashes of archived objects must be based on a reproducible random seed

Reviewed-by: ccheung, iklam

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

PR: https://git.openjdk.org/jdk/pull/18735


More information about the hotspot-runtime-dev mailing list