nachos.security
Class NachosSecurityManager

java.lang.Object
  extended by java.lang.SecurityManager
      extended by nachos.security.NachosSecurityManager

public class NachosSecurityManager
extends SecurityManager

Protects the environment from malicious Nachos code.


Field Summary
 
Fields inherited from class java.lang.SecurityManager
inCheck
 
Constructor Summary
NachosSecurityManager(File testDirectory)
          Allocate a new Nachos security manager.
 
Method Summary
 void checkPermission(Permission perm)
          Check the specified permission.
 void enable()
          Install this security manager.
 Privilege getPrivilege()
          Return a privilege object for this security manager.
 ThreadGroup getThreadGroup()
          Called by the java.lang.Thread constructor to determine a thread group for a child thread of the current thread.
 void verifyPrivilege()
          Verify that the caller is privileged.
 void verifyPrivilege(Permission perm)
          Verify that the caller is privileged, so as to check the specified permission.
 
Methods inherited from class java.lang.SecurityManager
checkAccept, checkAccess, checkAccess, checkAwtEventQueueAccess, checkConnect, checkConnect, checkCreateClassLoader, checkDelete, checkExec, checkExit, checkLink, checkListen, checkMemberAccess, checkMulticast, checkMulticast, checkPackageAccess, checkPackageDefinition, checkPermission, checkPrintJobAccess, checkPropertiesAccess, checkPropertyAccess, checkRead, checkRead, checkRead, checkSecurityAccess, checkSetFactory, checkSystemClipboardAccess, checkTopLevelWindow, checkWrite, checkWrite, classDepth, classLoaderDepth, currentClassLoader, currentLoadedClass, getClassContext, getInCheck, getSecurityContext, inClass, inClassLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NachosSecurityManager

public NachosSecurityManager(File testDirectory)
Allocate a new Nachos security manager.

Parameters:
testDirectory - the directory usable by the stub file system.
Method Detail

getPrivilege

public Privilege getPrivilege()
Return a privilege object for this security manager. This security manager must not be the active security manager.

Returns:
a privilege object for this security manager.

enable

public void enable()
Install this security manager.


checkPermission

public void checkPermission(Permission perm)
Check the specified permission. Some operations are permissible while not grading. These operations are regulated here.

Overrides:
checkPermission in class SecurityManager
Parameters:
perm - the permission to check.

getThreadGroup

public ThreadGroup getThreadGroup()
Called by the java.lang.Thread constructor to determine a thread group for a child thread of the current thread. The caller must be privileged in order to successfully create the thread.

Overrides:
getThreadGroup in class SecurityManager
Returns:
a thread group for the new thread, or null to use the current thread's thread group.

verifyPrivilege

public void verifyPrivilege()
Verify that the caller is privileged.


verifyPrivilege

public void verifyPrivilege(Permission perm)
Verify that the caller is privileged, so as to check the specified permission.

Parameters:
perm - the permission being checked.