RFR: 8316113: Infinite permission checking loop in java/net/spi/InetAddressResolverProvider/RuntimePermissionTest

Aleksey Shipilev shade at openjdk.org
Tue Sep 12 12:31:41 UTC 2023


On Tue, 12 Sep 2023 12:23:40 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> See the bug for stack traces. This causes a very intermittent test failure: when we call for `LOGGER.info` from our custom security manager, it goes into formatter, which loads locale data, which causes class load, which goes back to this custom security manager, starting the loop again. 
>> 
>> I think we get lucky most of the time to load the relevant classes outside this path. But sometimes, we don't get as lucky.
>> 
>> Additional testing:
>>  - [x] 100x iterations of [JDK-8315640](https://bugs.openjdk.org/browse/JDK-8315640) reproducer
>
> test/jdk/java/net/spi/InetAddressResolverProvider/RuntimePermissionTest.java line 89:
> 
>> 87:             if (permission instanceof RuntimePermission) {
>> 88:                 if (RUNTIME_PERMISSION_NAME.equals(permission.getName()) && !permitInetAddressResolver) {
>> 89:                     LOGGER.info("Denying '" + RUNTIME_PERMISSION_NAME + "' permission");
> 
> Hello Aleksey, wouldn't this logger statement have the same issue as the one that was outside the if block? Should this logger message be removed too?

Nope, because this one is gated by `RUNTIME_PERMISSION_NAME`, which is `inetAddressResolverProvider`. This does not form the cycle. It is the other path that gets us in trouble.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15681#discussion_r1322961766


More information about the net-dev mailing list