mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-10-27 06:31:23 +01:00
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.
This commit is contained in:
parent
bece704128
commit
f936feb3a9
@ -344,6 +344,10 @@ struct pool_head *create_pool_from_reg(const char *name, struct pool_registratio
|
|||||||
unsigned int best_diff;
|
unsigned int best_diff;
|
||||||
int thr __maybe_unused;
|
int thr __maybe_unused;
|
||||||
|
|
||||||
|
/* alignment of zero means type alignment */
|
||||||
|
if (!alignment)
|
||||||
|
alignment = reg->type_align;
|
||||||
|
|
||||||
/* extend alignment if needed */
|
/* extend alignment if needed */
|
||||||
if (alignment < sizeof(void*))
|
if (alignment < sizeof(void*))
|
||||||
alignment = sizeof(void*);
|
alignment = sizeof(void*);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user