On Thu, 18 Jun 2026 14:19:18 GMT, Artur Barashev <[email protected]> wrote:

>> I need a review for this bug fix causing intermittent test failures.  There 
>> is a reachability fence issue with PEM.java when accessing the `content`.
>> 
>> Thanks
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> src/java.base/share/classes/java/security/PEM.java line 174:
> 
>> 172:         this.type = type;
>> 173:         final var c = content;
>> 174:         CleanerFactory.cleaner().register(this, () -> KeyUtil.clear(c));
> 
> Should we put a comment here explaining that `reachabilityFence` calls below 
> are needed to avoid a race condition with a Cleaner zeroing the `context` 
> byte array while one of these methods is still operating on it?

I don't think so.  This is a JVM/GC situation that happens in other parts of 
the code too.  I wouldn't want to explain the underlying details and could vary 
with GC type.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31564#discussion_r3437575698

Reply via email to