Skip to content

Commit c327c2f

Browse files
authored
Allow building with hardware address sanitizer
1 parent 20e6c2f commit c327c2f

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎Include/pyport.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ extern "C" {
556556
# define _Py_MSAN_UNPOISON(PTR, SIZE) (__msan_unpoison(PTR, SIZE))
557557
# endif
558558
# endif
559-
# if __has_feature(address_sanitizer)
559+
# if __has_feature(address_sanitizer) || __has_feature(hwaddress_sanitizer)
560560
# if !defined(_Py_ADDRESS_SANITIZER)
561561
# define _Py_ADDRESS_SANITIZER
562562
# define _Py_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
@@ -569,7 +569,7 @@ extern "C" {
569569
# endif
570570
# endif
571571
#elif defined(__GNUC__)
572-
# if defined(__SANITIZE_ADDRESS__)
572+
# if defined(__SANITIZE_ADDRESS__) || defined(__SANITIZE_HWADDRESS__)
573573
# define _Py_ADDRESS_SANITIZER
574574
# define _Py_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
575575
# endif

‎Lib/test/support/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ def check_sanitizer(*, address=False, memory=False, ub=False, thread=False,
463463
)
464464
address_sanitizer = (
465465
'-fsanitize=address' in cflags or
466+
'-fsanitize=hwaddress' in cflags or
466467
'--with-address-sanitizer' in config_args
467468
)
468469
ub_sanitizer = (

0 commit comments

Comments
 (0)