RFR JDK-8247247: JFR tests fail due to JDK-8235521 missing doPrivileged block
Mandy Chung
mandy.chung at oracle.com
Thu Jun 11 16:40:03 UTC 2020
Webrev:
http://cr.openjdk.java.net/~mchung/jdk15/webrevs/8247247/webrev.00/
The call to `Unsafe::ensureClassInitialized` was replaced with
`MethodHandles.privateLookupIn(clazz, LOOKUP).ensureInitialized(clazz)`
by JDK-8235521 but missing the doPrivileged block.
The call to `MethodHandles::privateLookupIn` has an unconditional
security permission check whereas the call to
`Lookup::ensureInitialized` may trigger a permission check if the Lookup
object is not a full privilege Lookup. The fix is to only wrap
``MethodHandles::privateLookupIn` with a doPrivileged block and keep
Lookup::ensureInitialized` call without doPrivileged that was the
previous behavior. This fix also ensures that the class is initialized
only at event class registration time which is done with doPrivileged
block (i.e. security check on Lookup::ensureInitialized will pass).
OTOH, getEventType and unregister are changed not to initialize the class.
Thanks
Mandy
More information about the hotspot-jfr-dev
mailing list