RFR: 8334394: Race condition in Class::protectionDomain

Chen Liang liach at openjdk.org
Mon Jun 17 15:11:13 UTC 2024


On Mon, 17 Jun 2024 14:51:07 GMT, Weijun Wang <weijun at openjdk.org> 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?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19752#discussion_r1642969479


More information about the core-libs-dev mailing list