forked from OSchip/llvm-project
scudo: Remove ANDROID_EXPERIMENTAL_MTE macro.
Kernel support for MTE has been released in Linux 5.10. This means that it is a stable API and we no longer need to make the support conditional on a macro. We do need to provide conditional definitions of the new macros though in order to avoid a dependency on new kernel headers. Differential Revision: https://reviews.llvm.org/D93513
This commit is contained in:
parent
bb8d20d9f3
commit
dfa40840e0
|
@ -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 @@ void *map(void *Addr, uptr Size, UNUSED const char *Name, uptr Flags,
|
|||
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
|
||||
|
|
|
@ -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 @@ inline uint8_t extractTag(uptr Ptr) {
|
|||
#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() {
|
||||
|
|
Loading…
Reference in New Issue