JDK-6734178 : AccessControlException with deployment cache
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6,6u10
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2008-08-06
  • Updated: 2011-02-16
  • Resolved: 2009-02-17
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
Java Plug-in 1.6.0_07
Using JRE version 1.6.0_07 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\dea



ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
The problem occurs with RMI Calls within an applet through proxy objects which are RMI-codebase downloaded. The RMI downloaded code runs in the sandbox: The host where the RMI server runs is the same as the host of the codebase.
In this szenario the AccessControlException (see below) occasionally comes up.
Until JRE6 Update 5 the problem never occurred, although the software is heavily in use with it.
With JRE6 Update 6 we are also able to reproduce the problem.

Exception in thread "Thread-165" java.security.AccessControlException: access denied (java.io.FilePermission C:\Documents and Settings\dea\Application Data\Sun\Java\Deployment\cache\6.0\9\3729bc9-26b0334b.idx read)
	at java.security.AccessControlContext.checkPermission(Unknown Source)
	at java.security.AccessController.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkRead(Unknown Source)
	at java.io.RandomAccessFile.<init>(Unknown Source)
	at com.sun.deploy.cache.CacheEntry.readManifest(Unknown Source)
	at com.sun.deploy.cache.CacheEntry.getManifest(Unknown Source)
	at com.sun.deploy.cache.CachedJarFile.getManifest(Unknown Source)
	at sun.misc.URLClassPath$JarLoader$2.getManifest(Unknown Source)
	at java.net.URLClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.access$000(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
	at java.rmi.server.RMIClassLoader$2.loadClass(Unknown Source)
	at java.rmi.server.RMIClassLoader.loadClass(Unknown Source)
	at sun.rmi.server.MarshalInputStream.resolveClass(Unknown Source)
	at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
	at java.io.ObjectInputStream.readClassDesc(Unknown Source)
	at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
	at java.io.ObjectInputStream.readObject0(Unknown Source)
	at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
	at java.io.ObjectInputStream.readSerialData(Unknown Source)
	at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
	at java.io.ObjectInputStream.readObject0(Unknown Source)
	at java.io.ObjectInputStream.readObject(Unknown Source)
	at sun.rmi.server.UnicastRef.unmarshalValue(Unknown Source)
	at sun.rmi.server.UnicastRef.invoke(Unknown Source)
	at sun.rmi.server.ActivatableRef.invoke(Unknown Source)
	at com.rubean.drubeans.beans.mware.jini.device.cdm.twinsafe.TwinSafeJiniService_Stub.getResponse(Unknown Source)
	at com.rubean.drubeans.beans.mware.jini.device.DeviceJiniService$JobProxy.getResponse(Unknown Source)
	at com.rubean.drubeans.beans.mware.jini.device.DeviceJiniService$JobProxy.getResult(Unknown Source)



ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "Thread-165" java.security.AccessControlException: access denied (java.io.FilePermission C:\Documents and Settings\dea\Application Data\Sun\Java\Deployment\cache\6.0\9\3729bc9-26b0334b.idx read)
	at java.security.AccessControlContext.checkPermission(Unknown Source)
	at java.security.AccessController.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkRead(Unknown Source)
	at java.io.RandomAccessFile.<init>(Unknown Source)
	at com.sun.deploy.cache.CacheEntry.readManifest(Unknown Source)
	at com.sun.deploy.cache.CacheEntry.getManifest(Unknown Source)
	at com.sun.deploy.cache.CachedJarFile.getManifest(Unknown Source)
	at sun.misc.URLClassPath$JarLoader$2.getManifest(Unknown Source)
	at java.net.URLClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.access$000(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
	at java.rmi.server.RMIClassLoader$2.loadClass(Unknown Source)
	at java.rmi.server.RMIClassLoader.loadClass(Unknown Source)
	at sun.rmi.server.MarshalInputStream.resolveClass(Unknown Source)
	at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
	at java.io.ObjectInputStream.readClassDesc(Unknown Source)
	at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
	at java.io.ObjectInputStream.readObject0(Unknown Source)
	at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
	at java.io.ObjectInputStream.readSerialData(Unknown Source)
	at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
	at java.io.ObjectInputStream.readObject0(Unknown Source)
	at java.io.ObjectInputStream.readObject(Unknown Source)
	at sun.rmi.server.UnicastRef.unmarshalValue(Unknown Source)
	at sun.rmi.server.UnicastRef.invoke(Unknown Source)
	at sun.rmi.server.ActivatableRef.invoke(Unknown Source)
	at com.rubean.drubeans.beans.mware.jini.device.cdm.twinsafe.TwinSafeJiniService_Stub.getResponse(Unknown Source)
	at com.rubean.drubeans.beans.mware.jini.device.DeviceJiniService$JobProxy.getResponse(Unknown Source)
	at com.rubean.drubeans.beans.mware.jini.device.DeviceJiniService$JobProxy.getResult(Unknown Source)


REPRODUCIBILITY :
This bug can be reproduced occasionally.

Release Regression From : 6u5
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION this will be taken care of by fix to 6785446
17-02-2009

EVALUATION I tried to create a simple RMI HelloWorld applet, and I cannot reproduce the problem. http://capoon.sfbay.sun.com:8080/rmiapplet/applet2.htm In the standard case, when CachedJarFile.getManifest, it will be triggered from sun.plugin2.applet.Plugin2ClassLoader.findClassHelper, where we do a doPrviliedged on the load class operation, so getManifest works, see stack trace below: java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Unknown Source) at com.sun.deploy.cache.CachedJarFile.getManifest(CachedJarFile.java:216) at sun.misc.ExtensionDependency.checkExtensions(Unknown Source) at sun.misc.ExtensionDependency.checkExtensionsDependencies(Unknown Source) at sun.misc.URLClassPath$JarLoader.parseExtensionsDependencies(Unknown Source) at sun.misc.URLClassPath$JarLoader.getClassPath(Unknown Source) at sun.misc.URLClassPath.getLoader(Unknown Source) at sun.misc.URLClassPath.getResource(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader$2.run(Plugin2ClassLoader.java:463) at java.security.AccessController.doPrivileged(Native Method) at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Plugin2ClassLoader.java:452) at sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:100) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at sun.rmi.server.LoaderHandler.loadClass(Unknown Source) at java.rmi.server.RMIClassLoader$2.loadClass(Unknown Source) at com.sun.deploy.util.DeployRMIClassLoaderSpi.loadClass(DeployRMIClassLoaderSpi.java:47) at java.rmi.server.RMIClassLoader.loadClass(Unknown Source) at sun.rmi.server.MarshalInputStream.resolveClass(Unknown Source) at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source) at java.io.ObjectInputStream.readClassDesc(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) at ClientApplet.init(ClientApplet.java:14) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1462) at java.lang.Thread.run(Unknown Source) In the customer's stack trace, there is no PluginClassLoader at all.
19-11-2008

EVALUATION looking at the stacktrace and current source code with 6u10, i believe the problem exists in 6u10 also. From the reported stack trace, it's possible for CachedJarFile.getManifest to be called directly from untrusted code, which in turns call into CacheEntry.getManifest, and calls into CacheEntry.readManifest: void readManifest() throws IOException { if (manifestPosition != -1) { RandomAccessFile raf = openLockIndexFile("r", false); The "false" parameter to openLockIndexFile will cause the code to execute without the doPriviledged block,and hence the AccessControlException. So in this case, we probably want "true" instead. We need to create a simple RMI testcase to reproduce the problem.
06-08-2008