]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: pools: respect pool alignment in allocations 20250805-memalign-6c
authorWilly Tarreau <w@1wt.eu>
Tue, 5 Aug 2025 16:12:18 +0000 (18:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 6 Aug 2025 17:20:36 +0000 (19:20 +0200)
commitef915e672a59903dccbf39629e6cebbd074b7643
tree5d672993ca6c4bf94cef90a15d2d6d8ae14b28bd
parentf0d0922aa18cec60dcc267bf1b5423f7b94e5865
MEDIUM: pools: respect pool alignment in allocations

Now pool_alloc_area() takes the alignment in argument and makes use
of ha_aligned_malloc() instead of malloc(). pool_alloc_area_uaf()
simply applies the alignment before returning the mapped area. The
pool_free() functionn calls ha_aligned_free() so as to permit to use
a specific API for aligned alloc/free like mingw requires.

Note that it's possible to see warnings about mismatching sized
during pool_free() since we know both the pool and the type. In
pool_free, adding just this is sufficient to detect potential
offenders:

WARN_ON(__alignof__(*__ptr) > pool->align);
include/haproxy/pool-os.h
src/pool.c