On Mon, 17 Jun 2024 15:08:26 GMT, Chen Liang <[email protected]> wrote:
>> Make sure `pd` is always the same object when `getProtectionDomain0` is null.
>
> test/jdk/java/lang/Class/ProtectionDomainRace.java line 42:
>
>> 40: try {
>> 41: Subject.doAs(null, ac);
>> 42: } catch (Throwable t) {
>
> This can test for the racy NPE, but it cannot detect if there's distinct
> allPermDomain objects written by races. Should we add another check to defend
> against that?
Actually it can. This bug originally breaks the `assert` statement at
https://github.com/openjdk/jdk/blob/5cea53d372744ddf1bedaae4667415e6525ef82f/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java#L1209.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19752#discussion_r1642973826