summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Objects/obmalloc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
index 2067cf5..99b577a 100644
--- a/Objects/obmalloc.c
+++ b/Objects/obmalloc.c
@@ -8,6 +8,12 @@
#else
#define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
#endif
+ #if __has_feature(hwaddress_sanitizer) /* is HWASAN enabled? */
+ #define ATTRIBUTE_NO_SANITIZE_HWADDRESS \
+ __attribute__((no_sanitize("hwaddress")))
+ #else
+ #define ATTRIBUTE_NO_SANITIZE_HWADDRESS
+ #endif
#else
#if defined(__SANITIZE_ADDRESS__) /* GCC 4.8.x, is ASAN enabled? */
#define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS \
@@ -16,6 +22,12 @@
#else
#define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
#endif
+ #if defined(__SANITIZE_HWADDRESS__) /* is HWASAN enabled? */
+ #define ATTRIBUTE_NO_SANITIZE_HWADDRESS \
+ __attribute__((no_sanitize_hwaddress))
+ #else
+ #define ATTRIBUTE_NO_SANITIZE_HWADDRESS
+ #endif
#endif
#ifdef WITH_PYMALLOC
@@ -996,6 +1008,7 @@ redirect:
#undef PyObject_Free
ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
+ATTRIBUTE_NO_SANITIZE_HWADDRESS
void
PyObject_Free(void *p)
{
@@ -1227,6 +1240,7 @@ redirect:
#undef PyObject_Realloc
ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
+ATTRIBUTE_NO_SANITIZE_HWADDRESS
void *
PyObject_Realloc(void *p, size_t nbytes)
{