RFR: 8334394: Race condition in Class::protectionDomain
Weijun Wang
weijun at openjdk.org
Mon Jun 17 15:17:11 UTC 2024
On Mon, 17 Jun 2024 15:11:29 GMT, Weijun Wang <weijun at openjdk.org> wrote:
>> 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.
So this test might look like unrelated to the fix at first sight, but somewhere deep inside the call stack it does. I should add a comment. Thanks.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19752#discussion_r1642978163
More information about the core-libs-dev
mailing list