Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2017-05-10 17:18:43 -0400
committerThomas Watson2017-05-10 17:18:43 -0400
commit380bd66fdf3e4cfa35e3a2ee0d81a99456bd42d1 (patch)
tree75f599c24715cdfa1573642e036ef774230934e5
parente2ecaa140f5e40cb2ab1e4535bb7d47d1e4d1b53 (diff)
downloadrt.equinox.framework-380bd66fdf3e4cfa35e3a2ee0d81a99456bd42d1.tar.gz
rt.equinox.framework-380bd66fdf3e4cfa35e3a2ee0d81a99456bd42d1.tar.xz
rt.equinox.framework-380bd66fdf3e4cfa35e3a2ee0d81a99456bd42d1.zip
Bug 516069 - reflection code to create permission objects should beI20170510-2000
protected with doPriv Need to protect ClassLoaderHook::classLoaderCreated with doPriv also. Change-Id: I8160a30acf938171b563a2853130f99f645a47c5 Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java
index 18833c4b1..86be6744c 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2016 IBM Corporation and others.
+ * Copyright (c) 2004, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -250,9 +250,18 @@ public class BundleLoader extends ModuleLoader {
// and endless loop if the hook causes re-entry (that would be a bad hook impl)
classLoaderCreated = result;
// only send to hooks if this thread wins in creating the class loader.
- for (ClassLoaderHook hook : hooks) {
- hook.classLoaderCreated(result);
- }
+ final ModuleClassLoader cl = result;
+ // protect with doPriv to avoid bubbling up permission checks that hooks may require
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ for (ClassLoaderHook hook : hooks) {
+ hook.classLoaderCreated(cl);
+ }
+ return null;
+ }
+
+ });
// finally set the class loader for use after calling hooks
classloader = classLoaderCreated;
} else {

Back to the top