msan_allocator.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. //===-- msan_allocator.h ----------------------------------------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file is a part of MemorySanitizer.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef MSAN_ALLOCATOR_H
  13. #define MSAN_ALLOCATOR_H
  14. #include "sanitizer_common/sanitizer_common.h"
  15. namespace __msan {
  16. struct MsanThreadLocalMallocStorage {
  17. // Allocator cache contains atomic_uint64_t which must be 8-byte aligned.
  18. ALIGNED(8) uptr allocator_cache[96 * (512 * 8 + 16)]; // Opaque.
  19. void Init();
  20. void CommitBack();
  21. private:
  22. // These objects are allocated via mmap() and are zero-initialized.
  23. MsanThreadLocalMallocStorage() {}
  24. };
  25. void LockAllocator();
  26. void UnlockAllocator();
  27. } // namespace __msan
  28. #endif // MSAN_ALLOCATOR_H