From: Willy Tarreau Date: Wed, 22 Oct 2025 07:01:54 +0000 (+0200) Subject: BUG/MAJOR: pools: fix default pool alignment X-Git-Tag: v3.3-dev11~72 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f936feb3a97d9c576a5e38671a5678225ab7997e;p=thirdparty%2Fhaproxy.git BUG/MAJOR: pools: fix default pool alignment The doc in commit 977feb5617 ("DOC: api: update the pools API with the alignment and typed declarations") says that alignment of zero means the type's alignment. And this is followed by the DECLARE_TYPED_POOL() macro. Yet this is not what is done in create_pool_from_reg() which only raises the alignment to a void* if lower, while it should start from the type's. The effect is haproxy refusing to start on some 32-bit platforms since that commit, displaying an error such as: "BUG in the code: at src/mux_h2.c:454, requested creation of pool 'h2s' aligned to 4 while type requires alignment of 8! Please report to developers. Aborting." Let's just apply the default type's alignment. Thanks to @tianon for reporting this in GH issue #3168. No backport is needed since aligned pools are 3.3-only. --- diff --git a/src/pool.c b/src/pool.c index 9d247eb58..5108a81e6 100644 --- a/src/pool.c +++ b/src/pool.c @@ -344,6 +344,10 @@ struct pool_head *create_pool_from_reg(const char *name, struct pool_registratio unsigned int best_diff; int thr __maybe_unused; + /* alignment of zero means type alignment */ + if (!alignment) + alignment = reg->type_align; + /* extend alignment if needed */ if (alignment < sizeof(void*)) alignment = sizeof(void*);