JDK-8191320 : Can't run JVMCI compiler with security manager on
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 10
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: linux_ubuntu
  • CPU: x86
  • Submitted: 2017-11-15
  • Updated: 2019-01-04
  • Resolved: 2017-11-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10
10Resolved
Related Reports
Blocks :  
Description
Hi.
I am using JDK10 revision 9d8b720454c6 and when I execute the JVM with JAR coming from https://github.com/jtulach/sieve/tree/master/java/algorithm sources, the execution fails in initializing the JVMCI compiler. 

I did a clean build of the JDK and I hope I build everything correctly. The problem doesn't seem to go away and I hope others will be able to reproduce it as well.

{code}
jdk10.internal/jdk10hs$ hg id
9d8b720454c6 tip


jdk10.internal/jdk10hs$ ./build/linux-x64/jdk/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler -Djava.security.manager -Djava.security.debug=access:domain:failure -jar ~/NetBeansProjects/sieve/java/algorithm/target/sieve-algorithm-1.0-SNAPSHOT.jar 
Computed 97 primes in 0 ms. Last one is 509
Computed 194 primes in 0 ms. Last one is 1181
Computed 388 primes in 0 ms. Last one is 2677
Computed 776 primes in 1 ms. Last one is 5897
Computed 1552 primes in 1 ms. Last one is 13033
Computed 3104 primes in 2 ms. Last one is 28541
Computed 6208 primes in 5 ms. Last one is 61687
Computed 12416 primes in 12 ms. Last one is 133033
access: domain (context is null)
access: access allowed ("java.io.FilePermission" "/home/devel/NetBeansProjects/jdk10.internal/jdk10hs/build/linux-x64/jdk/modules/jdk.internal.vm.compiler" "read")
access: domain (context is null)
access: access allowed ("java.io.FilePermission" "/home/devel/NetBeansProjects/jdk10.internal/jdk10hs/build/linux-x64/jdk/modules/jdk.internal.vm.compiler" "read")
access: domain (context is null)
access: access allowed ("java.io.FilePermission" "/home/devel/NetBeansProjects/jdk10.internal/jdk10hs/build/linux-x64/jdk/modules/jdk.internal.vm.compiler" "read")
access: domain (context is null)
access: access allowed ("java.lang.reflect.ReflectPermission" "suppressAccessChecks")
Computed 24832 primes in 32 ms. Last one is 284831
access: access denied ("java.lang.RuntimePermission" "accessClassInPackage.jdk.vm.ci.services")
java.lang.Exception: Stack trace
        at java.base/java.lang.Thread.dumpStack(Thread.java:1435)
        at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:462)
        at java.base/java.security.AccessController.checkPermission(AccessController.java:895)
        at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:558)
        at java.base/java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1534)
        at java.base/java.lang.ClassLoader$1.run(ClassLoader.java:680)
        at java.base/java.lang.ClassLoader$1.run(ClassLoader.java:678)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.lang.ClassLoader.checkPackageAccess(ClassLoader.java:678)
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1006)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1085)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:206)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:760)
        at java.base/jdk.internal.loader.BuiltinClassLoader.lambda$findClassInModuleOrNull$2(BuiltinClassLoader.java:683)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(BuiltinClassLoader.java:684)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClass(BuiltinClassLoader.java:562)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:607)
        at java.base/java.lang.Class.forName(Class.java:451)
        at java.base/java.util.ServiceLoader.lambda$loadProvider$1(ServiceLoader.java:856)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.util.ServiceLoader.loadProvider(ServiceLoader.java:858)
        at java.base/java.util.ServiceLoader.access$600(ServiceLoader.java:390)
        at java.base/java.util.ServiceLoader$ModuleServicesLookupIterator.hasNext(ServiceLoader.java:1076)
        at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1299)
        at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1384)
        at jdk.internal.vm.ci/jdk.vm.ci.services.JVMCIServiceLocator.getProviders(JVMCIServiceLocator.java:87)
        at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCICompilerConfig.getCompilerFactory(HotSpotJVMCICompilerConfig.java:90)
        at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.<init>(HotSpotJVMCIRuntime.java:290)
        at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.<init>(HotSpotJVMCIRuntime.java:65)
        at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime$DelayedInit.<clinit>(HotSpotJVMCIRuntime.java:73)
        at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime(HotSpotJVMCIRuntime.java:83)
        at jdk.internal.vm.ci/jdk.vm.ci.runtime.JVMCI.initializeRuntime(Native Method)
        at jdk.internal.vm.ci/jdk.vm.ci.runtime.JVMCI.<clinit>(JVMCI.java:58)
access: domain (context is null)
access: access allowed ("java.io.FilePermission" "/home/devel/NetBeansProjects/jdk10.internal/jdk10hs/build/linux-x64/jdk/modules/jdk.internal.vm.compiler" "read")
access: domain that failed ProtectionDomain  (file:/home/devel/NetBeansProjects/jdk10.internal/jdk10hs/build/linux-x64/jdk/modules/jdk.internal.vm.compiler/ <no signer certificates>)
 jdk.internal.loader.ClassLoaders$PlatformClassLoader@3d9a2a27
 <no principals>
 java.security.Permissions@1494450f (
 ("java.util.PropertyPermission" "java.specification.version" "read")
 ("java.util.PropertyPermission" "java.vm.vendor" "read")
 ("java.util.PropertyPermission" "path.separator" "read")
 ("java.util.PropertyPermission" "os.version" "read")
 ("java.util.PropertyPermission" "java.vendor.url" "read")
 ("java.util.PropertyPermission" "java.vm.name" "read")
 ("java.util.PropertyPermission" "java.vm.specification.version" "read")
 ("java.util.PropertyPermission" "os.name" "read")
 ("java.util.PropertyPermission" "java.version" "read")
 ("java.util.PropertyPermission" "os.arch" "read")
 ("java.util.PropertyPermission" "java.specification.vendor" "read")
 ("java.util.PropertyPermission" "java.vm.specification.name" "read")
 ("java.util.PropertyPermission" "file.separator" "read")
 ("java.util.PropertyPermission" "line.separator" "read")
 ("java.util.PropertyPermission" "java.vm.specification.vendor" "read")
 ("java.util.PropertyPermission" "java.specification.name" "read")
 ("java.util.PropertyPermission" "java.vendor" "read")
 ("java.util.PropertyPermission" "java.vm.version" "read")
 ("java.util.PropertyPermission" "java.class.version" "read")
 ("java.io.FilePermission" "/home/devel/NetBeansProjects/jdk10.internal/jdk10hs/build/linux-x64/jdk/modules/jdk.internal.vm.compiler/-#plus" "read")
 ("java.io.FilePermission" "/home/devel/NetBeansProjects/jdk10.internal/jdk10hs/build/linux-x64/jdk/modules/jdk.internal.vm.compiler/-" "read")
 ("java.lang.RuntimePermission" "accessClassInPackage.com.apple.*")
 ("java.lang.RuntimePermission" "accessClassInPackage.com.sun.beans.*")
 ("java.lang.RuntimePermission" "accessClassInPackage.com.sun.java.swing.plaf.*")
 ("java.lang.RuntimePermission" "accessClassInPackage.com.sun.beans")
 ("java.net.SocketPermission" "localhost:0" "listen,resolve")
)


Uncaught exception at /home/devel/NetBeansProjects/jdk10.internal/jdk10hs/open/src/hotspot/share/jvmci/jvmciCompiler.cpp:140
java.util.ServiceConfigurationError: jdk.vm.ci.services.JVMCIServiceLocator: Unable to load org.graalvm.compiler.hotspot.HotSpotGraalJVMCIServiceLocator
        at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:581)
        at java.base/java.util.ServiceLoader.loadProvider(ServiceLoader.java:862)
        at java.base/java.util.ServiceLoader.access$600(ServiceLoader.java:390)
        at java.base/java.util.ServiceLoader$ModuleServicesLookupIterator.hasNext(ServiceLoader.java:1076)
        at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1299)
        at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1384)
        at jdk.internal.vm.ci/jdk.vm.ci.services.JVMCIServiceLocator.getProviders(JVMCIServiceLocator.java:87)
        at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCICompilerConfig.getCompilerFactory(HotSpotJVMCICompilerConfig.java:90)
        at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.<init>(HotSpotJVMCIRuntime.java:290)
        at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.<init>(HotSpotJVMCIRuntime.java:65)
        at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime$DelayedInit.<clinit>(HotSpotJVMCIRuntime.java:73)
        at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime(HotSpotJVMCIRuntime.java:83)
        at jdk.internal.vm.ci/jdk.vm.ci.runtime.JVMCI.initializeRuntime(Native Method)
        at jdk.internal.vm.ci/jdk.vm.ci.runtime.JVMCI.<clinit>(JVMCI.java:58)
Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.jdk.vm.ci.services")
        at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
        at java.base/java.security.AccessController.checkPermission(AccessController.java:895)
        at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:558)
        at java.base/java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1534)
        at java.base/java.lang.ClassLoader$1.run(ClassLoader.java:680)
        at java.base/java.lang.ClassLoader$1.run(ClassLoader.java:678)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.lang.ClassLoader.checkPackageAccess(ClassLoader.java:678)
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1006)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1085)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:206)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:760)
        at java.base/jdk.internal.loader.BuiltinClassLoader.lambda$findClassInModuleOrNull$2(BuiltinClassLoader.java:683)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(BuiltinClassLoader.java:684)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClass(BuiltinClassLoader.java:562)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:607)
        at java.base/java.lang.Class.forName(Class.java:451)
        at java.base/java.util.ServiceLoader.lambda$loadProvider$1(ServiceLoader.java:856)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.util.ServiceLoader.loadProvider(ServiceLoader.java:858)
        ... 12 more
{code}
Comments
Was it all just a random noise on my local disk? I was afraid of it being so. Sorry for the noise.
30-11-2017

Closing it then. We can reopen again if we see it.
29-11-2017

I can confirm it is not reproducible with the latest jdk/hs sources on Linux either. Nor with the binaries available from http://jdk.java.net/10/.
29-11-2017

[~jtulach] Jaroslav, please, try to reproduce the problem with latest jdk/hs sources. If it is not reproduced, please close this bug.
29-11-2017

jdk.vm.ci.runtime.JVMCI fails to initialize when running with security manager when loading the providers. This issue is in the right category (hotspot compiler) and so I unassign myself. I can provide assistance to diagnose this issue. I think one can workaround this issue by granting the permissions the security policy file.
28-11-2017

ILW = execution failure initializing JVMCI compiler, blocks 8189116!; issue with security manager on; no workaorund = MMH = P3
16-11-2017