1 //===-- asan_malloc_local.h -------------------------------------*- C++ -*-===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // This file is a part of AddressSanitizer, an address sanity checker.
10 // Provide interfaces to check for and handle local pool memory allocation.
11 //===----------------------------------------------------------------------===//
13 #ifndef ASAN_MALLOC_LOCAL_H
14 #define ASAN_MALLOC_LOCAL_H
16 #include "sanitizer_common/sanitizer_platform.h"
17 #include "asan_internal.h"
19 // On RTEMS, we use the local pool to handle memory allocation when the ASan
20 // run-time is not up.
21 static INLINE
bool EarlyMalloc() {
22 return SANITIZER_RTEMS
&& (!__asan::asan_inited
||
23 __asan::asan_init_is_running
);
26 void* MemalignFromLocalPool(uptr alignment
, uptr size
);
30 bool IsFromLocalPool(const void *ptr
);
32 #define ALLOCATE_FROM_LOCAL_POOL UNLIKELY(EarlyMalloc())
33 #define IS_FROM_LOCAL_POOL(ptr) UNLIKELY(IsFromLocalPool(ptr))
35 #else // SANITIZER_RTEMS
37 #define ALLOCATE_FROM_LOCAL_POOL 0
38 #define IS_FROM_LOCAL_POOL(ptr) 0
40 #endif // SANITIZER_RTEMS
42 #endif // ASAN_MALLOC_LOCAL_H