Bug 963277 - Debugging Java Security Managers results in a StackOverflow on boot
Summary: Debugging Java Security Managers results in a StackOverflow on boot
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Security
Version: 6.1.0
Hardware: All
OS: All
urgent
high
Target Milestone: ER4
: EAP 6.1.1
Assignee: James Perkins
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-05-15 14:40 UTC by Jesse Sightler
Modified: 2013-09-16 20:20 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Known Issue
Doc Text:
Running with a security manager enabled and `-Djava.security.debug=access:failure` results in a StackOverflow error message and an unbootable JBoss Enterprise Application Platform instance. This problem occurs because the AccessControllercontext's debug output to the System streams causes an infinite loop while checking permissions. The root cause of this problem has been identified and it is expected to be fixed in a future release.
Clone Of:
Environment:
Last Closed: 2013-09-16 20:20:07 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Proposed patch (1.15 KB, patch)
2013-07-23 22:03 UTC, James Perkins
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 989606 0 unspecified CLOSED Upgrade jboss-stdio to 1.0.2.GA-redhat-1 2021-02-22 00:41:40 UTC
Red Hat Issue Tracker WFLY-1466 0 Critical Resolved Debugging Java Security Managers results in a StackOverflow on boot 2016-03-22 13:58:46 UTC

Internal Links: 989606

Description Jesse Sightler 2013-05-15 14:40:37 UTC
Description of problem:

Running with a security manager enabled and -Djava.security.debug=access:failure results in a StackOverflow and an unbootable JBoss instance.

This is a serious problem, as it makes debugging security policies nearly impossible, despite the fact that this is how our documentation instructs:

https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6-Beta/html-single/Security_Guide/index.html#Debug_Security_Manager_Policies

Comment 1 Dimitris Andreadis 2013-05-16 15:12:52 UTC
Assign the issue to James, since it seems to be logging related:
=============================================================================
we have investigated reported issue #963277. It is regression from EAP 
6.0.1and it seems the problem with security manager debugging is related 
to changes made in the logging subsystem:

https://github.com/jbossas/jboss-eap/commit/ebb13ca169871708c9e9913d2ba2ff455b7acffe
https://github.com/jbossas/jboss-eap/commit/526c2ae7a4194dc6b787c32c5218cea003276900

The AccessControllercontext's debug output to System streams causes infinite loop of checking permissions now. Maybe an additional doPrivileged block could help.

...
	at java.lang.Class.getClassLoader(Class.java:613)
	at org.jboss.logmanager.ClassLoaderLogContextSelector.getLogContext(ClassLoaderLogContextSelector.java:84)
	at org.jboss.logmanager.ThreadLocalLogContextSelector.getLogContext(ThreadLocalLogContextSelector.java:58)
	at org.jboss.logmanager.LogContext.getLogContext(LogContext.java:290)
	at org.jboss.as.logging.stdio.LogContextStdioContextSelector.getStdioContext(LogContextStdioContextSelector.java:49)
	at org.jboss.stdio.StdioContext$2.getDelegate(StdioContext.java:151)
	at org.jboss.stdio.StdioContext$DelegatingPrintStream.println(StdioContext.java:297)
	at sun.security.util.Debug.println(Debug.java:154)
	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372)
	at java.security.AccessController.checkPermission(AccessController.java:560)
	at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
	at java.lang.Class.getClassLoader(Class.java:613)
	at org.jboss.logmanager.ClassLoaderLogContextSelector.getLogContext(ClassLoaderLogContextSelector.java:84)
	at org.jboss.logmanager.ThreadLocalLogContextSelector.getLogContext(ThreadLocalLogContextSelector.java:58)
...

We took a look at the problem reported as #963279 and we didn't find any 
similar bug reported formerly or any information that bug is repaired in 
EAP 6.1.0. It's not regression because it has same behavior in EAP 6.0.1.

QE recommendation:
Issue #963277 is related to debugging. If Ericsson doesn'tuse Security 
Manager, we should not block release because of this issue. If Ericsson 
uses Security Manager, we should get feedback from themabout this issue. 
We should document this issue as known issue and release fix for it as 
one-off right after ga release.

Additional test casesfor security managerare planned for EAP 6.2.0 
release for Common Criteria certification.In tests plan for EAP 6.1.0 we 
have AS TS execution with security manager, all tests passed. We are 
going to include test case for this scenario into test plans for EAP 
6.2.0 release.

Pavel
=============================================================================

Comment 2 James Perkins 2013-05-17 20:44:47 UTC
Any chance an example security policy could be attached? I tried the one on #963279 but I didn't get the stack overflow. I also don't get to the point where EAP boots either.

Comment 3 Jesse Sightler 2013-05-19 19:08:43 UTC
It is the same security policy. If it is not booting, perhaps there is some difference in the stack size? I suspect the failure to boot has the same root-cause.

One of my coworkers also saw this symptom (hang instead of five minute hang followed by stacktrace). I haven't been able to determine what is causing the difference.

Comment 8 JBoss JIRA Server 2013-07-23 14:13:11 UTC
David Lloyd <david.lloyd> updated the status of jira WFLY-1466 to Resolved

Comment 9 JBoss JIRA Server 2013-07-23 14:13:11 UTC
David Lloyd <david.lloyd> made a comment on jira WFLY-1466

The proper way to use a security manager in WildFly is to configure the security manager extension, which also gives you detailed (better) debug logging of permission violations.

Comment 10 James Perkins 2013-07-23 22:03:54 UTC
Created attachment 777491 [details]
Proposed patch

Upgrades the jboss-stdio library which contains a patch to check for reentrancy on the output stream. The jboss-stdio PR was https://github.com/jboss-logging/jboss-stdio/pull/3

Comment 14 Scott Mumford 2013-08-21 03:53:17 UTC
Requesting confirmation that this is no longer a Known Issue and that the above docs text should be listed as Bug Fix and the text rewritten accordingly.

If so, what fix was implemented, and how does the product behave now under those circumstances?

Comment 15 Scott Mumford 2013-08-26 00:53:23 UTC
Setting for exclusion from 6.1.1 Release notes and removing NEEDINFO request.

Comment 16 James Perkins 2013-08-26 17:05:36 UTC
I'm not sure the docs are quite right here. The issue was with how we wrapped stderr and stdout. We used JBoss STDIO which invoked a checks to the security manager from JBoss Log Manager. It was fixed by checking for reentrancy in STDIO.


Note You need to log in before you can comment on or make changes to this bug.