From: Willy Tarreau Date: Fri, 7 Nov 2025 21:05:21 +0000 (+0100) Subject: BUG/MEDIUM: proxy: use aligned allocations for struct proxy X-Git-Tag: v3.3-dev12~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df9eb2e7b6901c561b76c0b77bdb15717adac91e;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: proxy: use aligned allocations for struct proxy Commit fd012b6c5 ("OPTIM: proxy: move atomically access fields out of the read-only ones") caused the proxy struct to be 64-byte aligned, which allows the compiler to use optimizations such as AVX512 to zero certain fields. However the struct was allocated using calloc() so it was not necessarily aligned, causing segv on startup on compatible machines. Let's just use ha_aligned_zalloc_typed() to allocate the struct. No backport is needed. --- diff --git a/src/proxy.c b/src/proxy.c index f1ec86bd5..7bd259a97 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -1717,7 +1717,7 @@ struct proxy *alloc_new_proxy(const char *name, unsigned int cap, char **errmsg) { struct proxy *curproxy; - if ((curproxy = calloc(1, sizeof(*curproxy))) == NULL) { + if ((curproxy = ha_aligned_zalloc_typed(1, typeof(*curproxy))) == NULL) { memprintf(errmsg, "proxy '%s': out of memory", name); goto fail; }