[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 09/17] linux-user/aarch64: Implement PR_TAGGED_ADDR_ENABLE
From: |
Richard Henderson |
Subject: |
[PATCH v2 09/17] linux-user/aarch64: Implement PR_TAGGED_ADDR_ENABLE |
Date: |
Thu, 4 Jun 2020 21:17:25 -0700 |
This is the prctl bit that controls whether syscalls accept tagged
addresses. See Documentation/arm64/tagged-address-abi.rst in the
linux kernel.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
linux-user/aarch64/target_syscall.h | 4 ++++
linux-user/syscall.c | 23 +++++++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/linux-user/aarch64/target_syscall.h
b/linux-user/aarch64/target_syscall.h
index 995e475c73..5fb0bf4a5d 100644
--- a/linux-user/aarch64/target_syscall.h
+++ b/linux-user/aarch64/target_syscall.h
@@ -29,4 +29,8 @@ struct target_pt_regs {
# define TARGET_PR_PAC_APDBKEY (1 << 3)
# define TARGET_PR_PAC_APGAKEY (1 << 4)
+#define TARGET_PR_SET_TAGGED_ADDR_CTRL 55
+#define TARGET_PR_GET_TAGGED_ADDR_CTRL 56
+# define TARGET_PR_TAGGED_ADDR_ENABLE (1UL << 0)
+
#endif /* AARCH64_TARGET_SYSCALL_H */
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index d190fb1122..e4da53c5b3 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -10460,6 +10460,29 @@ static abi_long do_syscall1(void *cpu_env, int num,
abi_long arg1,
}
}
return -TARGET_EINVAL;
+ case TARGET_PR_SET_TAGGED_ADDR_CTRL:
+ {
+ abi_ulong valid_mask = TARGET_PR_TAGGED_ADDR_ENABLE;
+
+ if ((arg2 & ~valid_mask) || arg3 || arg4 || arg5) {
+ return -TARGET_EINVAL;
+ }
+ untagged_addr_mask = (arg2 & TARGET_PR_TAGGED_ADDR_ENABLE
+ ? MAKE_64BIT_MASK(0, 56) : -1);
+ return 0;
+ }
+ case TARGET_PR_GET_TAGGED_ADDR_CTRL:
+ {
+ abi_long ret = 0;
+
+ if (arg2 || arg3 || arg4 || arg5) {
+ return -TARGET_EINVAL;
+ }
+ if (~untagged_addr_mask != 0) {
+ ret |= TARGET_PR_TAGGED_ADDR_ENABLE;
+ }
+ return ret;
+ }
#endif /* AARCH64 */
case PR_GET_SECCOMP:
case PR_SET_SECCOMP:
--
2.25.1
- [PATCH v2 04/17] linux-user: Tidy VERIFY_READ/VERIFY_WRITE, (continued)
- [PATCH v2 04/17] linux-user: Tidy VERIFY_READ/VERIFY_WRITE, Richard Henderson, 2020/06/05
- [PATCH v2 05/17] bsd-user: Tidy VERIFY_READ/VERIFY_WRITE, Richard Henderson, 2020/06/05
- [PATCH v2 06/17] linux-user: Do not use guest_addr_valid for h2g_valid, Richard Henderson, 2020/06/05
- [PATCH v2 07/17] linux-user: Fix guest_addr_valid vs reserved_va, Richard Henderson, 2020/06/05
- [PATCH v2 08/17] exec: Add support for TARGET_TAGGED_ADDRESSES, Richard Henderson, 2020/06/05
- [PATCH v2 09/17] linux-user/aarch64: Implement PR_TAGGED_ADDR_ENABLE,
Richard Henderson <=
- [PATCH v2 10/17] linux-user/aarch64: Implement PR_MTE_TCF and PR_MTE_TAG, Richard Henderson, 2020/06/05
- [PATCH v2 11/17] linux-user/aarch64: Implement PROT_MTE, Richard Henderson, 2020/06/05
- [PATCH v2 12/17] linux-user/aarch64: Pass syndrome to EXC_*_ABORT, Richard Henderson, 2020/06/05
- [PATCH v2 13/17] linux-user/aarch64: Signal SEGV_MTESERR for sync tag check fault, Richard Henderson, 2020/06/05
- [PATCH v2 14/17] linux-user/aarch64: Signal SEGV_MTEAERR for async tag check error, Richard Henderson, 2020/06/05
- [PATCH v2 15/17] target/arm: Add allocation tag storage for user mode, Richard Henderson, 2020/06/05