]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: cache: skip already resolved filters when resolving caches
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 21 Oct 2026 09:25:01 +0000 (09:25 +0000)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 13 Nov 2026 15:26:51 +0000 (16:26 +0100)
commit2f8db919ff413ab15066e48a65c02fdf996fbbda
treeb7dd57ab9fb1e6db5bc1af245026e361748bbaa3
parentcf5e36d9d618d1e417343b61be627c73d12964f8
BUG/MINOR: cache: skip already resolved filters when resolving caches

This is a latent bug with no visible impact today: when a proxy uses
several caches, resolving the second cache's name reads the first cache's
structure as if it were a string.

post_check_cache() resolves the caches one after the other, and for each
of them walks the cache filter configurations of all the proxies with
cache_postcheck_flt(), which compares the cache's name with cconf->c.name.
But c is a union: once a configuration is resolved, CACHE_FLT_INIT is set
and c.cache points to the cache, whose structure is then compared as a
string with the name of the next cache. This currently reads the first
bytes of the cache's first tree root, which are NULL at boot, so it never
matches, but any change to the layout of struct cache or to the moment
this runs could make it match or read past the structure.

The configurations already resolved, i.e. flagged with CACHE_FLT_INIT, are
now skipped.

This patch may be backported. If so, it must be adapted because this part
was reworked on 3.5.
src/cache.c