From 8666908bf19dcf9148d54a066abe849e446512f4 Mon Sep 17 00:00:00 2001 From: zhaosai Date: Tue, 19 Nov 2024 19:58:46 +0800 Subject: [PATCH] fix race condition --- ...on-that-may-make-the-bucket-cleaning.patch | 49 +++++++++++++++++++ jetty.spec | 8 ++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 0001-fix-race-condition-that-may-make-the-bucket-cleaning.patch diff --git a/0001-fix-race-condition-that-may-make-the-bucket-cleaning.patch b/0001-fix-race-condition-that-may-make-the-bucket-cleaning.patch new file mode 100644 index 0000000..11ed07f --- /dev/null +++ b/0001-fix-race-condition-that-may-make-the-bucket-cleaning.patch @@ -0,0 +1,49 @@ +From 415196520ecf798121c6e3e85cc7f64e7d74918c Mon Sep 17 00:00:00 2001 +From: Ludovic Orban +Date: Wed, 9 Dec 2020 10:38:32 +0100 +Subject: [PATCH] fix race condition that may make the bucket cleaning pick the + wrong one in case the timestamp is read while being modified + +--- + .../src/main/java/org/eclipse/jetty/io/ByteBufferPool.java | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferPool.java b/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferPool.java +index a78644ae9723..5d78be85fb9e 100644 +--- a/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferPool.java ++++ b/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferPool.java +@@ -24,6 +24,7 @@ + import java.util.List; + import java.util.concurrent.ConcurrentLinkedDeque; + import java.util.concurrent.atomic.AtomicInteger; ++import java.util.concurrent.atomic.AtomicLong; + import java.util.function.Consumer; + + import org.eclipse.jetty.util.BufferUtil; +@@ -158,7 +159,7 @@ class Bucket + private final int _capacity; + private final int _maxSize; + private final AtomicInteger _size; +- private long _lastUpdate = System.nanoTime(); ++ private final AtomicLong _lastUpdate = new AtomicLong(System.nanoTime()); + + public Bucket(ByteBufferPool pool, int capacity, int maxSize) + { +@@ -196,7 +197,7 @@ public ByteBuffer acquire(boolean direct) + + public void release(ByteBuffer buffer) + { +- _lastUpdate = System.nanoTime(); ++ _lastUpdate.lazySet(System.nanoTime()); + BufferUtil.clear(buffer); + if (_size == null) + queueOffer(buffer); +@@ -251,7 +252,7 @@ int size() + + long getLastUpdate() + { +- return _lastUpdate; ++ return _lastUpdate.get(); + } + + @Override diff --git a/jetty.spec b/jetty.spec index e542164..6bcecb9 100644 --- a/jetty.spec +++ b/jetty.spec @@ -12,7 +12,7 @@ %bcond_with jp_minimal Name: jetty Version: 9.4.16 -Release: 8 +Release: 9 Summary: Java Webserver and Servlet Container License: Apache-2.0 OR EPL-1.0 URL: http://www.eclipse.org/jetty/ @@ -34,6 +34,8 @@ Patch9: CVE-2023-36479.patch Patch10: CVE-2023-40167.patch Patch11: CVE-2024-6762.patch +Patch1000: 0001-fix-race-condition-that-may-make-the-bucket-cleaning.patch + BuildRequires: maven-local mvn(javax.servlet:javax.servlet-api) < 4.0.0 BuildRequires: mvn(org.apache.felix:maven-bundle-plugin) BuildRequires: mvn(org.apache.maven.plugins:maven-shade-plugin) @@ -801,6 +803,10 @@ exit 0 %license LICENSE NOTICE.txt LICENSE-MIT %changelog +* Tue Nov 19 2024 zhaosaisai - 9.4.16-9 +- fix race condition that may make the bucket cleaning pick the +wrong one in case the timestamp is read while being modified + * Tue Nov 05 2024 yaoxin - 9.4.16-8 - Fix CVE-2024-6762 -- Gitee