Robert Lougher wrote: > On 12/6/05, Gary Benson <[EMAIL PROTECTED]> wrote: > > ...I was just looking at an some code in an > > AccessController.doPrivileged() that was doing security checks. > > Perhaps JamVM's AccessController.doPrivileged() is not in fact > > doing anything. > > What version of JamVM are you using?
I'm using cvs HEAD, with Classpath HEAD. > As far as I'm aware, JamVMs implementation of VMAccessController is > complete (it was provided by Casey Marshall, if I remember > correctly). I've made some recent changes to the native method that > obtains the stack, so it _could_ have broken in 1.4.1. > > Do you have a testcase? If you build and run the attached testcase you ought to see only one checkPermission() between "Calling checkRead()" and "Done". GCJ (for example) makes this of it: $ gij Test Calling checkRead() checkPermission((java.io.FilePermission / read)) Done checkPermission((java.lang.RuntimePermission exitVM )) checkPermission((java.lang.RuntimePermission exitVM )) Based on what I'm seeing in Mauve you _should_ see a load of extra stuff before the actual checkPermission you're interested in if you run the testcase with JamVM: $ jamvm Test Calling checkRead() checkPermission((java.io.FilePermission /path/to/JamVM.security read)) checkPermission((java.io.FilePermission /path/to/JamVM.security read)) checkPermission((java.io.FilePermission /path/to/classpath.security read)) checkPermission((java.io.FilePermission /path/to/classpath.security read)) checkPermission((java.io.FilePermission /path/to/classpath.security read)) checkPermission((java.util.PropertyPermission java.util.logging.manager read)) checkPermission(null) checkPermission(null) checkPermission(null) checkPermission(null) checkPermission((java.util.PropertyPermission java.util.logging.config.class read)) checkPermission((java.util.PropertyPermission java.util.logging.config.file read)) checkPermission((java.util.PropertyPermission gnu.classpath.home.url read)) checkPermission((java.io.FilePermission /path/to/logging.properties read)) checkPermission((java.io.FilePermission /path/to/logging.properties read)) checkPermission((java.util.logging.LoggingPermission control )) checkPermission((java.util.logging.LoggingPermission control )) checkPermission((java.security.SecurityPermission getProperty.package.access )) checkPermission((java.io.FilePermission / read)) Done ... In reality, JamVM chokes on it pretty hard. I _think_ what is happening is that the System.out.println in checkPermission() is itself doing some initialisation which causes security checks, causing an infinite loop. It's hard to say, though, not knowing JamVM or Classpath particularly well. Cheers, Gary
import java.security.Permission; class Test { static class TestSecurityManager extends SecurityManager { public void checkPermission(Permission perm) { System.out.println(" checkPermission(" + perm + ")"); } } public static void main(String[] args) { try { SecurityManager sm = new TestSecurityManager(); System.setSecurityManager(sm); System.out.println("Calling checkRead()"); sm.checkRead("/"); System.out.println("Done"); } catch (Throwable t) { t.printStackTrace(); } } }
_______________________________________________ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath