asan_interceptors_memintrinsics.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //===-- asan_interceptors_memintrinsics.cpp -------------------------------===//
  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 AddressSanitizer, an address sanity checker.
  10. //
  11. // ASan versions of memcpy, memmove, and memset.
  12. //===---------------------------------------------------------------------===//
  13. #include "asan_interceptors_memintrinsics.h"
  14. #include "asan_report.h"
  15. #include "asan_stack.h"
  16. #include "asan_suppressions.h"
  17. using namespace __asan;
  18. void *__asan_memcpy(void *to, const void *from, uptr size) {
  19. ASAN_MEMCPY_IMPL(nullptr, to, from, size);
  20. }
  21. void *__asan_memset(void *block, int c, uptr size) {
  22. ASAN_MEMSET_IMPL(nullptr, block, c, size);
  23. }
  24. void *__asan_memmove(void *to, const void *from, uptr size) {
  25. ASAN_MEMMOVE_IMPL(nullptr, to, from, size);
  26. }
  27. #if SANITIZER_FUCHSIA
  28. // Fuchsia doesn't use sanitizer_common_interceptors.inc, but
  29. // the only things there it wants are these three. Just define them
  30. // as aliases here rather than repeating the contents.
  31. extern "C" decltype(__asan_memcpy) memcpy[[gnu::alias("__asan_memcpy")]];
  32. extern "C" decltype(__asan_memmove) memmove[[gnu::alias("__asan_memmove")]];
  33. extern "C" decltype(__asan_memset) memset[[gnu::alias("__asan_memset")]];
  34. #endif // SANITIZER_FUCHSIA