Changeset View
Changeset View
Standalone View
Standalone View
sys/arm64/arm64/ptrauth.c
| Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | out: | ||||
| update_special_reg(ID_AA64ISAR1_EL1, ID_AA64ISAR1_API_MASK | | update_special_reg(ID_AA64ISAR1_EL1, ID_AA64ISAR1_API_MASK | | ||||
| ID_AA64ISAR1_APA_MASK | ID_AA64ISAR1_GPA_MASK | | ID_AA64ISAR1_APA_MASK | ID_AA64ISAR1_GPA_MASK | | ||||
| ID_AA64ISAR1_GPI_MASK, 0); | ID_AA64ISAR1_GPI_MASK, 0); | ||||
| update_special_reg(ID_AA64ISAR2_EL1, ID_AA64ISAR2_APA3_MASK, 0); | update_special_reg(ID_AA64ISAR2_EL1, ID_AA64ISAR2_APA3_MASK, 0); | ||||
| return (false); | return (false); | ||||
| } | } | ||||
| static void | static bool | ||||
| ptrauth_enable(const struct cpu_feat *feat __unused, | ptrauth_enable(const struct cpu_feat *feat __unused, | ||||
| cpu_feat_errata errata_status __unused, u_int *errata_list __unused, | cpu_feat_errata errata_status __unused, u_int *errata_list __unused, | ||||
| u_int errata_count __unused) | u_int errata_count __unused) | ||||
| { | { | ||||
| enable_ptrauth = true; | enable_ptrauth = true; | ||||
| elf64_addr_mask.code |= PAC_ADDR_MASK; | elf64_addr_mask.code |= PAC_ADDR_MASK; | ||||
| elf64_addr_mask.data |= PAC_ADDR_MASK; | elf64_addr_mask.data |= PAC_ADDR_MASK; | ||||
| #ifdef COMPAT_FREEBSD14 | #ifdef COMPAT_FREEBSD14 | ||||
| elf64_addr_mask_14.code |= PAC_ADDR_MASK_14; | elf64_addr_mask_14.code |= PAC_ADDR_MASK_14; | ||||
| elf64_addr_mask_14.data |= PAC_ADDR_MASK_14; | elf64_addr_mask_14.data |= PAC_ADDR_MASK_14; | ||||
| #endif | #endif | ||||
| return (true); | |||||
| } | } | ||||
| CPU_FEAT(feat_pauth, | CPU_FEAT(feat_pauth, "Pointer Authentication", | ||||
| ptrauth_check, NULL, ptrauth_enable, | ptrauth_check, NULL, ptrauth_enable, | ||||
| CPU_FEAT_EARLY_BOOT | CPU_FEAT_SYSTEM); | CPU_FEAT_EARLY_BOOT | CPU_FEAT_SYSTEM); | ||||
| /* Copy the keys when forking a new process */ | /* Copy the keys when forking a new process */ | ||||
| void | void | ||||
| ptrauth_fork(struct thread *new_td, struct thread *orig_td) | ptrauth_fork(struct thread *new_td, struct thread *orig_td) | ||||
| { | { | ||||
| if (!enable_ptrauth) | if (!enable_ptrauth) | ||||
| ▲ Show 20 Lines • Show All 167 Lines • Show Last 20 Lines | |||||