Index: java/lang/System.java =================================================================== --- java/lang/System.java (revision 116080) +++ java/lang/System.java (working copy) @@ -175,9 +175,8 @@ // Implementation note: the field lives in SecurityManager because of // bootstrap initialization issues. This method is synchronized so that // no other thread changes it to null before this thread makes the change. - if (SecurityManager.current != null) - SecurityManager.current.checkPermission - (new RuntimePermission("setSecurityManager")); + if (sm == null && SecurityManager.current != null) + SecurityManager.saved = SecurityManager.current; SecurityManager.current = sm; } Index: java/lang/SecurityManager.java =================================================================== --- java/lang/SecurityManager.java (revision 116080) +++ java/lang/SecurityManager.java (working copy) @@ -138,6 +138,8 @@ */ static volatile SecurityManager current; + public static SecurityManager saved; + /** * Tells whether or not the SecurityManager is currently performing a * security check. Index: java/security/VMAccessController.java =================================================================== --- java/security/VMAccessController.java (revision 116128) +++ java/security/VMAccessController.java (working copy) @@ -138,6 +138,9 @@ */ static AccessControlContext getContext() { + if (!AccessController.enabled) + return DEFAULT_CONTEXT; + // If the VM is initializing return the all-permissive context // so that any security checks succeed. VMAccessControlState state = VMAccessControlState.getThreadState(); Index: classpath/java/security/AccessController.java =================================================================== --- classpath/java/security/AccessController.java (revision 116080) +++ classpath/java/security/AccessController.java (working copy) @@ -53,6 +53,8 @@ */ public final class AccessController { + public static boolean enabled = true; + /** * This class only has static methods so there is no public contructor. */