RFR: 8210373: Deadlock in libj2gss.so when loading "j2gss" and "net" libraries in parallel.
Weijun Wang
weijun at openjdk.java.net
Mon Feb 22 19:48:40 UTC 2021
On Mon, 22 Feb 2021 18:33:17 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:
>> `InetAddress` is loading native library `net` and at the same time `SunNativeProvider` is loading `j2gss`, and in the `OnLoad` function inside `j2gss` it is calling `FindClass(env, "java/net/InetAddress")` and thus a deadlock.
>>
>> We can access `InetAddress` in `SunNativeProvider.<clinit>` before loading the jgss library. i.e. use `Class.forName` to ensure `InetAddress` is initialized. Thanks to @dholmes-ora for providing this workaround.
>>
>> No new regression test, hard to reproduce.
>
> src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java line 74:
>
>> 72: System.getProperty("sun.security.nativegss.debug"));
>> 73: try {
>> 74: Class.forName("java.net.InetAddress");
>
> The returned value of Class.forName() is not used, someone else could delete this line later is he/she does not know the story behind this line. Would you mind add a few line comments about why it is added?
>
> Otherwise, looks good to me.
Definitely. I should have added one. Thanks for reminding.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2655
More information about the security-dev
mailing list