lib/env_ocf: place allocator variable on hugepages

When using `__lsan_do_recoverable_leak_check` (e.g when fuzzing),
to check for leaks during runtime. Leak sanitizer can not follow
reference of memory that is allocated on heap (e.g. calloc)
and then stored on hugepage causing lsan to incorrectly report
direct leak.

Fixes #2967

Signed-off-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Change-Id: I3511e117a07ca8daa96f19bf1437c0d788b64cb1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17682
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Amir Haroush <amir.haroush@huawei.com>
This commit is contained in:
Sebastian Brzezinka 2023-04-20 20:56:39 +02:00 committed by David Ko
parent 5200552452
commit 3a14cb3a0f

View File

@ -62,7 +62,7 @@ env_allocator_create_extended(uint32_t size, const char *name, int limit, bool z
snprintf(qualified_name, OCF_ALLOCATOR_NAME_MAX, "ocf_env_%d:%s",
env_atomic_inc_return(&g_env_allocator_index), name);
allocator = calloc(1, sizeof(*allocator));
allocator = env_zalloc(sizeof(*allocator), ENV_MEM_NOIO);
if (!allocator) {
return NULL;
}
@ -101,7 +101,7 @@ env_allocator_destroy(env_allocator *allocator)
}
spdk_mempool_free(allocator->mempool);
free(allocator);
env_free(allocator);
}
}
/* *** CRC *** */