From 803dc2e41ef7526276d309ef7a73b36a5d3c339cfd9bc0cfa88c90e58699af20 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Thu, 20 Oct 2022 16:18:49 +0000 Subject: [PATCH] Accepting request 1030223 from home:mbussolotto:branches:Java:packages - Fixed CVEs: * CVE-2021-43980: Improve the recycling of Processor objects to make it more robust. (bsc#1203868) - Added patches: * tomcat-9.0.43-CVE-2021-43980.patch OBS-URL: https://build.opensuse.org/request/show/1030223 OBS-URL: https://build.opensuse.org/package/show/Java:packages/tomcat?expand=0&rev=244 --- tomcat-9.0.43-CVE-2021-43980.patch | 181 +++++++++++++++++++++++++++++ tomcat.spec | 2 + 2 files changed, 183 insertions(+) create mode 100644 tomcat-9.0.43-CVE-2021-43980.patch diff --git a/tomcat-9.0.43-CVE-2021-43980.patch b/tomcat-9.0.43-CVE-2021-43980.patch new file mode 100644 index 0000000..b667c46 --- /dev/null +++ b/tomcat-9.0.43-CVE-2021-43980.patch @@ -0,0 +1,181 @@ +From 170e0f792bd18ff031677890ba2fe50eb7a376c1 Mon Sep 17 00:00:00 2001 +From: Mark Thomas +Date: Tue, 29 Mar 2022 19:15:37 +0100 +Subject: [PATCH] Improve the recycling of Processor objects to make it more + robust. + +--- + java/org/apache/coyote/AbstractProtocol.java | 32 ++++++++++--------- + .../tomcat/util/net/SocketWrapperBase.java | 17 +++++++--- + webapps/docs/changelog.xml | 4 +++ + 3 files changed, 33 insertions(+), 20 deletions(-) + +Index: apache-tomcat-9.0.43-src/java/org/apache/coyote/AbstractProtocol.java +=================================================================== +--- apache-tomcat-9.0.43-src.orig/java/org/apache/coyote/AbstractProtocol.java ++++ apache-tomcat-9.0.43-src/java/org/apache/coyote/AbstractProtocol.java +@@ -794,7 +794,11 @@ public abstract class AbstractProtocol socketWrapper) { +- Processor processor = (Processor) socketWrapper.getCurrentProcessor(); +- socketWrapper.setCurrentProcessor(null); ++ Processor processor = (Processor) socketWrapper.takeCurrentProcessor(); + release(processor); + } + +Index: apache-tomcat-9.0.43-src/java/org/apache/tomcat/util/net/SocketWrapperBase.java +=================================================================== +--- apache-tomcat-9.0.43-src.orig/java/org/apache/tomcat/util/net/SocketWrapperBase.java ++++ apache-tomcat-9.0.43-src/java/org/apache/tomcat/util/net/SocketWrapperBase.java +@@ -29,6 +29,7 @@ import java.util.concurrent.RejectedExec + import java.util.concurrent.Semaphore; + import java.util.concurrent.TimeUnit; + import java.util.concurrent.atomic.AtomicBoolean; ++import java.util.concurrent.atomic.AtomicReference; + + import org.apache.juli.logging.Log; + import org.apache.juli.logging.LogFactory; +@@ -104,10 +105,12 @@ public abstract class SocketWrapperBase< + protected volatile OperationState writeOperation = null; + + /** +- * The org.apache.coyote.Processor instance currently associated +- * with the wrapper. ++ * The org.apache.coyote.Processor instance currently associated with the ++ * wrapper. Only populated when required to maintain wrapper<->Processor ++ * mapping between calls to ++ * {@link AbstractEndpoint.Handler#process(SocketWrapperBase, SocketEvent)}. + */ +- protected Object currentProcessor = null; ++ private final AtomicReference currentProcessor = new AtomicReference<>(); + + public SocketWrapperBase(E socket, AbstractEndpoint endpoint) { + this.socket = socket; +@@ -134,11 +137,15 @@ public abstract class SocketWrapperBase< + } + + public Object getCurrentProcessor() { +- return currentProcessor; ++ return currentProcessor.get(); + } + + public void setCurrentProcessor(Object currentProcessor) { +- this.currentProcessor = currentProcessor; ++ this.currentProcessor.set(currentProcessor); ++ } ++ ++ public Object takeCurrentProcessor() { ++ return currentProcessor.getAndSet(null); + } + + /** +Index: apache-tomcat-9.0.43-src/webapps/docs/changelog.xml +=================================================================== +--- apache-tomcat-9.0.43-src.orig/webapps/docs/changelog.xml ++++ apache-tomcat-9.0.43-src/webapps/docs/changelog.xml +@@ -485,6 +485,10 @@ + Fix a concurrency issue in the NIO connector that could cause newly + created connections to be removed from the poller. (markt) + ++ ++ Improve the recycling of Processor objects to make it more robust. ++ (markt) ++ + + + diff --git a/tomcat.spec b/tomcat.spec index a38bf65..cc57f1c 100644 --- a/tomcat.spec +++ b/tomcat.spec @@ -88,6 +88,7 @@ Patch9: tomcat-9.0-CVE-2021-30640.patch Patch10: tomcat-9.0-NPE-JNDIRealm.patch Patch11: tomcat-9.0-CVE-2022-23181.patch Patch12: tomcat-9.0-hardening_getResources.patch +Patch13: tomcat-9.0.43-CVE-2021-43980.patch BuildRequires: ant >= 1.8.1 BuildRequires: ant-antlr @@ -266,6 +267,7 @@ find . -type f \( -name "*.bat" -o -name "*.class" -o -name Thumbs.db -o -name " %patch10 -p1 %patch11 -p1 %patch12 -p1 +%patch13 -p1 # remove date from docs sed -i -e '/build-date/ d' webapps/docs/tomcat-docs.xsl