]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Fix re_cache hyperscan file tracking and buffer size
authorVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 13 Jan 2026 13:56:27 +0000 (13:56 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 13 Jan 2026 13:56:27 +0000 (13:56 +0000)
Two fixes for hyperscan cache file handling:

1. Increase hyperscan_cache_file.filename buffer from 64 to 80 bytes
   to accommodate full filenames (64 hex hash + ".hs.unser" = 73 chars)

2. Add rspamd_hyperscan_notice_known() call in re_cache.c after loading
   hyperscan databases. Without this, re_cache files weren't registered
   as "known" and would be deleted by cleanup_maybe() on restart,
   causing unnecessary recompilation.

src/libserver/re_cache.c
src/libserver/rspamd_control.h

index abfcf4fa5faa98e4c5c9392cd896d0799082842d..8bf44ba3c0b6299575e5791d5b31a3584d80ecd7 100644 (file)
@@ -3335,6 +3335,9 @@ rspamd_re_cache_load_hyperscan(struct rspamd_re_cache *cache,
                        g_free(hs_flags);
                        re_class->nhs = n;
 
+                       /* Notify main process about the loaded hyperscan file */
+                       rspamd_hyperscan_notice_known(path);
+
                        if (!has_valid) {
                                has_valid = TRUE;
                                all_valid = TRUE;
index 9b50f32f3fed5dfef1fe870ad2180048ae5d66a9..e85bb57905aa2a32de0fb1b4ef4288bd0fdf0348 100644 (file)
@@ -222,7 +222,7 @@ struct rspamd_srv_command {
                } health;
                /* Used when a worker loads a valid hyperscan file */
                struct {
-                       char filename[64]; /* Just the filename, not full path */
+                       char filename[80]; /* Just the filename: 64 hex hash + .hs.unser + null */
                } hyperscan_cache_file;
                /* Send when one worker has blocked some IP address */
                struct {