[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/22] linux-user: Implement PR_PAC_RESET_KEYS
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 10/22] linux-user: Implement PR_PAC_RESET_KEYS |
Date: |
Tue, 5 Feb 2019 17:04:58 +0000 |
From: Richard Henderson <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
Message-id: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
---
linux-user/aarch64/target_syscall.h | 7 ++++++
linux-user/syscall.c | 36 +++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/linux-user/aarch64/target_syscall.h
b/linux-user/aarch64/target_syscall.h
index 937fd7989e7..b595e5da820 100644
--- a/linux-user/aarch64/target_syscall.h
+++ b/linux-user/aarch64/target_syscall.h
@@ -22,6 +22,13 @@ struct target_pt_regs {
#define TARGET_PR_SVE_SET_VL 50
#define TARGET_PR_SVE_GET_VL 51
+#define TARGET_PR_PAC_RESET_KEYS 54
+# define TARGET_PR_PAC_APIAKEY (1 << 0)
+# define TARGET_PR_PAC_APIBKEY (1 << 1)
+# define TARGET_PR_PAC_APDAKEY (1 << 2)
+# define TARGET_PR_PAC_APDBKEY (1 << 3)
+# define TARGET_PR_PAC_APGAKEY (1 << 4)
+
void arm_init_pauth_key(ARMPACKey *key);
#endif /* AARCH64_TARGET_SYSCALL_H */
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b5786d4fc1f..bf076cbf8c4 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9691,6 +9691,42 @@ static abi_long do_syscall1(void *cpu_env, int num,
abi_long arg1,
}
}
return ret;
+ case TARGET_PR_PAC_RESET_KEYS:
+ {
+ CPUARMState *env = cpu_env;
+ ARMCPU *cpu = arm_env_get_cpu(env);
+
+ if (arg3 || arg4 || arg5) {
+ return -TARGET_EINVAL;
+ }
+ if (cpu_isar_feature(aa64_pauth, cpu)) {
+ int all = (TARGET_PR_PAC_APIAKEY | TARGET_PR_PAC_APIBKEY |
+ TARGET_PR_PAC_APDAKEY | TARGET_PR_PAC_APDBKEY |
+ TARGET_PR_PAC_APGAKEY);
+ if (arg2 == 0) {
+ arg2 = all;
+ } else if (arg2 & ~all) {
+ return -TARGET_EINVAL;
+ }
+ if (arg2 & TARGET_PR_PAC_APIAKEY) {
+ arm_init_pauth_key(&env->apia_key);
+ }
+ if (arg2 & TARGET_PR_PAC_APIBKEY) {
+ arm_init_pauth_key(&env->apib_key);
+ }
+ if (arg2 & TARGET_PR_PAC_APDAKEY) {
+ arm_init_pauth_key(&env->apda_key);
+ }
+ if (arg2 & TARGET_PR_PAC_APDBKEY) {
+ arm_init_pauth_key(&env->apdb_key);
+ }
+ if (arg2 & TARGET_PR_PAC_APGAKEY) {
+ arm_init_pauth_key(&env->apga_key);
+ }
+ return 0;
+ }
+ }
+ return -TARGET_EINVAL;
#endif /* AARCH64 */
case PR_GET_SECCOMP:
case PR_SET_SECCOMP:
--
2.20.1
- [Qemu-devel] [PULL 00/22] target-arm queue, Peter Maydell, 2019/02/05
- [Qemu-devel] [PULL 02/22] target/arm: Add PSTATE.BTYPE, Peter Maydell, 2019/02/05
- [Qemu-devel] [PULL 10/22] linux-user: Implement PR_PAC_RESET_KEYS,
Peter Maydell <=
- [Qemu-devel] [PULL 21/22] hw/arm/boot: Support DTB autoload for firmware-only boots, Peter Maydell, 2019/02/05
- [Qemu-devel] [PULL 01/22] target/arm: Introduce isar_feature_aa64_bti, Peter Maydell, 2019/02/05
- [Qemu-devel] [PULL 15/22] target/arm: Enable TBI for user-only, Peter Maydell, 2019/02/05
- [Qemu-devel] [PULL 04/22] exec: Add target-specific tlb bits to MemTxAttrs, Peter Maydell, 2019/02/05
- [Qemu-devel] [PULL 07/22] target/arm: Reset btype for direct branches, Peter Maydell, 2019/02/05
- [Qemu-devel] [PULL 09/22] target/arm: Enable BTI for -cpu max, Peter Maydell, 2019/02/05
- [Qemu-devel] [PULL 14/22] target/arm: Compute TB_FLAGS for TBI for user-only, Peter Maydell, 2019/02/05
- [Qemu-devel] [PULL 19/22] hw/arm/boot: Factor out "set up firmware boot" code, Peter Maydell, 2019/02/05
- [Qemu-devel] [PULL 12/22] target/arm: Add TBFLAG_A64_TBID, split out gen_top_byte_ignore, Peter Maydell, 2019/02/05
- [Qemu-devel] [PULL 03/22] target/arm: Add BT and BTYPE to tb->flags, Peter Maydell, 2019/02/05