JDK-8098817 : Adjust access checks for VM anonymous classes
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2015-06-16
  • Updated: 2020-11-24
  • Resolved: 2020-11-24
Related Reports
Relates :  
Description
Maurizio fixed a bunch of bugs with incorrect access checks for VM anonymous classes in Valhalla repo:
http://hg.openjdk.java.net/valhalla/valhalla/hotspot/rev/06a7383a22cc
http://hg.openjdk.java.net/valhalla/valhalla/jdk/rev/c28ea949f8cc

Maurizio wrote:
I basically implemented a logic where the access checks are performed on the entire chain of classes linked by the 'getHostClass' operation. This seems to work reliably, w/o any need for excluding classes defined in Unsafe.dAC from the access logic dance. 

The problems should be fixed in 9 as well.
Comments
VM anonymous classes are not supported and are replaced with hidden classes.
24-11-2020

JDK-8171335 aims to provide a replacement API for Unsafe::defineAnonymousClass and so this patch may not be applicable if JDK-8171335 is resolved.
28-09-2018