You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Piotr Karwasz (Jira)" <ji...@apache.org> on 2022/09/03 06:54:00 UTC

[jira] [Updated] (LOG4J2-3579) log4j2 2.18.0 ServiceLoaderUtil broken with SecurityManager enabled

     [ https://issues.apache.org/jira/browse/LOG4J2-3579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Piotr Karwasz updated LOG4J2-3579:
----------------------------------
    Fix Version/s: 2.19.0

> log4j2 2.18.0 ServiceLoaderUtil broken with SecurityManager enabled
> -------------------------------------------------------------------
>
>                 Key: LOG4J2-3579
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3579
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 2.18.0
>            Reporter: Boris Unckel
>            Priority: Critical
>             Fix For: 2.19.0
>
>
> The new [ServiceLoaderUtil|https://github.com/apache/logging-log4j2/commits/log4j-2.18.0-rc1/log4j-api/src/main/java/org/apache/logging/log4j/util/ServiceLoaderUtil.java] causes a Java Security Manager regression in WildFly. The current version 2.17.2 works fine in integration tests, 2.18.0 breaks
> See https://github.com/wildfly/wildfly-core/pull/5187
> {noformat}
> java.lang.AssertionError: Failed to deploy logging1.jar: 10 assets: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"logging1.jar\".INSTALL" => "WFLYSRV0153: Failed to process phase INSTALL of deployment \"logging1.jar\"
>     Caused by: java.util.ServiceConfigurationError: org.jboss.msc.service.ServiceActivator: Provider org.jboss.as.test.integration.logging.Log4j2ServiceActivator could not be instantiated
>     Caused by: java.lang.ExceptionInInitializerError
>     Caused by: java.security.AccessControlException: WFSM000001: Permission check failed (permission \"(\"java.io.FilePermission\" \"/store/repository/org/apache/logging/log4j/log4j-api/2.18.0/log4j-api-2.18.0.jar\" \"read\")\" in code source \"(vfs:/content/logging1.jar <no signer certificates>)\" of \"ModuleClassLoader for Module \"deployment.logging1.jar\" from Service Module Loader\")"}}
> java.lang.AssertionError: 
> Failed to deploy logging1.jar: 10 assets: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"logging1.jar\".INSTALL" => "WFLYSRV0153: Failed to process phase INSTALL of deployment \"logging1.jar\"
>     Caused by: java.util.ServiceConfigurationError: org.jboss.msc.service.ServiceActivator: Provider org.jboss.as.test.integration.logging.Log4j2ServiceActivator could not be instantiated
>     Caused by: java.lang.ExceptionInInitializerError
>     Caused by: java.security.AccessControlException: WFSM000001: Permission check failed (permission \"(\"java.io.FilePermission\" \"/store/repository/org/apache/logging/log4j/log4j-api/2.18.0/log4j-api-2.18.0.jar\" \"read\")\" in code source \"(vfs:/content/logging1.jar <no signer certificates>)\" of \"ModuleClassLoader for Module \"deployment.logging1.jar\" from Service Module Loader\")"}}
> 	at org.junit.Assert.fail(Assert.java:89)
> 	at org.jboss.as.test.integration.logging.AbstractLoggingTestCase.deploy(AbstractLoggingTestCase.java:210)
> 	at org.jboss.as.test.integration.logging.profiles.AbstractLoggingProfilesTestCase.deploy(AbstractLoggingProfilesTestCase.java:332)
> 	at org.jboss.as.test.integration.logging.profiles.AbstractLoggingProfilesTestCase.deploy(AbstractLoggingProfilesTestCase.java:321)
> 	at org.jboss.as.test.integration.logging.profiles.AbstractLoggingProfilesTestCase.testProfiles(AbstractLoggingProfilesTestCase.java:202)
> 	at org.jboss.as.test.integration.logging.profiles.Log4j2LoggingProfilesTestCase.testProfiles(Log4j2LoggingProfilesTestCase.java:36)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:498)
> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
> 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
> 	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
> 	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
> 	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
> 	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
> 	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
> 	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
> 	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
> 	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
> 	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
> 	at org.wildfly.core.testrunner.WildflyTestRunner.run(WildflyTestRunner.java:157)
> 	at org.junit.runners.Suite.runChild(Suite.java:128)
> 	at org.junit.runners.Suite.runChild(Suite.java:27)
> 	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
> 	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
> 	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
> 	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
> 	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
> 	at org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55)
> 	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137)
> 	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:107)
> 	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:83)
> 	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75)
> 	at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:158)
> 	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
> 	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
> 	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
> 	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
> ------- Stdout: -------
> &amp#27;[0m09:52:14,090 INFO  [org.jboss.as.repository] (management-handler-thread - 1) WFLYDR0001: Content added at location /opt/buildAgent/work/5530730b3ac6f17/testsuite/standalone/target/wildfly-core/standalone/data/content/a0/6329c7f288bbaf888f31165cf1240047c48852/content
> &amp#27;[0m&amp#27;[0m09:52:14,092 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "logging1.jar" (runtime-name: "logging1.jar")
> &amp#27;[0m&amp#27;[31m09:52:14,131 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."logging1.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."logging1.jar".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "logging1.jar"
> 	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:189)
> 	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
> 	at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
> 	at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
> 	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
> 	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
> 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
> 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
> 	at java.lang.Thread.run(Thread.java:750)
> Caused by: java.util.ServiceConfigurationError: org.jboss.msc.service.ServiceActivator: Provider org.jboss.as.test.integration.logging.Log4j2ServiceActivator could not be instantiated
> 	at java.util.ServiceLoader.fail(ServiceLoader.java:232)
> 	at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
> 	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
> 	at java.util.ServiceLoader$LazyIterator.access$700(ServiceLoader.java:323)
> 	at java.util.ServiceLoader$LazyIterator$2.run(ServiceLoader.java:407)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:409)
> 	at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
> 	at org.jboss.as.server.deployment.service.ServiceActivatorProcessor.deploy(ServiceActivatorProcessor.java:87)
> 	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:182)
> 	... 8 more
> Caused by: java.lang.ExceptionInInitializerError
> 	at org.apache.logging.log4j.util.Strings.<clinit>(Strings.java:47)
> 	at org.apache.logging.log4j.Level.<init>(Level.java:132)
> 	at org.apache.logging.log4j.Level.<clinit>(Level.java:83)
> 	at org.jboss.as.test.integration.logging.Log4j2ServiceActivator.<clinit>(Log4j2ServiceActivator.java:48)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
> 	at java.lang.Class.newInstance(Class.java:442)
> 	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
> 	... 15 more
> Caused by: java.security.AccessControlException: WFSM000001: Permission check failed (permission "("java.io.FilePermission" "/store/repository/org/apache/logging/log4j/log4j-api/2.18.0/log4j-api-2.18.0.jar" "read")" in code source "(vfs:/content/logging1.jar <no signer certificates>)" of "ModuleClassLoader for Module "deployment.logging1.jar" from Service Module Loader")
> 	at org.wildfly.security.manager.WildFlySecurityManager.checkPermission(WildFlySecurityManager.java:309)
> 	at org.wildfly.security.manager.WildFlySecurityManager.checkPermission(WildFlySecurityManager.java:201)
> 	at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
> 	at org.wildfly.security.manager.WildFlySecurityManager.checkRead(WildFlySecurityManager.java:374)
> 	at sun.net.www.protocol.jar.JarFileFactory.getCachedJarFile(JarFileFactory.java:137)
> 	at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:81)
> 	at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
> 	at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:152)
> 	at java.net.URL.openStream(URL.java:1093)
> 	at java.util.ServiceLoader.parse(ServiceLoader.java:304)
> 	at java.util.ServiceLoader.access$200(ServiceLoader.java:185)
> 	at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:357)
> 	at java.util.ServiceLoader$LazyIterator.access$600(ServiceLoader.java:323)
> 	at java.util.ServiceLoader$LazyIterator$1.run(ServiceLoader.java:396)
> 	at java.util.ServiceLoader$LazyIterator$1.run(ServiceLoader.java:395)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:398)
> 	at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:474)
> 	at org.apache.logging.log4j.util.ServiceLoaderUtil$ServiceLoaderSpliterator.tryAdvance(ServiceLoaderUtil.java:132)
> 	at java.util.Spliterator.forEachRemaining(Spliterator.java:326)
> 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
> 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
> 	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
> 	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
> 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> 	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
> 	at org.apache.logging.log4j.util.PropertiesUtil$Environment.<init>(PropertiesUtil.java:462)
> 	at org.apache.logging.log4j.util.PropertiesUtil$Environment.<init>(PropertiesUtil.java:434)
> 	at org.apache.logging.log4j.util.PropertiesUtil.<init>(PropertiesUtil.java:88)
> 	at org.apache.logging.log4j.util.PropertiesUtil.<init>(PropertiesUtil.java:80)
> 	at org.apache.logging.log4j.util.PropertiesUtil.<clinit>(PropertiesUtil.java:56)
> 	... 25 more
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)