Path: blob/main/contrib/llvm-project/compiler-rt/lib/nsan/nsan_allocator.h
213766 views
//===-- nsan_allocator.h ----------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef NSAN_ALLOCATOR_H9#define NSAN_ALLOCATOR_H1011#include "sanitizer_common/sanitizer_common.h"1213namespace __nsan {1415struct NsanThreadLocalMallocStorage {16// Allocator cache contains atomic_uint64_t which must be 8-byte aligned.17alignas(8) uptr allocator_cache[96 * (512 * 8 + 16)]; // Opaque.18void Init();19void CommitBack();2021private:22// These objects are allocated via mmap() and are zero-initialized.23NsanThreadLocalMallocStorage() {}24};2526void NsanAllocatorInit();27void NsanDeallocate(void *ptr);2829void *nsan_malloc(uptr size);30void *nsan_calloc(uptr nmemb, uptr size);31void *nsan_realloc(void *ptr, uptr size);32void *nsan_reallocarray(void *ptr, uptr nmemb, uptr size);33void *nsan_valloc(uptr size);34void *nsan_pvalloc(uptr size);35void *nsan_aligned_alloc(uptr alignment, uptr size);36void *nsan_memalign(uptr alignment, uptr size);37int nsan_posix_memalign(void **memptr, uptr alignment, uptr size);3839} // namespace __nsan40#endif // NSAN_ALLOCATOR_H414243