History

arm64: mte: ptrace: Add NT_ARM_TAGGED_ADDR_CTRL regset

This regset allows read/write access to a ptraced process prctl(PR_SET_TAGGED_ADDR_CTRL) setting.

Catalin Marinas committed 6 years ago

Commit 2200aa71 parent 18ddbaa2 files · +43 −0Browse files

Unified · Split

2 files
  1. arch/arm64/kernel/ptrace.c +42 −0
  2. include/uapi/linux/elf.h +1 −0
arch/arm64/kernel/ptrace.c+42−0
@@ -1033,6 +1033,35 @@ static int pac_generic_keys_set(struct task_struct *target, · 1032 unmodified lines
1033#endif /* CONFIG_CHECKPOINT_RESTORE */1033#endif /* CONFIG_CHECKPOINT_RESTORE */
1034#endif /* CONFIG_ARM64_PTR_AUTH */1034#endif /* CONFIG_ARM64_PTR_AUTH */
1035 1035
1036#ifdef CONFIG_ARM64_TAGGED_ADDR_ABI
1037static int tagged_addr_ctrl_get(struct task_struct *target,
1038 const struct user_regset *regset,
1039 struct membuf to)
1040{
1041 long ctrl = get_tagged_addr_ctrl(target);
1042
1043 if (IS_ERR_VALUE(ctrl))
1044 return ctrl;
1045
1046 return membuf_write(&to, &ctrl, sizeof(ctrl));
1047}
1048
1049static int tagged_addr_ctrl_set(struct task_struct *target, const struct
1050 user_regset *regset, unsigned int pos,
1051 unsigned int count, const void *kbuf, const
1052 void __user *ubuf)
1053{
1054 int ret;
1055 long ctrl;
1056
1057 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &ctrl, 0, -1);
1058 if (ret)
1059 return ret;
1060
1061 return set_tagged_addr_ctrl(target, ctrl);
1062}
1063#endif
1064
1036enum aarch64_regset {1065enum aarch64_regset {
1037 REGSET_GPR,1066 REGSET_GPR,
1038 REGSET_FPR,1067 REGSET_FPR,
@@ -1052,6 +1081,9 @@ enum aarch64_regset { · 13 unmodified lines
1052 REGSET_PACG_KEYS,1081 REGSET_PACG_KEYS,
1053#endif1082#endif
1054#endif1083#endif
1084#ifdef CONFIG_ARM64_TAGGED_ADDR_ABI
1085 REGSET_TAGGED_ADDR_CTRL,
1086#endif
1055};1087};
1056 1088
1057static const struct user_regset aarch64_regsets[] = {1089static const struct user_regset aarch64_regsets[] = {
@@ -1149,6 +1181,16 @@ static const struct user_regset aarch64_regsets[] = { · 91 unmodified lines
1149 },1181 },
1150#endif1182#endif
1151#endif1183#endif
1184#ifdef CONFIG_ARM64_TAGGED_ADDR_ABI
1185 [REGSET_TAGGED_ADDR_CTRL] = {
1186 .core_note_type = NT_ARM_TAGGED_ADDR_CTRL,
1187 .n = 1,
1188 .size = sizeof(long),
1189 .align = sizeof(long),
1190 .regset_get = tagged_addr_ctrl_get,
1191 .set = tagged_addr_ctrl_set,
1192 },
1193#endif
1152};1194};
1153 1195
1154static const struct user_regset_view user_aarch64_view = {1196static const struct user_regset_view user_aarch64_view = {
include/uapi/linux/elf.h+1−0
@@ -425,6 +425,7 @@ typedef struct elf64_shdr { · 424 unmodified lines
425#define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication code masks */425#define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication code masks */
426#define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication address keys */426#define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication address keys */
427#define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication generic key */427#define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication generic key */
428#define NT_ARM_TAGGED_ADDR_CTRL 0x409 /* arm64 tagged address control (prctl()) */
428#define NT_ARC_V2 0x600 /* ARCv2 accumulator/extra registers */429#define NT_ARC_V2 0x600 /* ARCv2 accumulator/extra registers */
429#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note */430#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note */
430#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */431#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */