This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new ef1f4ee2b3 Fix BZ 66294. Make use of privileged block optional.
Performance hotspot
ef1f4ee2b3 is described below
commit ef1f4ee2b3e9a83a857e3fbc94b5a0ce60ce9df1
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Nov 8 13:16:32 2022 +0000
Fix BZ 66294. Make use of privileged block optional. Performance hotspot
https://bz.apache.org/bugzilla/show_bug.cgi?id=66294
---
java/javax/el/Util.java | 5 ++++-
webapps/docs/changelog.xml | 7 +++++++
webapps/docs/config/systemprops.xml | 9 +++++++++
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/java/javax/el/Util.java b/java/javax/el/Util.java
index 8fdc2bb22f..e1ae0851c0 100644
--- a/java/javax/el/Util.java
+++ b/java/javax/el/Util.java
@@ -42,6 +42,9 @@ class Util {
private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class<?>[0];
private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
+ private static final boolean GET_CLASSLOADER_USE_PRIVILEGED =
+ Boolean.getBoolean("org.apache.el.GET_CLASSLOADER_USE_PRIVILEGED");
+
/**
* Checks whether the supplied Throwable is one that needs to be
* rethrown and swallows all others.
@@ -647,7 +650,7 @@ class Util {
static ClassLoader getContextClassLoader() {
ClassLoader tccl;
- if (System.getSecurityManager() != null) {
+ if (System.getSecurityManager() != null &&
GET_CLASSLOADER_USE_PRIVILEGED) {
PrivilegedAction<ClassLoader> pa = new PrivilegedGetTccl();
tccl = AccessController.doPrivileged(pa);
} else {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 76df264394..41ee170f56 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -159,6 +159,13 @@
</subsection>
<subsection name="Jasper">
<changelog>
+ <fix>
+ <bug>66294</bug>: Make the use of a privileged block to obtain the
+ thread context class loader added to address <bug>62080</bug> optional
+ and disabled by default. This is now controlled by the
+ <code>org.apache.el.GET_CLASSLOADER_USE_PRIVILEGED</code> system
+ property. (markt)
+ </fix>
<fix>
<bug>66325</bug>: Fix concurrency issue in evaluation of expression
language containing lambda expressions. (markt)
diff --git a/webapps/docs/config/systemprops.xml
b/webapps/docs/config/systemprops.xml
index 1dbf0baed0..71420b234b 100644
--- a/webapps/docs/config/systemprops.xml
+++ b/webapps/docs/config/systemprops.xml
@@ -89,6 +89,15 @@
<section name="Expression Language">
<properties>
+ <property name="org.apache.el. GET_CLASSLOADER_USE_PRIVILEGED">
+ <p>Controls whether the EL API classes make use of a privileged block to
+ obtain the thread context class loader. When using the EL API within
+ Apache Tomcat this does not need to be set as all calls are already
+ wrapped in a privileged block further up the stack. It may be required if
+ using the EL API under a SecurityManager outside of Apache Tomcat.</p>
+ <p>If not specified, the default of <code>false</code> will be used.</p>
+ </property>
+
<property name="org.apache.el.BeanELResolver. CACHE_SIZE">
<p>The number of javax.el.BeanELResolver.BeanProperties objects that will
be cached by the EL Parser.</p>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]