]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: pools: implement DEBUG_UAF to detect use after free
authorWilly Tarreau <w@1wt.eu>
Wed, 22 Nov 2017 14:47:29 +0000 (15:47 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 22 Nov 2017 18:43:57 +0000 (19:43 +0100)
commit158fa7581173234ab3bebf9dee91d18cf6a138d0
treeb1102373d46526285b7edfd5c074dc48fafb8597
parentf13322ede1e4824e20fb871dabd22e91dcc8ab0a
MINOR: pools: implement DEBUG_UAF to detect use after free

This code has been used successfully a few times in the past to detect
that a pool was used after being freed. Its main goal is to allocate a
full page for each object so that they are always released individually
and unmapped from memory. This way if any part of the code reference the
object after is was freed and before it is reallocated, a segv occurs at
the exact offending location. It does a few extra things such as writing
to the memory area before freeing to detect double-frees and free of
read-only areas, and placing the data at the end of the page instead of
the beginning so that out of bounds accesses are easier to spot. The
amount of memory used with this is huge (about 10 times the regular
usage) but it can be useful sometimes.
Makefile
include/common/memory.h