[crac] RFR: Reseed secure random on checkpoint restore [v4]
Alexey Bakhtin
abakhtin at openjdk.java.net
Thu Jan 27 09:00:46 UTC 2022
On Fri, 21 Jan 2022 09:21:19 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:
>> Alexey Bakhtin has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update object lock during checkpoint/restore
>
> src/java.base/share/classes/jdk/crac/CheckpointException.java line 32:
>
>> 30: * Suppresses exceptions thrown during checkpoint notification.
>> 31: */
>> 32: public class CheckpointException extends RuntimeException {
>
> This is a severe change and it makes CheckpointException unchecked. We want users to provide explicit handling of CheckpointException, please revert.
This is an internal jdk.crac Exception that is not visible to users. It is used for JVM resources only and handled explicitly in jdk.crac.Core. This exception will be thrown from existing JDK classes, so it was changed to unchecked to make it possible to throw exception without changing signature of the existing public API (e.g. https://github.com/openjdk/crac/blob/3ade9580452ab2db193e9c2c1b458a2ff17a8597/src/java.base/share/classes/sun/security/provider/SecureRandom.java#L296 or https://github.com/openjdk/crac/blob/dd46160142a3ec490a400f56738d0251d128494a/src/java.base/unix/classes/sun/security/provider/NativePRNG.java#L556 or https://github.com/openjdk/crac/blob/dd46160142a3ec490a400f56738d0251d128494a/src/java.base/unix/classes/sun/security/provider/NativePRNG.java#L490)
Also, it was approved already in the https://github.com/openjdk/crac/pull/9
> src/java.base/share/classes/sun/security/provider/SecureRandom.java line 169:
>
>> 167: objLock.lock();
>> 168: try {
>> 169: // verify if objLock is already acquired in beforeCheckpoint
>
> Probably "check if objLock has not been already acquired in beforeCheckpoint" ?
Thank you, changed.
> src/java.base/share/classes/sun/security/provider/SecureRandom.java line 216:
>
>> 214: }
>> 215:
>> 216: private void invalidate() {
>
> I would like to have "assert objLock.isHeldByCurrentThread()" or another "objLock.lock()" here. This method is called from SeederHolder.beforeCheckpoint. There is no race here only if that executes after seeder's beforeCheckpoint and in the same thread. While it is so, additional safety would not harm.
Thank you. Added
-------------
PR: https://git.openjdk.java.net/crac/pull/7
More information about the crac-dev
mailing list