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

MH.publicLookup() init circularity, triggered by custom SecurityManager with String concat and -limitmods java.base

    XMLWordPrintable

    Details

      Description

      If java/lang/String/concat/WithSecurityManager.java test is run with "-limitmods":
      $ jtreg -javaoptions:"-limitmods java.base" java/lang/String/concat/WithSecurityManager.java
      it fails with
      java.lang.BootstrapMethodError: call site initialization exception
      at java.lang.invoke.CallSite.makeSite(java.base@9-internal/CallSite.java:347)
      at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(java.base@9-internal/MethodHandleNatives.java:250)
      at java.lang.invoke.MethodHandleNatives.linkCallSite(java.base@9-internal/MethodHandleNatives.java:240)
      at WithSecurityManager$1.checkPermission(WithSecurityManager.java:47)
      at java.lang.SecurityManager.checkPropertiesAccess(java.base@9-internal/SecurityManager.java:1253)
      at java.lang.System.getProperties(java.base@9-internal/System.java:675)
      at sun.security.action.GetPropertyAction$1.run(java.base@9-internal/GetPropertyAction.java:153)
      at sun.security.action.GetPropertyAction$1.run(java.base@9-internal/GetPropertyAction.java:151)
      at java.security.AccessController.doPrivileged(java.base@9-internal/Native Method)
      at sun.security.action.GetPropertyAction.privilegedGetProperties(java.base@9-internal/GetPropertyAction.java:150)
      at java.lang.invoke.StringConcatFactory.<clinit>(java.base@9-internal/StringConcatFactory.java:200)
      at jdk.internal.misc.Unsafe.ensureClassInitialized0(java.base@9-internal/Native Method)
      at jdk.internal.misc.Unsafe.ensureClassInitialized(java.base@9-internal/Unsafe.java:1054)
      at java.lang.invoke.DirectMethodHandle.shouldBeInitialized(java.base@9-internal/DirectMethodHandle.java:304)
      at java.lang.invoke.DirectMethodHandle.preparedLambdaForm(java.base@9-internal/DirectMethodHandle.java:168)
      at java.lang.invoke.DirectMethodHandle.make(java.base@9-internal/DirectMethodHandle.java:86)
      at java.lang.invoke.MethodHandles$Lookup.getDirectMethodCommon(java.base@9-internal/MethodHandles.java:1972)
      at java.lang.invoke.MethodHandles$Lookup.getDirectMethodNoSecurityManager(java.base@9-internal/MethodHandles.java:1929)
      at java.lang.invoke.MethodHandles$Lookup.getDirectMethodForConstant(java.base@9-internal/MethodHandles.java:2160)
      at java.lang.invoke.MethodHandles$Lookup.linkMethodHandleConstant(java.base@9-internal/MethodHandles.java:2109)
      at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(java.base@9-internal/MethodHandleNatives.java:499)
      at WithSecurityManager$1.checkPermission(WithSecurityManager.java:47)
      at java.lang.SecurityManager.checkRead(java.base@9-internal/SecurityManager.java:880)
      at java.io.File.exists(java.base@9-internal/File.java:815)
      at jdk.internal.loader.URLClassPath$FileLoader.getResource(java.base@9-internal/URLClassPath.java:1039)
      at jdk.internal.loader.URLClassPath.getResource(java.base@9-internal/URLClassPath.java:216)
      at jdk.internal.loader.BuiltinClassLoader$3.run(java.base@9-internal/BuiltinClassLoader.java:463)
      at jdk.internal.loader.BuiltinClassLoader$3.run(java.base@9-internal/BuiltinClassLoader.java:460)
      at java.security.AccessController.doPrivileged(java.base@9-internal/Native Method)
      at jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(java.base@9-internal/BuiltinClassLoader.java:459)
      at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(java.base@9-internal/BuiltinClassLoader.java:406)
      at jdk.internal.loader.BuiltinClassLoader.loadClass(java.base@9-internal/BuiltinClassLoader.java:364)
      at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base@9-internal/ClassLoaders.java:185)
      at java.lang.ClassLoader.loadClass(java.base@9-internal/ClassLoader.java:419)
      at WithSecurityManager.main(WithSecurityManager.java:51)
      at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@9-internal/Native Method)
      at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@9-internal/NativeMethodAccessorImpl.java:62)
      at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@9-internal/DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(java.base@9-internal/Method.java:531)
      at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:110)
      at java.lang.Thread.run(java.base@9-internal/Thread.java:843)
      Caused by: java.lang.invoke.StringConcatException: Generator failed
      at java.lang.invoke.StringConcatFactory.generate(java.base@9-internal/StringConcatFactory.java:732)
      at java.lang.invoke.StringConcatFactory.doStringConcat(java.base@9-internal/StringConcatFactory.java:637)
      at java.lang.invoke.StringConcatFactory.makeConcatWithConstants(java.base@9-internal/StringConcatFactory.java:552)
      at java.lang.invoke.CallSite.makeSite(java.base@9-internal/CallSite.java:300)
      ... 40 more
      Caused by: java.lang.BootstrapMethodError: call site initialization exception
      at java.lang.invoke.CallSite.makeSite(java.base@9-internal/CallSite.java:347)
      at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(java.base@9-internal/MethodHandleNatives.java:250)
      at java.lang.invoke.MethodHandleNatives.linkCallSite(java.base@9-internal/MethodHandleNatives.java:240)
      at WithSecurityManager$1.checkPermission(WithSecurityManager.java:47)
      at java.lang.SecurityManager.checkCreateClassLoader(java.base@9-internal/SecurityManager.java:603)
      at java.lang.ClassLoader.checkCreateClassLoader(java.base@9-internal/ClassLoader.java:334)
      at java.lang.ClassLoader.<init>(java.base@9-internal/ClassLoader.java:378)
      at java.lang.invoke.MethodHandles$LookupHelper$1.<init>(java.base@9-internal/MethodHandles.java:2193)
      at java.lang.invoke.MethodHandles$LookupHelper.createClass(java.base@9-internal/MethodHandles.java:2193)
      at java.lang.invoke.MethodHandles$LookupHelper.access$200(java.base@9-internal/MethodHandles.java:2177)
      at java.lang.invoke.MethodHandles$LookupHelper$2.run(java.base@9-internal/MethodHandles.java:2211)
      at java.lang.invoke.MethodHandles$LookupHelper$2.run(java.base@9-internal/MethodHandles.java:2209)
      at java.security.AccessController.doPrivileged(java.base@9-internal/Native Method)
      at java.lang.invoke.MethodHandles$LookupHelper.<clinit>(java.base@9-internal/MethodHandles.java:2214)
      at java.lang.invoke.MethodHandles.publicLookup(java.base@9-internal/MethodHandles.java:140)
      at java.lang.invoke.StringConcatFactory$Stringifiers$1.apply(java.base@9-internal/StringConcatFactory.java:1740)
      at java.lang.invoke.StringConcatFactory$Stringifiers$1.apply(java.base@9-internal/StringConcatFactory.java:1737)
      at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(java.base@9-internal/ConcurrentHashMap.java:1716)
      at java.lang.invoke.StringConcatFactory$Stringifiers.forMost(java.base@9-internal/StringConcatFactory.java:1796)
      at java.lang.invoke.StringConcatFactory$MethodHandleInlineCopyStrategy.generate(java.base@9-internal/StringConcatFactory.java:1494)
      at java.lang.invoke.StringConcatFactory.generate(java.base@9-internal/StringConcatFactory.java:727)
      ... 43 more
      Caused by: java.lang.invoke.StringConcatException: Generator failed
      at java.lang.invoke.StringConcatFactory.generate(java.base@9-internal/StringConcatFactory.java:732)
      at java.lang.invoke.StringConcatFactory.doStringConcat(java.base@9-internal/StringConcatFactory.java:637)
      at java.lang.invoke.StringConcatFactory.makeConcatWithConstants(java.base@9-internal/StringConcatFactory.java:552)
      at java.lang.invoke.CallSite.makeSite(java.base@9-internal/CallSite.java:300)
      ... 63 more
      Caused by: java.lang.IllegalStateException: Recursive update
      at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(java.base@9-internal/ConcurrentHashMap.java:1767)
      at java.lang.invoke.StringConcatFactory$Stringifiers.forMost(java.base@9-internal/StringConcatFactory.java:1796)
      at java.lang.invoke.StringConcatFactory$MethodHandleInlineCopyStrategy.generate(java.base@9-internal/StringConcatFactory.java:1494)
      at java.lang.invoke.StringConcatFactory.generate(java.base@9-internal/StringConcatFactory.java:727)
      ... 66 more




      Exception: java.lang.BootstrapMethodError thrown from the UncaughtExceptionHandler in thread "MainThread"
      Exception in thread "main" java.lang.BootstrapMethodError: call site initialization exception
      at java.lang.invoke.CallSite.makeSite(java.base@9-internal/CallSite.java:347)
      at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(java.base@9-internal/MethodHandleNatives.java:250)
      at java.lang.invoke.MethodHandleNatives.linkCallSite(java.base@9-internal/MethodHandleNatives.java:240)
      at WithSecurityManager$1.checkPermission(WithSecurityManager.java:47)
      at java.lang.SecurityManager.checkRead(java.base@9-internal/SecurityManager.java:880)
      at java.io.File.exists(java.base@9-internal/File.java:815)
      at jdk.internal.loader.URLClassPath$FileLoader.getResource(java.base@9-internal/URLClassPath.java:1039)
      at jdk.internal.loader.URLClassPath.getResource(java.base@9-internal/URLClassPath.java:216)
      at jdk.internal.loader.BuiltinClassLoader$3.run(java.base@9-internal/BuiltinClassLoader.java:463)
      at jdk.internal.loader.BuiltinClassLoader$3.run(java.base@9-internal/BuiltinClassLoader.java:460)
      at java.security.AccessController.doPrivileged(java.base@9-internal/Native Method)
      at jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(java.base@9-internal/BuiltinClassLoader.java:459)
      at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(java.base@9-internal/BuiltinClassLoader.java:406)
      at jdk.internal.loader.BuiltinClassLoader.loadClass(java.base@9-internal/BuiltinClassLoader.java:364)
      at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base@9-internal/ClassLoaders.java:185)
      at java.lang.ClassLoader.loadClass(java.base@9-internal/ClassLoader.java:419)
      at com.sun.javatest.regtest.agent.MainWrapper.main(MainWrapper.java:81)
      Caused by: java.lang.NoClassDefFoundError: Could not initialize class java.lang.invoke.StringConcatFactory
      at java.lang.invoke.StringConcatFactory.makeConcatWithConstants(java.base@9-internal/StringConcatFactory.java:548)
      at java.lang.invoke.CallSite.makeSite(java.base@9-internal/CallSite.java:300)
      ... 16 more

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              shade Aleksey Shipilev
              Reporter:
              shurailine Aleksandre Iline
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: