Resolves: RHEL-137799 - Squid memory usage increases until OOM.

This commit is contained in:
Luboš Uhliarik 2026-01-16 22:29:32 +01:00
parent efc51767d6
commit 91c38005eb
2 changed files with 78 additions and 1 deletions

View File

@ -0,0 +1,71 @@
diff --git a/src/StoreClient.h b/src/StoreClient.h
index 942f9fc..da97e21 100644
--- a/src/StoreClient.h
+++ b/src/StoreClient.h
@@ -163,12 +163,12 @@ private:
public:
struct Callback {
- Callback ():callback_handler(NULL), callback_data(NULL) {}
+ Callback() = default;
Callback (STCB *, void *);
bool pending() const;
- STCB *callback_handler;
- void *callback_data;
+ STCB *callback_handler = nullptr; ///< where to deliver the answer
+ CallbackData cbData; ///< the first STCB callback parameter
AsyncCall::Pointer notifier;
} _callback;
};
diff --git a/src/store_client.cc b/src/store_client.cc
index b09f78a..497ea50 100644
--- a/src/store_client.cc
+++ b/src/store_client.cc
@@ -127,14 +127,14 @@ store_client::finishCallback()
++answers;
STCB *temphandler = _callback.callback_handler;
- void *cbdata = _callback.callback_data;
- _callback = Callback(nullptr, nullptr);
+ const auto cbdata = _callback.cbData.validDone();
+ _callback.~Callback();
+ new (&_callback) Callback();
copyInto.data = nullptr;
- if (cbdataReferenceValid(cbdata))
+ if (cbdata)
temphandler(cbdata, result);
- cbdataReferenceDone(cbdata);
}
store_client::store_client(StoreEntry *e) :
@@ -194,7 +194,8 @@ store_client::copy(StoreEntry * anEntry,
#endif
assert(!_callback.pending());
- _callback = Callback (callback_fn, cbdataReference(data));
+ _callback.~Callback();
+ new (&_callback) Callback(callback_fn, data);
copyInto.data = copyRequest.data;
copyInto.length = copyRequest.length;
copyInto.offset = copyRequest.offset;
@@ -1050,7 +1051,7 @@ store_client::dumpStats(MemBuf * output, int clientNumber) const
if (_callback.pending())
return;
- output->appendf("\tClient #%d, %p\n", clientNumber, _callback.callback_data);
+ output->appendf("\tClient #%d, %p\n", clientNumber, this);
output->appendf("\t\tcopy_offset: %" PRId64 "\n", copyInto.offset);
output->appendf("\t\tcopy_size: %" PRIuSIZE "\n", copyInto.length);
output->append("\t\tflags:", 8);
@@ -1073,7 +1074,7 @@ store_client::Callback::pending() const
return callback_handler && !notifier;
}
-store_client::Callback::Callback(STCB *function, void *data) : callback_handler(function), callback_data (data) {}
+store_client::Callback::Callback(STCB *function, void *data) : callback_handler(function), cbData (data) {}
#if USE_DELAY_POOLS
int

View File

@ -2,7 +2,7 @@
Name: squid
Version: 4.15
Release: 10%{?dist}.11
Release: 10%{?dist}.12
Summary: The Squid proxy caching server
Epoch: 7
# See CREDITS for breakdown of non GPLv2+ code
@ -44,6 +44,8 @@ Patch210: squid-4.15-halfclosed.patch
Patch211: squid-4.15-dns-obey-ttl-set-to-zero.patch
# https://issues.redhat.com/browse/RHEL-57030
Patch212: squid-4.15-fatal-read-data-from-mem.patch
# https://issues.redhat.com/browse/RHEL-50261
Patch213: squid-4.15-store-client-leak-fix.patch
# Security fixes
# https://bugzilla.redhat.com/show_bug.cgi?id=1941506
@ -168,6 +170,7 @@ lookup program (dnsserver), a program for retrieving FTP data
# patch305 follow-up
%patch212 -p1 -b .fatal-read-data-from-mem
%patch213 -p1 -b .store-client-mem-leak
# https://bugzilla.redhat.com/show_bug.cgi?id=1679526
# Patch in the vendor documentation and used different location for documentation
@ -384,6 +387,9 @@ fi
%changelog
* Tue Jul 14 2026 Luboš Uhliarik <luhliari@redhat.com> - 7:4.15-10.12
- Resolves: RHEL-137799 - Squid memory usage increases until OOM.
* Wed Apr 08 2026 Tomas Korbar <tkorbar@redhat.com> - 7:4.15-10.11
- Fix patch for CVE-2026-32748
- Resolves: RHEL-160675