RFR: 8325247: Memory leak in SessionKeyRef class def when using PKCS11 security provider [v2]

Daniel Jeliński djelinski at openjdk.org
Mon Feb 19 10:28:57 UTC 2024


On Sat, 17 Feb 2024 19:19:48 GMT, Stuart Marks <smarks at openjdk.org> wrote:

>> Daniel Jeliński has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   put reachabilityFence in a finally clause
>
> src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java line 1537:
> 
>> 1535:                     this.ref.removeNativeKey();
>> 1536:                     // prevent enqueuing SessionKeyRef until removeNativeKey is done
>> 1537:                     Reference.reachabilityFence(this);
> 
> The approach we are now taking is to put the reachabilityFence() call within the finally-clause of a try-finally statement. This ensures that all paths through the method will pass through the reachability fence, regardless of inlining or other JIT optimizations.

Thanks for the suggestion. Try-finally added.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17870#discussion_r1494333447



More information about the security-dev mailing list