I forgot to attach the patch. 

Regards,
Jeroen

> -----Original Message-----
> From: Jeroen Frijters 
> Sent: Friday, January 13, 2006 07:54
> To: 'Archie Cobbs'; Gary Benson
> Cc: Classpath List
> Subject: RE: SecurityManager troubles
> 
> Archie Cobbs wrote:
> > Gary Benson wrote:
> > > Isn't the boot class loader solely for java.lang?
> > 
> > No.. under the Java2 delegation model, the boot class loader
> > should be given the first chance to try and load *every* class.
> > 
> > Typically it will only find classes in glibj.zip (or rt.jar,
> > or whatever your VM equivalent of the core library is) because
> > that's all it knows to look in. So then the child classloader(s)
> > get to try.
> > 
> > In any case I'm still not clear on this problem. Yesterday it
> > looked to me like a result of delayed method resolution by kaffe.
> > But that could be completely off. I haven't actually witnessed
> > the problem so can't really say for sure without additional info.
> > 
> > It would be nice however to get to the bottom of it before 0.20...
> 
> I think I figured it out. With the attached test I could 
> reproduce the problem on IKVM as well. The attach Classpath 
> patch fixing things, although past 0.20 I think we should 
> refactor the security properties like I did with the system 
> properties (i.e. introduce a gnu.classpath.SecurityProperties class).
> 
> As you can see in the test, there is still the incorrect 
> "charsetProvider" permission being checked. I'm looking into 
> that one as well.
> 
> Regards,
> Jeroen
> 
Index: java/io/PrintStream.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/PrintStream.java,v
retrieving revision 1.25
diff -u -r1.25 PrintStream.java
--- java/io/PrintStream.java    2 Jul 2005 20:32:38 -0000       1.25
+++ java/io/PrintStream.java    12 Jan 2006 20:19:18 -0000
@@ -1,5 +1,6 @@
 /* PrintStream.java -- OutputStream for printing output
-   Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005  Free Software Foundation, 
Inc.
+   Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,6 +39,8 @@
 
 package java.io;
 
+import gnu.classpath.SystemProperties;
+
 /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
  * "The Java Language Specification", ISBN 0-201-63451-1
  * Status:  Believed complete and correct to 1.3
@@ -64,7 +67,7 @@
 
   // Line separator string.
   private static final char[] line_separator
-    = System.getProperty("line.separator").toCharArray();
+    = SystemProperties.getProperty("line.separator").toCharArray();
 
   /**
    *  Encoding name
@@ -112,7 +115,7 @@
     super (out);
 
     try {
-       this.encoding = System.getProperty("file.encoding");
+       this.encoding = SystemProperties.getProperty("file.encoding");
     } catch (SecurityException e){
        this.encoding = "ISO8859_1";
     } catch (IllegalArgumentException e){
Index: java/security/Security.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/security/Security.java,v
retrieving revision 1.39
diff -u -r1.39 Security.java
--- java/security/Security.java 3 Jan 2006 10:06:11 -0000       1.39
+++ java/security/Security.java 13 Jan 2006 06:52:05 -0000
@@ -1,5 +1,6 @@
 /* Security.java --- Java base security class implementation
-   Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005  Free Software Foundation, 
Inc.
+   Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -41,6 +42,7 @@
 import gnu.classpath.SystemProperties;
 
 import gnu.classpath.Configuration;
+import gnu.classpath.VMStackWalker;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -391,8 +393,11 @@
    */
   public static String getProperty(String key)
   {
+    // XXX To prevent infinite recursion when the SecurityManager calls us,
+    // don't do a security check if the caller is trusted (by virtue of having
+    // been loaded by the bootstrap class loader).
     SecurityManager sm = System.getSecurityManager();
-    if (sm != null)
+    if (sm != null && VMStackWalker.getCallingClassLoader() != null)
       sm.checkSecurityAccess("getProperty." + key);
 
     return secprops.getProperty(key);
_______________________________________________
Classpath mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath

Reply via email to