[compiler-rt] db36d88 - scudo: Allow TBI to be disabled on Linux with a macro.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 16 12:56:40 PDT 2021


Author: Peter Collingbourne
Date: 2021-03-16T12:56:19-07:00
New Revision: db36d882ed185534e125746f86373d434acdf2e6

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

LOG: scudo: Allow TBI to be disabled on Linux with a macro.

Android's native bridge (i.e. AArch64 emulator) doesn't support TBI so
we need a way to disable TBI on Linux when targeting the native bridge.

This can also be used to test the no-TBI code path on Linux (currently
only used on Fuchsia), or make Scudo compatible with very old
(pre-commit d50240a5f6ceaf690a77b0fccb17be51cfa151c2 from June 2013)
Linux kernels that do not enable TBI.

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

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 ea504bbbf7a1..0a8a0b52173a 100644
--- a/compiler-rt/lib/scudo/standalone/memtag.h
+++ b/compiler-rt/lib/scudo/standalone/memtag.h
@@ -26,7 +26,7 @@ void setRandomTag(void *Ptr, uptr Size, uptr ExcludeMask, uptr *TaggedBegin,
 // 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
+#if SCUDO_LINUX && !defined(SCUDO_DISABLE_TBI)
 inline constexpr bool archSupportsMemoryTagging() { return true; }
 #else
 inline constexpr bool archSupportsMemoryTagging() { return false; }


        


More information about the llvm-commits mailing list