Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 946971 Details for
Bug 1119147
(6.4.0) Security Manager related issue in Http11NioProtocol
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
NioEndpoint.java 7.5.x branch patch
NioEndpoint.diff (text/plain), 3.39 KB, created by
Dominik Pospisil
on 2014-10-14 16:59:44 UTC
(
hide
)
Description:
NioEndpoint.java 7.5.x branch patch
Filename:
MIME Type:
Creator:
Dominik Pospisil
Created:
2014-10-14 16:59:44 UTC
Size:
3.39 KB
patch
obsolete
>Index: NioEndpoint.java >=================================================================== >--- NioEndpoint.java (revision 2525) >+++ NioEndpoint.java (working copy) >@@ -28,6 +28,9 @@ > import java.nio.channels.CompletionHandler; > import java.nio.channels.WritePendingException; > import java.nio.file.StandardOpenOption; >+import java.security.AccessControlContext; >+import java.security.AccessController; >+import java.security.PrivilegedAction; > import java.util.concurrent.ConcurrentHashMap; > import java.util.concurrent.ConcurrentLinkedQueue; > import java.util.concurrent.ExecutorService; >@@ -42,6 +45,7 @@ > import org.apache.tomcat.util.net.NioEndpoint.Handler.SocketState; > import org.apache.tomcat.util.net.jsse.NioJSSESocketChannelFactory; > import org.jboss.web.CoyoteLogger; >+import sun.security.util.SecurityConstants; > > /** > * {@code NioEndpoint} NIO2 endpoint, providing the following services: >@@ -1190,6 +1194,9 @@ > private final String namePrefix; > private final int threadPriority; > >+ private final AccessControlContext acc; >+ private final ClassLoader ccl; >+ > /** > * Create a new instance of {@code DefaultThreadFactory} > * >@@ -1201,7 +1208,20 @@ > group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup(); > this.namePrefix = namePrefix; > this.threadPriority = threadPriority; >+ >+ SecurityManager sm = System.getSecurityManager(); >+ if (sm != null) { >+ // Calls to getContextClassLoader from this class >+ // never trigger a security check, but we check >+ // whether our callers have this permission anyways. >+ sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION); >+ >+ // Fail fast >+ sm.checkPermission(new RuntimePermission("setContextClassLoader")); > } >+ this.acc = AccessController.getContext(); >+ this.ccl = Thread.currentThread().getContextClassLoader(); >+ } > > /** > * >@@ -1216,16 +1236,32 @@ > /** > * Create and return a new thread > */ >- public Thread newThread(Runnable r) { >- Thread thread = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0); >- if (thread.isDaemon()) >+ public Thread newThread(final Runnable r) { >+ return AccessController.doPrivileged(new PrivilegedAction<Thread>() { >+ >+ @Override >+ public Thread run() { >+ Thread thread = new Thread(group, new Runnable() { >+ >+ @Override >+ public void run() { >+ Thread.currentThread().setContextClassLoader(ccl); >+ r.run(); >+ } >+ }, namePrefix + threadNumber.getAndIncrement(), 0); >+ if (thread.isDaemon()) { > thread.setDaemon(false); >+ } > >- if (thread.getPriority() != this.threadPriority) >- thread.setPriority(this.threadPriority); >+ if (thread.getPriority() != threadPriority) { >+ thread.setPriority(threadPriority); >+ } > return thread; > } >+ }, acc); >+ > } >+ } > > /** > * SendfileData class.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1119147
: 946971