Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8225060

java.net.DefaultInterface invokes NetworkInterface::getInetAddresses without doPriv

    Details

    • Subcomponent:
    • Resolved In Build:
      b24
    • OS:
      os_x
    • Verification:
      Not verified

      Backports

        Description

        The test for JDK-8224730 exposes an issue in the macOS specific package-private java.net.DefaultInterface - NetworkInterface::getInetAddresses is invoked without a doPriv. DefaultInterface is loaded by NetworkInterface's static initializer.

        Example stacktrace, as seen from test/jdk/java/net/ServerSocket/TestLocalAddress.java:

         at TestLocalAddress$ExposedSecurityManager.checkConnect(TestLocalAddress.java:228)
                at java.base/java.net.NetworkInterface.getCheckedInetAddresses(NetworkInterface.java:155)
                at java.base/java.net.NetworkInterface.getInetAddresses(NetworkInterface.java:117)
                at java.base/java.net.DefaultInterface.chooseDefaultInterface(DefaultInterface.java:85)
                at java.base/java.net.DefaultInterface.<clinit>(DefaultInterface.java:46)
                at java.base/java.net.NetworkInterface.<clinit>(NetworkInterface.java:69)
                at java.base/java.net.Inet6AddressImpl.loopbackAddress(Inet6AddressImpl.java:126)
                at java.base/java.net.InetAddress.getLoopbackAddress(InetAddress.java:1363)
                at java.base/sun.nio.ch.Net.getLoopbackAddress(Net.java:229)
                at java.base/sun.nio.ch.Net.getRevealedLocalAddress(Net.java:218)
                at java.base/sun.nio.ch.ServerSocketAdaptor.getInetAddress(ServerSocketAdaptor.java:92)
                at java.base/java.net.ServerSocket.getLocalSocketAddress(ServerSocket.java:460)
                at java.base/java.security.AccessController.doPrivileged(AccessController.java:690)
                at TestLocalAddress.testWithNoPermissions(TestLocalAddress.java:128)
                at TestLocalAddress.serverSocketAdapterNoPermissions(TestLocalAddress.java:120)
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.base/java.lang.reflect.Method.invoke(Method.java:567)
                at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
                at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
                at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
                at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
                at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
                at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
                at org.testng.TestRunner.privateRun(TestRunner.java:773)
                at org.testng.TestRunner.run(TestRunner.java:623)
                at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
                at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
                at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
                at org.testng.SuiteRunner.run(SuiteRunner.java:259)
                at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
                at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
                at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
                at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
                at org.testng.TestNG.run(TestNG.java:1018)
                at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:94)
                at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:54)
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.base/java.lang.reflect.Method.invoke(Method.java:567)
                at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
                at java.base/java.lang.Thread.run(Thread.java:830)

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  chegar Chris Hegarty
                  Reporter:
                  chegar Chris Hegarty
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: