[vmkit-commits] [PATCH] Impl JVM_DoPrivileged, no actual protection.
Nicolas Geoffray
nicolas.geoffray at gmail.com
Tue Nov 1 12:27:17 PDT 2011
Looks good. We're not security freaks (yet) :)
On Tue, Nov 1, 2011 at 5:58 AM, Will Dietz <wdietz2 at illinois.edu> wrote:
> Inlined below.
>
> For now, dodge the implementation of anything actually secure, and put
> a working implementation in the code since it's used a fair amount
> while bootstrapping OpenJDK.
>
> ~Will
>
> >From 8cc1f086eb2ae50a0257fff04c5b704fb648ce0a Mon Sep 17 00:00:00 2001
> From: Will Dietz <w at wdtz.org>
> Date: Mon, 31 Oct 2011 16:37:26 -0500
> Subject: [PATCH 8/8] Impl JVM_DoPrivileged, no actual protection.
>
> ---
> lib/J3/ClassLib/OpenJDK/OpenJDK.inc | 34
> +++++++++++++++++++++++++++++++---
> 1 files changed, 31 insertions(+), 3 deletions(-)
>
> diff --git a/lib/J3/ClassLib/OpenJDK/OpenJDK.inc
> b/lib/J3/ClassLib/OpenJDK/OpenJDK.inc
> index fc4663c..cc8c3a4 100644
> --- a/lib/J3/ClassLib/OpenJDK/OpenJDK.inc
> +++ b/lib/J3/ClassLib/OpenJDK/OpenJDK.inc
> @@ -1141,18 +1141,46 @@ JNIEXPORT jstring JNICALL JVM_ConstantPoolGetUTF8At
> JNIEXPORT jobject JNICALL
> JVM_DoPrivileged(JNIEnv *env, jclass cls,
> jobject action, jobject context, jboolean wrapException) {
> - NYI();
> + JavaObject * obj = 0;
> + JavaObject * res = 0;
> + llvm_gcroot(obj, 0);
> + llvm_gcroot(res, 0);
> + BEGIN_JNI_EXCEPTION
> +
> + verifyNull(action);
> +
> + obj = *(JavaObject**)action;
> +
> + Jnjvm* vm = th->getJVM();
> +
> + // For now, we don't do anything special,
> + // just call the requested 'run()' method...
> + UserClass * cl = JavaObject::getClass(obj)->asClass();
> + const UTF8 * runName = cl->classLoader->hashUTF8->lookupAsciiz("run");
> + const UTF8 * runType =
> cl->classLoader->hashUTF8->lookupAsciiz("()Ljava/lang/Object;");
> + assert(cl); assert(runName); assert(runType);
> +
> + JavaMethod * meth = cl->lookupMethodDontThrow(runName, runType,
> false, true, 0);
> + assert(meth);
> +
> + res = meth->invokeJavaObjectVirtual(vm, cl, obj, obj);
> +
> + RETURN_FROM_JNI((jobject)th->pushJNIRef(res));
> +
> + END_JNI_EXCEPTION
> }
>
> JNIEXPORT jobject JNICALL
> JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls) {
> - NYI();
> + // No AccessControlContext supported yet
> + return NULL;
> }
>
>
> JNIEXPORT jobject JNICALL
> JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls) {
> - NYI();
> + // No AccessControlContext supported yet
> + return NULL;
> }
>
> /*
> --
> 1.7.5.1
> _______________________________________________
> vmkit-commits mailing list
> vmkit-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/vmkit-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/vmkit-commits/attachments/20111101/4d485ceb/attachment.html>
More information about the vmkit-commits
mailing list