10b57cec5SDimitry Andric //===-- msan_allocator.h ----------------------------------------*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric // 90b57cec5SDimitry Andric // This file is a part of MemorySanitizer. 100b57cec5SDimitry Andric // 110b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric #ifndef MSAN_ALLOCATOR_H 140b57cec5SDimitry Andric #define MSAN_ALLOCATOR_H 150b57cec5SDimitry Andric 160b57cec5SDimitry Andric #include "sanitizer_common/sanitizer_common.h" 170b57cec5SDimitry Andric 180b57cec5SDimitry Andric namespace __msan { 190b57cec5SDimitry Andric 200b57cec5SDimitry Andric struct MsanThreadLocalMallocStorage { 210b57cec5SDimitry Andric // Allocator cache contains atomic_uint64_t which must be 8-byte aligned. 22*0fca6ea1SDimitry Andric alignas(8) uptr allocator_cache[96 * (512 * 8 + 16)]; // Opaque. 2306c3fb27SDimitry Andric void Init(); 240b57cec5SDimitry Andric void CommitBack(); 250b57cec5SDimitry Andric 260b57cec5SDimitry Andric private: 270b57cec5SDimitry Andric // These objects are allocated via mmap() and are zero-initialized. 280b57cec5SDimitry Andric MsanThreadLocalMallocStorage() {} 290b57cec5SDimitry Andric }; 300b57cec5SDimitry Andric 315f757f3fSDimitry Andric void LockAllocator(); 325f757f3fSDimitry Andric void UnlockAllocator(); 335f757f3fSDimitry Andric 340b57cec5SDimitry Andric } // namespace __msan 350b57cec5SDimitry Andric #endif // MSAN_ALLOCATOR_H 36