hwasan_interface_internal.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. //===-- hwasan_interface_internal.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 HWAddressSanitizer.
  10. //
  11. // Private Hwasan interface header.
  12. //===----------------------------------------------------------------------===//
  13. #ifndef HWASAN_INTERFACE_INTERNAL_H
  14. #define HWASAN_INTERFACE_INTERNAL_H
  15. #include "sanitizer_common/sanitizer_internal_defs.h"
  16. #include "sanitizer_common/sanitizer_platform_limits_posix.h"
  17. #include <link.h>
  18. extern "C" {
  19. SANITIZER_INTERFACE_ATTRIBUTE
  20. void __hwasan_init_static();
  21. SANITIZER_INTERFACE_ATTRIBUTE
  22. void __hwasan_init();
  23. SANITIZER_INTERFACE_ATTRIBUTE
  24. void __hwasan_library_loaded(ElfW(Addr) base, const ElfW(Phdr) * phdr,
  25. ElfW(Half) phnum);
  26. SANITIZER_INTERFACE_ATTRIBUTE
  27. void __hwasan_library_unloaded(ElfW(Addr) base, const ElfW(Phdr) * phdr,
  28. ElfW(Half) phnum);
  29. using __sanitizer::uptr;
  30. using __sanitizer::sptr;
  31. using __sanitizer::uu64;
  32. using __sanitizer::uu32;
  33. using __sanitizer::uu16;
  34. using __sanitizer::u64;
  35. using __sanitizer::u32;
  36. using __sanitizer::u16;
  37. using __sanitizer::u8;
  38. SANITIZER_INTERFACE_ATTRIBUTE
  39. void __hwasan_init_frames(uptr, uptr);
  40. SANITIZER_INTERFACE_ATTRIBUTE
  41. extern uptr __hwasan_shadow_memory_dynamic_address;
  42. SANITIZER_INTERFACE_ATTRIBUTE
  43. void __hwasan_loadN(uptr, uptr);
  44. SANITIZER_INTERFACE_ATTRIBUTE
  45. void __hwasan_load1(uptr);
  46. SANITIZER_INTERFACE_ATTRIBUTE
  47. void __hwasan_load2(uptr);
  48. SANITIZER_INTERFACE_ATTRIBUTE
  49. void __hwasan_load4(uptr);
  50. SANITIZER_INTERFACE_ATTRIBUTE
  51. void __hwasan_load8(uptr);
  52. SANITIZER_INTERFACE_ATTRIBUTE
  53. void __hwasan_load16(uptr);
  54. SANITIZER_INTERFACE_ATTRIBUTE
  55. void __hwasan_loadN_noabort(uptr, uptr);
  56. SANITIZER_INTERFACE_ATTRIBUTE
  57. void __hwasan_load1_noabort(uptr);
  58. SANITIZER_INTERFACE_ATTRIBUTE
  59. void __hwasan_load2_noabort(uptr);
  60. SANITIZER_INTERFACE_ATTRIBUTE
  61. void __hwasan_load4_noabort(uptr);
  62. SANITIZER_INTERFACE_ATTRIBUTE
  63. void __hwasan_load8_noabort(uptr);
  64. SANITIZER_INTERFACE_ATTRIBUTE
  65. void __hwasan_load16_noabort(uptr);
  66. SANITIZER_INTERFACE_ATTRIBUTE
  67. void __hwasan_storeN(uptr, uptr);
  68. SANITIZER_INTERFACE_ATTRIBUTE
  69. void __hwasan_store1(uptr);
  70. SANITIZER_INTERFACE_ATTRIBUTE
  71. void __hwasan_store2(uptr);
  72. SANITIZER_INTERFACE_ATTRIBUTE
  73. void __hwasan_store4(uptr);
  74. SANITIZER_INTERFACE_ATTRIBUTE
  75. void __hwasan_store8(uptr);
  76. SANITIZER_INTERFACE_ATTRIBUTE
  77. void __hwasan_store16(uptr);
  78. SANITIZER_INTERFACE_ATTRIBUTE
  79. void __hwasan_storeN_noabort(uptr, uptr);
  80. SANITIZER_INTERFACE_ATTRIBUTE
  81. void __hwasan_store1_noabort(uptr);
  82. SANITIZER_INTERFACE_ATTRIBUTE
  83. void __hwasan_store2_noabort(uptr);
  84. SANITIZER_INTERFACE_ATTRIBUTE
  85. void __hwasan_store4_noabort(uptr);
  86. SANITIZER_INTERFACE_ATTRIBUTE
  87. void __hwasan_store8_noabort(uptr);
  88. SANITIZER_INTERFACE_ATTRIBUTE
  89. void __hwasan_store16_noabort(uptr);
  90. SANITIZER_INTERFACE_ATTRIBUTE
  91. void __hwasan_tag_memory(uptr p, u8 tag, uptr sz);
  92. SANITIZER_INTERFACE_ATTRIBUTE
  93. uptr __hwasan_tag_pointer(uptr p, u8 tag);
  94. SANITIZER_INTERFACE_ATTRIBUTE
  95. void __hwasan_tag_mismatch(uptr addr, u8 ts);
  96. SANITIZER_INTERFACE_ATTRIBUTE
  97. void __hwasan_tag_mismatch4(uptr addr, uptr access_info, uptr *registers_frame,
  98. size_t outsize);
  99. SANITIZER_INTERFACE_ATTRIBUTE
  100. u8 __hwasan_generate_tag();
  101. // Returns the offset of the first tag mismatch or -1 if the whole range is
  102. // good.
  103. SANITIZER_INTERFACE_ATTRIBUTE
  104. sptr __hwasan_test_shadow(const void *x, uptr size);
  105. SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
  106. /* OPTIONAL */ const char* __hwasan_default_options();
  107. SANITIZER_INTERFACE_ATTRIBUTE
  108. void __hwasan_print_shadow(const void *x, uptr size);
  109. SANITIZER_INTERFACE_ATTRIBUTE
  110. void __hwasan_handle_longjmp(const void *sp_dst);
  111. SANITIZER_INTERFACE_ATTRIBUTE
  112. void __hwasan_handle_vfork(const void *sp_dst);
  113. SANITIZER_INTERFACE_ATTRIBUTE
  114. u16 __sanitizer_unaligned_load16(const uu16 *p);
  115. SANITIZER_INTERFACE_ATTRIBUTE
  116. u32 __sanitizer_unaligned_load32(const uu32 *p);
  117. SANITIZER_INTERFACE_ATTRIBUTE
  118. u64 __sanitizer_unaligned_load64(const uu64 *p);
  119. SANITIZER_INTERFACE_ATTRIBUTE
  120. void __sanitizer_unaligned_store16(uu16 *p, u16 x);
  121. SANITIZER_INTERFACE_ATTRIBUTE
  122. void __sanitizer_unaligned_store32(uu32 *p, u32 x);
  123. SANITIZER_INTERFACE_ATTRIBUTE
  124. void __sanitizer_unaligned_store64(uu64 *p, u64 x);
  125. SANITIZER_INTERFACE_ATTRIBUTE
  126. void __hwasan_enable_allocator_tagging();
  127. SANITIZER_INTERFACE_ATTRIBUTE
  128. void __hwasan_disable_allocator_tagging();
  129. SANITIZER_INTERFACE_ATTRIBUTE
  130. void __hwasan_thread_enter();
  131. SANITIZER_INTERFACE_ATTRIBUTE
  132. void __hwasan_thread_exit();
  133. SANITIZER_INTERFACE_ATTRIBUTE
  134. void __hwasan_print_memory_usage();
  135. SANITIZER_INTERFACE_ATTRIBUTE
  136. void *__hwasan_memcpy(void *dst, const void *src, uptr size);
  137. SANITIZER_INTERFACE_ATTRIBUTE
  138. void *__hwasan_memset(void *s, int c, uptr n);
  139. SANITIZER_INTERFACE_ATTRIBUTE
  140. void *__hwasan_memmove(void *dest, const void *src, uptr n);
  141. SANITIZER_INTERFACE_ATTRIBUTE
  142. void __hwasan_set_error_report_callback(void (*callback)(const char *));
  143. } // extern "C"
  144. #endif // HWASAN_INTERFACE_INTERNAL_H