classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Security manager problem


From: Gary Benson
Subject: Re: Security manager problem
Date: Wed, 7 Dec 2005 11:14:16 +0000

Robert Lougher wrote:
> On 12/6/05, Gary Benson <address@hidden> 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

Attachment: Test.java
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]