JDK-8195802 : Eliminate use of jdk.internal.misc security utilities in javafx.graphics
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: 9,10,openjfx11
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-01-19
  • Updated: 2018-06-13
  • Resolved: 2018-03-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
openjfx11Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Description
The callback code in GlassStage (in the quantum toolkit) uses the following security utility classes in jdk.internal.misc to compute the intersection of privileges between two AccessControlContexts:

jdk.internal.misc.SharedSecrets
jdk.internal.misc.JavaSecurityAccess

This is done to restrict permissions to those available only to both of the captured ACCs.

In an effort to eliminate the use of internal packages from core module by javafx.* modules we need an alternative solution.

Comments
OK. +1
09-03-2018

AccessController.doPrivileged() and AccessController.doPrivilegedWithCombiner() both propagate exception if any. Earlier doIntersectionPrivilege() method used to catch IllegalAccessException or InvocationTargetException --- AND --- convert it to SecurityException. Do we need to keep similar code?
08-03-2018

I don't think that is needed. The reason for the try/catch was that it used to use reflection, which is no longer the case so those checked exceptions are not thrown.
08-03-2018

Looks good to me, with one white space issue that must be fixed before pushing: modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/GlassStage.java:113: Trailing whitespace Also, please wait for a second reviewer. No need for a new webrev if there are no other comments. +1
02-03-2018

Hi Kevin & Ajit, Please review the fix webrev: http://cr.openjdk.java.net/~arapte/fx/8195802/webrev.00/ The jdk.internal.misc was used only once to derive intersected AccessControllerContext. It is now replaced with a nested call of doPrivileged & doPrivilegedWithCombiner to derive intersected AccessControllerContext. Test for this fix will be added later with JDK-8198827. Validity of the approach is tested with a stand alone application.
02-03-2018

Now that JDK-8195801 is fixed, the removal of the qualified export of jdk.internal.misc to javafx.graphics should be done as part of this issue (JDK-8195802).
26-01-2018

Once both bugs have been fixed, and this dependency has been eliminated, then the qualified export can be removed from dependencies/java.base/module-info.java.extra and build.gradle. See the "REMOVING QUALIFIED EXPORTS" comment in JDK-8195798 for instructions.
23-01-2018

Note that the qualified export of jdk.internal.misc to javafx.graphics can only be removed once both of JDK-8195801 and JDK-8195802 (this bug) are resolved. Which ever one is done last can / should remove the qualified export.
19-01-2018

The easiest solution might be to copy the needed intersection code into javafx.graphics. Alternatively, we might see whether a new public API can be added to the JDK.
19-01-2018