From d6407194137cd46025d2e7308176d5434e822eed Mon Sep 17 00:00:00 2001 From: Lukas Sismis Date: Wed, 25 Feb 2026 09:32:45 +0100 Subject: [PATCH] hs: include HS platform info in cache file hash Hash Hyperscan installation info (version, CPU features, mode) into the cache filename. A Hyperscan upgrade or platform change would now produce a different filename, so stale caches from an older installation are never opened. Ticket: 8325 --- src/util-mpm-hs-cache.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util-mpm-hs-cache.c b/src/util-mpm-hs-cache.c index f1a1017888..997b2471a7 100644 --- a/src/util-mpm-hs-cache.c +++ b/src/util-mpm-hs-cache.c @@ -294,6 +294,12 @@ int HSHashDb(const PatternDatabase *pd, char *hash, size_t hash_len) SCLogDebug("sha256 hashing failed"); return -1; } + + const char *ref_info = HSGetReferenceDbInfo(); + if (ref_info != NULL) { + SCSha256Update(hasher, (const uint8_t *)ref_info, strlen(ref_info)); + } + SCSha256Update(hasher, (const uint8_t *)&pd->pattern_cnt, sizeof(pd->pattern_cnt)); for (uint32_t i = 0; i < pd->pattern_cnt; i++) { SCHSCachePatternHash(pd->parray[i], hasher);