[compiler-rt] 439e00a - [scudo] Fix running tests under hwasan.

Evgenii Stepanov via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 14 15:03:29 PDT 2021


Author: Evgenii Stepanov
Date: 2021-10-14T14:56:58-07:00
New Revision: 439e00a25bde9df851c6f25e356f11f83e884c2f

URL: https://github.com/llvm/llvm-project/commit/439e00a25bde9df851c6f25e356f11f83e884c2f
DIFF: https://github.com/llvm/llvm-project/commit/439e00a25bde9df851c6f25e356f11f83e884c2f.diff

LOG: [scudo] Fix running tests under hwasan.

When built with hwasan, assume that the target architecture does not
support TBI. HWASan uses that byte for its own purpose, and changing it
breaks things.

Reviewed By: hctim

Differential Revision: https://reviews.llvm.org/D111842

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/memtag.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/memtag.h b/compiler-rt/lib/scudo/standalone/memtag.h
index 8097b77ebd416..df346bce1bd4a 100644
--- a/compiler-rt/lib/scudo/standalone/memtag.h
+++ b/compiler-rt/lib/scudo/standalone/memtag.h
@@ -23,7 +23,9 @@ namespace scudo {
 // We assume that Top-Byte Ignore is enabled if the architecture supports memory
 // tagging. Not all operating systems enable TBI, so we only claim architectural
 // support for memory tagging if the operating system enables TBI.
-#if SCUDO_LINUX && !defined(SCUDO_DISABLE_TBI)
+// HWASan uses the top byte for its own purpose and Scudo should not touch it.
+#if SCUDO_LINUX && !defined(SCUDO_DISABLE_TBI) &&                              \
+    !__has_feature(hwaddress_sanitizer)
 inline constexpr bool archSupportsMemoryTagging() { return true; }
 #else
 inline constexpr bool archSupportsMemoryTagging() { return false; }


        


More information about the llvm-commits mailing list