[compiler-rt][scudo] Simplify TBI checks

Differential Revision: https://reviews.llvm.org/D111080
This commit is contained in:
Leonard Chan 2022-05-24 10:51:42 -07:00
parent b159108bc5
commit f6038cdca0
1 changed files with 5 additions and 8 deletions

View File

@ -18,19 +18,16 @@
namespace scudo {
#if (__clang_major__ >= 12 && defined(__aarch64__) && !defined(__ILP32__)) || \
defined(SCUDO_FUZZ)
// 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.
// 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)
#if (__clang_major__ >= 12 && defined(__aarch64__) && !defined(__ILP32__) && \
SCUDO_LINUX && \
!defined(SCUDO_DISABLE_TBI) !__has_feature(hwaddress_sanitizer)) || \
defined(SCUDO_FUZZ)
inline constexpr bool archSupportsMemoryTagging() { return true; }
#else
inline constexpr bool archSupportsMemoryTagging() { return false; }
#endif
inline constexpr uptr archMemoryTagGranuleSize() { return 16; }