DEBUG: pool: improve decoding of corrupted pools

When a corruption was detected in an object, it's often said that the
tag doesn't match the pool, but it should also check if it matches the
location of an earlier pool_free() call, which happens when -dMcaller
is used. That's what we're doing now.
This commit is contained in:
Willy Tarreau 2024-04-12 15:56:18 +02:00
parent 21447b1dd4
commit b21aaef4e5

View file

@ -1016,9 +1016,16 @@ void pool_inspect_item(const char *msg, struct pool_head *pool, const void *item
if (!the_pool) {
const char *start, *end, *p;
pool_mark = (const void **)(((char *)item) + pool->size);
chunk_appendf(&trash,
"Tag does not match any other pool.\n"
"Tag does not match any other pool.\n");
pool_mark = (const void **)(((char *)item) + pool->size);
if (resolve_sym_name(&trash, "Resolving the tag as a pool_free() location: ", *pool_mark))
chunk_appendf(&trash, "\n");
else
chunk_appendf(&trash, " (no match).\n");
chunk_appendf(&trash,
"Contents around address %p+%lu=%p:\n",
item, (ulong)((const void*)pool_mark - (const void*)item),
pool_mark);