[PATCH] D93513: scudo: Remove ANDROID_EXPERIMENTAL_MTE macro.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 21 10:53:51 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdfa40840e0e2: scudo: Remove ANDROID_EXPERIMENTAL_MTE macro. (authored by pcc).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93513/new/
https://reviews.llvm.org/D93513
Files:
compiler-rt/lib/scudo/standalone/linux.cpp
compiler-rt/lib/scudo/standalone/memtag.h
Index: compiler-rt/lib/scudo/standalone/memtag.h
===================================================================
--- compiler-rt/lib/scudo/standalone/memtag.h
+++ compiler-rt/lib/scudo/standalone/memtag.h
@@ -14,9 +14,6 @@
#if SCUDO_LINUX
#include <sys/auxv.h>
#include <sys/prctl.h>
-#if defined(ANDROID_EXPERIMENTAL_MTE)
-#include <bionic/mte_kernel.h>
-#endif
#endif
namespace scudo {
@@ -56,20 +53,28 @@
#if defined(__aarch64__)
inline bool systemSupportsMemoryTagging() {
-#if defined(ANDROID_EXPERIMENTAL_MTE)
- return getauxval(AT_HWCAP2) & HWCAP2_MTE;
-#else
- return false;
+#ifndef HWCAP2_MTE
+#define HWCAP2_MTE (1 << 18)
#endif
+ return getauxval(AT_HWCAP2) & HWCAP2_MTE;
}
inline bool systemDetectsMemoryTagFaultsTestOnly() {
-#if defined(ANDROID_EXPERIMENTAL_MTE)
- return (prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0) & PR_MTE_TCF_MASK) !=
- PR_MTE_TCF_NONE;
-#else
- return false;
+#ifndef PR_GET_TAGGED_ADDR_CTRL
+#define PR_GET_TAGGED_ADDR_CTRL 56
+#endif
+#ifndef PR_MTE_TCF_SHIFT
+#define PR_MTE_TCF_SHIFT 1
+#endif
+#ifndef PR_MTE_TCF_NONE
+#define PR_MTE_TCF_NONE (0UL << PR_MTE_TCF_SHIFT)
+#endif
+#ifndef PR_MTE_TCF_MASK
+#define PR_MTE_TCF_MASK (3UL << PR_MTE_TCF_SHIFT)
#endif
+ return (static_cast<unsigned long>(
+ prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0)) &
+ PR_MTE_TCF_MASK) != PR_MTE_TCF_NONE;
}
inline void disableMemoryTagChecksTestOnly() {
Index: compiler-rt/lib/scudo/standalone/linux.cpp
===================================================================
--- compiler-rt/lib/scudo/standalone/linux.cpp
+++ compiler-rt/lib/scudo/standalone/linux.cpp
@@ -35,10 +35,6 @@
#define ANDROID_PR_SET_VMA_ANON_NAME 0
#endif
-#ifdef ANDROID_EXPERIMENTAL_MTE
-#include <bionic/mte_kernel.h>
-#endif
-
namespace scudo {
uptr getPageSize() { return static_cast<uptr>(sysconf(_SC_PAGESIZE)); }
@@ -54,7 +50,10 @@
MmapProt = PROT_NONE;
} else {
MmapProt = PROT_READ | PROT_WRITE;
-#if defined(__aarch64__) && defined(ANDROID_EXPERIMENTAL_MTE)
+#if defined(__aarch64__)
+#ifndef PROT_MTE
+#define PROT_MTE 0x20
+#endif
if (Flags & MAP_MEMTAG)
MmapProt |= PROT_MTE;
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93513.313154.patch
Type: text/x-patch
Size: 2188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201221/62c9cca8/attachment.bin>
More information about the llvm-commits
mailing list