]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
DEBUG: pools: apply poisonning on every allocated pool
authorWilly Tarreau <w@1wt.eu>
Tue, 25 Nov 2014 12:45:16 +0000 (13:45 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 25 Nov 2014 12:48:43 +0000 (13:48 +0100)
Till now, when memory poisonning was enabled, it used to be done only
after a calloc(). But sometimes it's not enough to detect unexpected
sharing, so let's ensure that we now poison every allocation once it's
in place. Note that enabling poisonning significantly hurts performance
(it can typically half the overall performance).

include/common/memory.h

index dd2b21f4e8693c486ea664e3dee4c6d82d270592..e446d81b60bca6634333f1f232872db78c501c12 100644 (file)
@@ -179,6 +179,8 @@ void *pool_destroy2(struct pool_head *pool);
         else {                                                  \
                 (pool)->free_list = *(void **)(pool)->free_list;\
                (pool)->used++;                                 \
+               if (unlikely(mem_poison_byte))                  \
+                       memset(__p, mem_poison_byte, (pool)->size);     \
         }                                                       \
         __p;                                                    \
 })