Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java @ 16779:e52ad0d3b7d6
put some security sensitive actions into a privileged action
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 12 Aug 2014 00:08:19 +0200 |
parents | 70f47dbbcabd |
children | 846c059e3ecf |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java Tue Aug 12 00:01:54 2014 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java Tue Aug 12 00:08:19 2014 +0200 @@ -27,6 +27,7 @@ import java.io.*; import java.lang.annotation.*; import java.lang.reflect.*; +import java.security.*; import java.util.*; import sun.misc.*; @@ -160,9 +161,13 @@ private static final ClassValue<NodeClass> nodeClasses = new ClassValue<NodeClass>() { @SuppressWarnings("unchecked") @Override - protected NodeClass computeValue(Class<?> clazz) { + protected NodeClass computeValue(final Class<?> clazz) { assert Node.class.isAssignableFrom(clazz); - return new NodeClass((Class<? extends Node>) clazz, unsafeFieldOffsetProvider); + return AccessController.doPrivileged(new PrivilegedAction<NodeClass>() { + public NodeClass run() { + return new NodeClass((Class<? extends Node>) clazz, unsafeFieldOffsetProvider); + } + }); } };