From: Aki Tuomi Date: Mon, 25 May 2026 14:54:03 +0000 (+0000) Subject: [PATCH] lib-sieve: Reduce CPU limit check interval in :contains and :matches matchers X-Git-Tag: archive/raspbian/1%2.4.1+dfsg1-6+rpi1+deb13u7^2~107 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e8b3821f2f0c37c02e6c1d1282b13c59d5eb40f9;p=dovecot.git [PATCH] lib-sieve: Reduce CPU limit check interval in :contains and :matches matchers 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 --- diff --git a/pigeonhole/src/lib-sieve/mcht-contains.c b/pigeonhole/src/lib-sieve/mcht-contains.c index b077351..21a3512 100644 --- a/pigeonhole/src/lib-sieve/mcht-contains.c +++ b/pigeonhole/src/lib-sieve/mcht-contains.c @@ -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, diff --git a/pigeonhole/src/lib-sieve/mcht-matches.c b/pigeonhole/src/lib-sieve/mcht-matches.c index 3ddf769..1c21425 100644 --- a/pigeonhole/src/lib-sieve/mcht-matches.c +++ b/pigeonhole/src/lib-sieve/mcht-matches.c @@ -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,