java.rmi.server.RMIClassLoaderSpi and security constraints

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P3
    • None
    • Affects Version/s: 5.0
    • Component/s: core-libs
    • sparc
    • solaris_2.6



      Name: sdR10048 Date: 07/08/2003


      Filed By : SPB JCK team (###@###.###)
      JDK : java full version "1.5.0-beta-b09"
      JCK : 1.5
      Platform[s] : Solaris
      switch/Mode :
      JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
      Failing Test [s] :
          api/java_rmi/server/RMIClassLoaderSpi/index.html#Annotation[methods0008]
          api/java_rmi/server/RMIClassLoaderSpi/index.html#Annotation[methods0009]


      Problem description
      ===================
      Default provider instance does not work under security constraints.
      As it turned out static init part does require java.util.PropertyPermission
      sun.rmi.loader.logLevel read. This behavior is unspecified.

      See mini test for details.

      Static init part (sun.rmi.server.LoaderHandler.<clinit>) steps in
      not when we create RMIClassLoaderSpi object but when we touch some class member from the created
      object (getClassAnnotation).
          
      Minimized test:
      ===============
      ------- T.java -------
      import java.security.*;
      import java.util.*;
      import java.rmi.*;
      import java.rmi.server.*;

      public class T extends SecurityManager {

          static RMIClassLoaderSpi cloader;

          public T(boolean permit) {
              this.permit = permit;
          }

          public static void main(String[] args) {
              cloader = RMIClassLoader.getDefaultProviderInstance();
              System.setSecurityManager(new T(true));
              System.setSecurityManager(new T(false));
              try {
                  cloader.getClassAnnotation(Object.class);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }

          // security manager impl

          public boolean permit = true;
          public void checkPermission(Permission perm) {
              if(!permit) {
                  throw new SecurityException ("permission: " + perm);
              }
          }
          public void checkPermission(Permission perm, Object context) {
              if(!permit) {
                  throw new SecurityException ("permission: " + perm);
              }
          }
      }

      ------- end-of-T.java -------

      Minimized test output:
      ======================
      Exception in thread "main" java.lang.ExceptionInInitializerError
              at java.rmi.server.RMIClassLoader$2.getClassAnnotation(RMIClassLoader.ja
      va:650)
              at T.main(T.java:19)
      Caused by: java.lang.SecurityException: permission: (java.util.PropertyPermissio
      n sun.rmi.loader.logLevel read)
              at T.checkPermission(T.java:30)
              at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:12
      76)
              at java.lang.System.getProperty(System.java:568)
              at sun.security.action.GetPropertyAction.run(GetPropertyAction.java:66)
              at java.security.AccessController.doPrivileged(Native Method)
              at sun.rmi.server.LoaderHandler.<clinit>(LoaderHandler.java:55)
              ... 2 more

      JCK test source location:
      ==========================
      /java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests

      ======================================================================

            Assignee:
            Peter Jones (Inactive)
            Reporter:
            Dsv Dsv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: