"-dMno-merge" is passed on the executable's command line, the pools
also need to have the exact same name to be merged. In addition, unless
MEM_F_EXACT is set in <flags>, the object size will usually be rounded
- up to the size of pointers (16 or 32 bytes). The name that will appear
+ up to the size of pointers (16 or 32 bytes). MEM_F_UAF may be set on a
+ per-pool basis to enable the UAF detection only for this specific pool,
+ saving the massive overhead of global usage. The name that will appear
in the pool upon merging is the name of the first created pool. The
returned pointer is the new (or reused) pool head, or NULL upon error.
Pools created this way must be destroyed using pool_destroy().
if (!pool->limit || pool_allocated(pool) < pool->limit) {
void *ptr;
- if (pool_debugging & POOL_DBG_UAF)
+ if ((pool_debugging & POOL_DBG_UAF) || (pool->flags & MEM_F_UAF))
ptr = pool_alloc_area_uaf(pool->alloc_sz);
else
ptr = pool_alloc_area(pool->alloc_sz);
*/
void pool_put_to_os_nodec(struct pool_head *pool, void *ptr)
{
- if (pool_debugging & POOL_DBG_UAF)
+ if ((pool_debugging & POOL_DBG_UAF) || (pool->flags & MEM_F_UAF))
pool_free_area_uaf(ptr, pool->alloc_sz);
else
pool_free_area(ptr, pool->alloc_sz);
#endif
if (unlikely((pool_debugging & POOL_DBG_NO_CACHE) ||
+ (pool->flags & MEM_F_UAF) ||
global.tune.pool_cache_size < pool->size)) {
pool_free_nocache(pool, ptr);
return;