diff --git a/fix-timehopping-in-freq_ctr_total.patch b/fix-timehopping-in-freq_ctr_total.patch new file mode 100644 index 0000000000000000000000000000000000000000..cb530f91b6d0f442ce52773e21bd5ca28690ce2e --- /dev/null +++ b/fix-timehopping-in-freq_ctr_total.patch @@ -0,0 +1,45 @@ +From 98d5efd1ebad89fbbbd866cdf58dbf1844f7ee70 Mon Sep 17 00:00:00 2001 +From: zhongxuan +Date: Thu, 5 Sep 2024 16:09:30 +0800 +Subject: [PATCH] fix timehopping in freq_ctr_total + +--- + src/freq_ctr.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/src/freq_ctr.c b/src/freq_ctr.c +index 747a4cc..a8021ad 100644 +--- a/src/freq_ctr.c ++++ b/src/freq_ctr.c +@@ -29,6 +29,7 @@ ullong freq_ctr_total(const struct freq_ctr *ctr, uint period, int pend) + { + ullong curr, past; + uint curr_tick; ++ uint toofar = 0; + int remain; + + for (;; __ha_cpu_relax()) { +@@ -56,13 +57,19 @@ ullong freq_ctr_total(const struct freq_ctr *ctr, uint period, int pend) + break; + }; + ++ if (((curr_tick + 2 * period) < global_now_ms) || ((global_now_ms + 2 * period) < curr_tick)) ++ toofar = 2; ++ else if (((curr_tick + period) < global_now_ms) || ((global_now_ms + period) < curr_tick)) ++ toofar = 1; ++ + remain = curr_tick + period - global_now_ms; +- if (unlikely(remain < 0)) { ++ if (unlikely(remain < 0 || toofar)) { + /* We're past the first period, check if we can still report a + * part of last period or if we're too far away. + */ ++ + remain += period; +- past = (remain >= 0) ? curr : 0; ++ past = (toofar != 2) ? curr : 0; + curr = 0; + } + +-- +2.33.0 \ No newline at end of file diff --git a/haproxy.spec b/haproxy.spec index cc478f17481f645d628f3470ec38811a88753392..06797056d88c539730595e25118296f7723c0ed5 100644 --- a/haproxy.spec +++ b/haproxy.spec @@ -5,7 +5,7 @@ Name: haproxy Version: 2.4.8 -Release: 7 +Release: 8 Summary: The Reliable, High Performance TCP/HTTP Load Balancer License: GPLv2+ @@ -24,6 +24,7 @@ Patch4: CVE-2023-0836.patch # https://github.com/haproxy/haproxy/commit/2eab6d354322932cfec2ed54de261e4347eca9a6 Patch5: CVE-2023-45539.patch Patch6: backport-BUG-MINOR-debug-enter-ha_panic-only-once.patch +Patch7: fix-timehopping-in-freq_ctr_total.patch BuildRequires: gcc lua-devel pcre2-devel openssl-devel systemd-devel systemd libatomic Requires(pre): shadow-utils @@ -127,6 +128,12 @@ exit 0 %{_mandir}/man1/* %changelog +* Mon Sep 23 2024 xinghe - 2.4.8-8 +- Type:bugfix +- ID:NA +- SUG:restart +- DESC:fix remain underspill in freq_ctr_total + * Mon Mar 11 2024 xinghe - 2.4.8-7 - Type:bugfix - ID:NA