[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 33/45] linux-user/aarch64: Implement PROT_MTE
From: |
Peter Maydell |
Subject: |
[PULL 33/45] linux-user/aarch64: Implement PROT_MTE |
Date: |
Thu, 11 Feb 2021 12:58:48 +0000 |
From: Richard Henderson <richard.henderson@linaro.org>
Remember the PROT_MTE bit as PAGE_MTE/PAGE_TARGET_2.
Otherwise this does not yet have effect.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20210210000223.884088-25-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
include/exec/cpu-all.h | 1 +
linux-user/syscall_defs.h | 1 +
target/arm/cpu.h | 1 +
linux-user/mmap.c | 22 ++++++++++++++--------
4 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index d6ad774c015..09b9be845d1 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -284,6 +284,7 @@ extern intptr_t qemu_host_page_mask;
#endif
/* Target-specific bits that will be used via page_get_flags(). */
#define PAGE_TARGET_1 0x0080
+#define PAGE_TARGET_2 0x0200
#if defined(CONFIG_USER_ONLY)
void page_dump(FILE *f);
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index f98c1c1c8de..46a960fccb4 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -1311,6 +1311,7 @@ struct target_winsize {
#ifdef TARGET_AARCH64
#define TARGET_PROT_BTI 0x10
+#define TARGET_PROT_MTE 0x20
#endif
/* Common */
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 72a0819eb8c..efa1618c4d5 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -3608,6 +3608,7 @@ static inline MemTxAttrs *typecheck_memtxattrs(MemTxAttrs
*x)
* AArch64 usage of the PAGE_TARGET_* bits for linux-user.
*/
#define PAGE_BTI PAGE_TARGET_1
+#define PAGE_MTE PAGE_TARGET_2
#ifdef TARGET_TAGGED_ADDRESSES
/**
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 6690384752f..85e218ab1d0 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -84,18 +84,24 @@ static int validate_prot_to_pageflags(int *host_prot, int
prot)
| (prot & PROT_EXEC ? PROT_READ : 0);
#ifdef TARGET_AARCH64
- /*
- * The PROT_BTI bit is only accepted if the cpu supports the feature.
- * Since this is the unusual case, don't bother checking unless
- * the bit has been requested. If set and valid, record the bit
- * within QEMU's page_flags.
- */
- if (prot & TARGET_PROT_BTI) {
+ {
ARMCPU *cpu = ARM_CPU(thread_cpu);
- if (cpu_isar_feature(aa64_bti, cpu)) {
+
+ /*
+ * The PROT_BTI bit is only accepted if the cpu supports the feature.
+ * Since this is the unusual case, don't bother checking unless
+ * the bit has been requested. If set and valid, record the bit
+ * within QEMU's page_flags.
+ */
+ if ((prot & TARGET_PROT_BTI) && cpu_isar_feature(aa64_bti, cpu)) {
valid |= TARGET_PROT_BTI;
page_flags |= PAGE_BTI;
}
+ /* Similarly for the PROT_MTE bit. */
+ if ((prot & TARGET_PROT_MTE) && cpu_isar_feature(aa64_mte, cpu)) {
+ valid |= TARGET_PROT_MTE;
+ page_flags |= PAGE_MTE;
+ }
}
#endif
--
2.20.1
- [PULL 29/45] linux-user/aarch64: Implement PR_TAGGED_ADDR_ENABLE, (continued)
- [PULL 29/45] linux-user/aarch64: Implement PR_TAGGED_ADDR_ENABLE, Peter Maydell, 2021/02/11
- [PULL 35/45] linux-user/aarch64: Pass syndrome to EXC_*_ABORT, Peter Maydell, 2021/02/11
- [PULL 31/45] target/arm: Use the proper TBI settings for linux-user, Peter Maydell, 2021/02/11
- [PULL 39/45] target/arm: Enable MTE for user-only, Peter Maydell, 2021/02/11
- [PULL 22/45] linux-user: Explicitly untag memory management syscalls, Peter Maydell, 2021/02/11
- [PULL 26/45] linux-user: Move lock_user et al out of line, Peter Maydell, 2021/02/11
- [PULL 28/45] linux-user: Handle tags in lock_user/unlock_user, Peter Maydell, 2021/02/11
- [PULL 27/45] linux-user: Fix types in uaccess.c, Peter Maydell, 2021/02/11
- [PULL 30/45] target/arm: Improve gen_top_byte_ignore, Peter Maydell, 2021/02/11
- [PULL 32/45] linux-user/aarch64: Implement PR_MTE_TCF and PR_MTE_TAG, Peter Maydell, 2021/02/11
- [PULL 33/45] linux-user/aarch64: Implement PROT_MTE,
Peter Maydell <=
- [PULL 34/45] target/arm: Split out syndrome.h from internals.h, Peter Maydell, 2021/02/11
- [PULL 36/45] linux-user/aarch64: Signal SEGV_MTESERR for sync tag check fault, Peter Maydell, 2021/02/11
- [PULL 43/45] tests/qtests: Add npcm7xx emc model test, Peter Maydell, 2021/02/11
- [PULL 41/45] hw/net: Add npcm7xx emc model, Peter Maydell, 2021/02/11
- [PULL 37/45] linux-user/aarch64: Signal SEGV_MTEAERR for async tag check error, Peter Maydell, 2021/02/11
- [PULL 44/45] hw/arm: versal: Use nr_apu_cpus in favor of hard coding 2, Peter Maydell, 2021/02/11
- [PULL 38/45] target/arm: Add allocation tag storage for user mode, Peter Maydell, 2021/02/11
- [PULL 40/45] tests/tcg/aarch64: Add mte smoke tests, Peter Maydell, 2021/02/11
- [PULL 42/45] hw/arm: Add npcm7xx emc model, Peter Maydell, 2021/02/11
- [PULL 45/45] target/arm: Correctly initialize MDCR_EL2.HPMN, Peter Maydell, 2021/02/11