]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: Make sure stksess is properly aligned.
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 14 Nov 2018 16:54:36 +0000 (17:54 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 15 Nov 2018 13:24:05 +0000 (14:24 +0100)
commit52dabbc4fad338233c7f0c96f977a43f8f81452a
treeb5afe145703b21107db84f5ccb010a89fc1c09d8
parenta8b2671cf6fd2edf1614397aac22db3bd08bba0a
BUG/MEDIUM: Make sure stksess is properly aligned.

When we allocate struct stksess, we also allocate memory to store the
associated data before the struct itself.
As the data can be of different types, they can have different size. However,
we need the struct stksess to be properly aligned, as it can do 64bits
load/store (including atomic load/stores) on 64bits platforms, and some of
them doesn't support unaligned access.
So, when allocating the struct stksess, round the size up to the next
multiple of sizeof(void *), and make sure the struct stksess itself is
properly aligned.
Many thanks to Paul Martin for investigating and reporting that bug.

This should be backported to earlier releases.
src/stick_table.c