fix leak in config reload
This commit is contained in:
parent
f60d97e3f5
commit
942522a122
37
fix-leak-in-config-reload.patch
Normal file
37
fix-leak-in-config-reload.patch
Normal file
@ -0,0 +1,37 @@
|
||||
From b4db7c3855c22c5b6cfcbabffd760e1808144e2e Mon Sep 17 00:00:00 2001
|
||||
From: dormando <dormando@rydia.net>
|
||||
Date: Sun, 10 Mar 2024 10:17:24 -0700
|
||||
Subject: [PATCH] proxy: fix leak in config reload
|
||||
|
||||
- config reload loads the code from disk, then dumps it into an internal
|
||||
binary blob
|
||||
- that binary blob is loaded from memory into each worker thread
|
||||
- that temporary blob wasn't being freed
|
||||
|
||||
if you have large initial lua and reload every second for hours on end
|
||||
you'd leak a few megs of ram
|
||||
|
||||
---
|
||||
proxy_config.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/proxy_config.c b/proxy_config.c
|
||||
index cfe43b1..65e7e3a 100644
|
||||
--- a/proxy_config.c
|
||||
+++ b/proxy_config.c
|
||||
@@ -240,6 +240,12 @@ int proxy_load_config(void *arg) {
|
||||
db->buf = malloc(db->size);
|
||||
lua_dump(L, _dump_helper, db, 0);
|
||||
// 0 means no error.
|
||||
+ if (ctx->proxy_code) {
|
||||
+ struct _dumpbuf *old = ctx->proxy_code;
|
||||
+ free(old->buf);
|
||||
+ free(old);
|
||||
+ ctx->proxy_code = NULL;
|
||||
+ }
|
||||
ctx->proxy_code = db;
|
||||
|
||||
// now we complete the data load by calling the function.
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
Name: memcached
|
||||
Version: 1.6.22
|
||||
Release: 1
|
||||
Release: 2
|
||||
Epoch: 0
|
||||
Summary: A high-performance, distributed memory object caching system
|
||||
License: BSD-3-Clause
|
||||
@ -17,6 +17,7 @@ Source1: https://releases.pagure.org/memcached-selinux/memcached-selinux-1
|
||||
Source2: memcached.sysconfig
|
||||
|
||||
Patch0001: memcached-unit.patch
|
||||
Patch0002: fix-leak-in-config-reload.patch
|
||||
|
||||
BuildRequires: systemd perl-generators perl(Test::More) perl(Test::Harness)
|
||||
BuildRequires: selinux-policy-devel libevent-devel make gcc
|
||||
@ -62,6 +63,7 @@ optimised for use with this version of memcached.
|
||||
%prep
|
||||
%setup -q -b 1
|
||||
%patch1 -p1 -b .unit
|
||||
%patch2 -p1 -b .reload
|
||||
|
||||
%build
|
||||
%configure \
|
||||
@ -144,6 +146,9 @@ fi
|
||||
%{_mandir}/man1/memcached.1*
|
||||
|
||||
%changelog
|
||||
* Thu Jun 06 2024 yanshuai <yanshuai01@kylinos.cn> - 0:1.6.22-2
|
||||
- proxy: fix leak in config reload
|
||||
|
||||
* Thu Nov 02 2023 wangkai <13474090681@163.com> - 0:1.6.22-1
|
||||
- Update to 1.6.22 for fix CVE-2023-46852,CVE-2023-46853
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user