This regset allows read/write access to a ptraced process prctl(PR_SET_TAGGED_ADDR_CTRL) setting.
Unified · Split
| @@ -1033,6 +1033,35 @@ static int pac_generic_keys_set(struct task_struct *target, · 1032 unmodified lines | ||
| 1033 | 1033 | #endif /* CONFIG_CHECKPOINT_RESTORE */ |
| 1034 | 1034 | #endif /* CONFIG_ARM64_PTR_AUTH */ |
| 1035 | 1035 | |
| 1036 | +#ifdef CONFIG_ARM64_TAGGED_ADDR_ABI | |
| 1037 | +static 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 | + | |
| 1049 | +static 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 | + | |
| 1036 | 1065 | enum aarch64_regset { |
| 1037 | 1066 | REGSET_GPR, |
| 1038 | 1067 | REGSET_FPR, |
| @@ -1052,6 +1081,9 @@ enum aarch64_regset { · 13 unmodified lines | ||
| 1052 | 1081 | REGSET_PACG_KEYS, |
| 1053 | 1082 | #endif |
| 1054 | 1083 | #endif |
| 1084 | +#ifdef CONFIG_ARM64_TAGGED_ADDR_ABI | |
| 1085 | + REGSET_TAGGED_ADDR_CTRL, | |
| 1086 | +#endif | |
| 1055 | 1087 | }; |
| 1056 | 1088 | |
| 1057 | 1089 | static const struct user_regset aarch64_regsets[] = { |
| @@ -1149,6 +1181,16 @@ static const struct user_regset aarch64_regsets[] = { · 91 unmodified lines | ||
| 1149 | 1181 | }, |
| 1150 | 1182 | #endif |
| 1151 | 1183 | #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 | |
| 1154 | 1196 | static const struct user_regset_view user_aarch64_view = { |
| @@ -425,6 +425,7 @@ typedef struct elf64_shdr { · 424 unmodified lines | ||
| 425 | 425 | #define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication code masks */ |
| 426 | 426 | #define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication address keys */ |
| 427 | 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 | 429 | #define NT_ARC_V2 0x600 /* ARCv2 accumulator/extra registers */ |
| 429 | 430 | #define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note */ |
| 430 | 431 | #define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */ |