]> dgit.raspbian.org Git - dovecot.git/commitdiff
[PATCH] lib-sieve: Reduce CPU limit check interval in :contains and :matches matchers
authorAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 25 May 2026 14:54:03 +0000 (14:54 +0000)
committerNoah Meyerhans <noahm@debian.org>
Wed, 16 Sep 2026 19:06:35 +0000 (15:06 -0400)
Reduce the interval to 64 so worst-case work between checks is ~64 MiB.
cpu_limit_exceeded() is a signal-counter comparison with no syscall, so
the higher call frequency has no measurable cost.

Gbp-Pq: Name 0008-lib-sieve-Reduce-CPU-limit-check-interval-in-contain.patch

pigeonhole/src/lib-sieve/mcht-contains.c
pigeonhole/src/lib-sieve/mcht-matches.c

index b0773517f6ea30af961c53cd895b1de51e0b15ea..21a35121fe65323a68d18746e69a133cd2740caa 100644 (file)
@@ -45,7 +45,7 @@ const struct sieve_match_type_def contains_match_type = {
  * configured sieve_max_cpu_time (which is otherwise only checked between
  * bytecode operations).
  */
-#define SIEVE_CONTAINS_CPU_CHECK_INTERVAL 4096
+#define SIEVE_CONTAINS_CPU_CHECK_INTERVAL 64
 
 static int mcht_contains_match_key
 (struct sieve_match_context *mctx, const char *val, size_t val_size,
index 3ddf769dec502f73f7cf4e239e7c6e6fa4b1aad0..1c21425a2ac8e8737f00cd29ed198c12c31209b7 100644 (file)
@@ -53,7 +53,7 @@ const struct sieve_match_type_def matches_match_type = {
  * configured sieve_max_cpu_time. Returns 1 on match, 0 on exhaustion, or -1
  * when the CPU time limit was exceeded (mctx->exec_status is set).
  */
-#define SIEVE_MATCHES_CPU_CHECK_INTERVAL 4096
+#define SIEVE_MATCHES_CPU_CHECK_INTERVAL 64
 
 static int
 _string_find(struct sieve_match_context *mctx,