1 //===-- asan_interceptors_memintrinsics.cc --------------------------------===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===---------------------------------------------------------------------===//
7 //
8 // This file is a part of AddressSanitizer, an address sanity checker.
9 //
10 // ASan versions of memcpy, memmove, and memset.
11 //===---------------------------------------------------------------------===//
12 
13 #include "asan_interceptors_memintrinsics.h"
14 #include "asan_report.h"
15 #include "asan_stack.h"
16 #include "asan_suppressions.h"
17 
18 using namespace __asan;  // NOLINT
19 
__asan_memcpy(void * to,const void * from,uptr size)20 void *__asan_memcpy(void *to, const void *from, uptr size) {
21   ASAN_MEMCPY_IMPL(nullptr, to, from, size);
22 }
23 
__asan_memset(void * block,int c,uptr size)24 void *__asan_memset(void *block, int c, uptr size) {
25   ASAN_MEMSET_IMPL(nullptr, block, c, size);
26 }
27 
__asan_memmove(void * to,const void * from,uptr size)28 void *__asan_memmove(void *to, const void *from, uptr size) {
29   ASAN_MEMMOVE_IMPL(nullptr, to, from, size);
30 }
31 
32 #if SANITIZER_FUCHSIA
33 
34 // Fuchsia doesn't use sanitizer_common_interceptors.inc, but the only
35 // things there it wants are these three.  Just define them as aliases
36 // here rather than repeating the contents.
37 
38 decltype(memcpy) memcpy[[gnu::alias("__asan_memcpy")]];
39 decltype(memmove) memmove[[gnu::alias("__asan_memmove")]];
40 decltype(memset) memset[[gnu::alias("__asan_memset")]];
41 
42 #endif  // SANITIZER_FUCHSIA
43