arm64: Support of PAuth QARMA3 architected algorithm
v2 cover arm64: Support of PAuth QARMA3 architected algorithm
QARMA3 is relaxed version of the QARMA5 algorithm which expected to reduce the latency of calculation while still delivering a suitable level of security.
Feature advertised via a new ID fields in ID_AA64ISAR2_EL1 [1], so we need to teach the kernel to identify this.
Changelog:
v1 -> v2
- Removed unintended whitespace change in sysreg.h
- FTR_ALIAS_OPTION_LEN now accounts null terminator
- Extract only APA3 bits from ID_AA64ISAR2_APA3_SHIFT (in contrast to id_aa64isar1_el1 where both APA and API bits are extracted) in asm_pointer_auth.h
Thanks!
Vladimir Murzin (4):
arm64: cpufeature: Account min_field_value when cheking secondaries
for PAuth
arm64: cpufeature: Warn if mutually exclusive PAuth algorithms
detected
arm64: cpufeature: Mark existing PAuth architected algorithm as QARMA5
arm64: Add support of PAuth QARMA3 architected algorithm
arch/arm64/include/asm/asm_pointer_auth.h | 3 ++ arch/arm64/include/asm/cpufeature.h | 1 + arch/arm64/include/asm/kvm_hyp.h | 1 + arch/arm64/include/asm/sysreg.h | 12 +++++ arch/arm64/kernel/cpufeature.c | 63 ++++++++++++++++++++++---- arch/arm64/kernel/idreg-override.c | 16 ++++++- arch/arm64/kvm/arm.c | 1 + arch/arm64/kvm/hyp/include/nvhe/fixed_config.h | 5 ++ arch/arm64/kvm/hyp/nvhe/sys_regs.c | 14 ++++++ arch/arm64/kvm/sys_regs.c | 5 ++ arch/arm64/tools/cpucaps | 6 ++- 11 files changed, 114 insertions(+), 13 deletions(-)
Signature · 7 lines
2.7.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 1/4 arm64: cpufeature: Account min_field_value when cheking secondaries for PAuth
In case, both boot_val and sec_val have value below min_field_value we would wrongly report that address authentication is supported. It is not a big issue because we enable address authentication based on boot cpu (and check there is correct).
--- arch/arm64/kernel/cpufeature.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/cpufeature.c +1 -1
@@ -1826,7 +1826,7 @@ static bool has_address_auth_cpucap(const struct arm64_cpu_capabilities *entry,/* Now check for the secondary CPUs with SCOPE_LOCAL_CPU scope */ sec_val =cpuid_feature_extract_field (__read_sysreg_by_encoding (entry->sys_reg), entry->field_pos, entry->sign); -return sec_val == boot_val; +return (sec_val >= entry->min_field_value) && (sec_val == boot_val); } static bool has_address_auth_metacap(const struct arm64_cpu_capabilities *entry,
Signature · 7 lines
2.7.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v2 1/4] arm64: cpufeature: Account min_field_value when cheking secondaries for PAuth
Quoted 6 lines · Vladimir Murzin
In case, both
boot_valandsec_valhave value belowmin_field_valuewe would wrongly report that address authentication is supported. It is not a big issue because we enable address authentication based on boot cpu (and check there is correct).Signed-off-by Vladimir Murzin <[email protected]>
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 2/4 arm64: cpufeature: Warn if mutually exclusive PAuth algorithms detected
In reply to Vladimir MurzinARM ARM states for address authentication algorithms
APA, bits [7:4] If the value of ID_AA64ISAR1_EL1.API is non-zero, this
field must have the value 0b0000.
API, bits [11:8] If the value of ID_AA64ISAR1_EL1.APA is non-zero,
this field must have the value 0b0000.
Similarly for generic code authentication algorithms
GPA, bits [27:24] If the value of ID_AA64ISAR1_EL1.GPI is non-zero,
this field must have the value 0b0000.
GPI, bits [31:28] If the value of ID_AA64ISAR1_EL1.GPA is non-zero,
this field must have the value 0b0000.
Let's add a warning if that not true.
--- arch/arm64/kernel/cpufeature.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
arch/arm64/kernel/cpufeature.c +12 -4
@@ -1832,15 +1832,23 @@ static bool has_address_auth_cpucap(const struct arm64_cpu_capabilities *entry,static bool has_address_auth_metacap (const struct arm64_cpu_capabilities *entry,int scope) { -return has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH ], scope) || -has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_IMP_DEF ], scope); +bool api =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_IMP_DEF ], scope); +bool apa =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH ], scope); + +WARN_ON (apa && api); + +return apa || api; }static bool has_generic_auth (const struct arm64_cpu_capabilities *entry,int __unused) { -return __system_matches_cap (ARM64_HAS_GENERIC_AUTH_ARCH ) || -__system_matches_cap (ARM64_HAS_GENERIC_AUTH_IMP_DEF ); +bool gpi =__system_matches_cap (ARM64_HAS_GENERIC_AUTH_IMP_DEF ); +bool gpa =__system_matches_cap (ARM64_HAS_GENERIC_AUTH_ARCH ); + +WARN_ON (gpa && gpi); + +return gpa || gpi; }#endif /* CONFIG_ARM64_PTR_AUTH */
Signature · 7 lines
2.7.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v2 2/4] arm64: cpufeature: Warn if mutually exclusive PAuth algorithms detected
Quoted 13 lines · Vladimir Murzin
ARM ARM states for address authentication algorithms
APA, bits [7:4] If the value of ID_AA64ISAR1_EL1.API is non-zero, this
field must have the value 0b0000.API, bits [11:8] If the value of ID_AA64ISAR1_EL1.APA is non-zero,
this field must have the value 0b0000.Similarly for generic code authentication algorithms
GPA, bits [27:24] If the value of ID_AA64ISAR1_EL1.GPI is non-zero,
this field must have the value 0b0000.
Quoted 6 lines
GPI, bits [31:28] If the value of ID_AA64ISAR1_EL1.GPA is non-zero,
this field must have the value 0b0000.Let's add a warning if that not true.
Signed-off-by Vladimir Murzin <[email protected]>
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 3/4 arm64: cpufeature: Mark existing PAuth architected algorithm as QARMA5
In reply to Vladimir MurzinIn preparation of supporting PAuth QARMA3 architected algorithm mark existing one as QARMA5, so we can distingwish between two.
--- arch/arm64/kernel/cpufeature.c | 12 ++++++------ arch/arm64/tools/cpucaps | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-)
arch/arm64/kernel/cpufeature.c +6 -6
@@ -1833,7 +1833,7 @@ static bool has_address_auth_metacap(const struct arm64_cpu_capabilities *entry, int scope) {bool api =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_IMP_DEF ], scope); -bool apa =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH ], scope); +bool apa =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA5 ], scope);WARN_ON (apa && api);
@@ -1844,7 +1844,7 @@ static bool has_generic_auth(const struct arm64_cpu_capabilities *entry, int __unused) {bool gpi =__system_matches_cap (ARM64_HAS_GENERIC_AUTH_IMP_DEF ); -bool gpa =__system_matches_cap (ARM64_HAS_GENERIC_AUTH_ARCH ); +bool gpa =__system_matches_cap (ARM64_HAS_GENERIC_AUTH_ARCH_QARMA5 );WARN_ON (gpa && gpi);
@@ -2235,8 +2235,8 @@ static const struct arm64_cpu_capabilities arm64_features[] = { },#ifdef CONFIG_ARM64_PTR_AUTH { - .desc = "Address authentication (architected algorithm)", - .capability = ARM64_HAS_ADDRESS_AUTH_ARCH, + .desc = "Address authentication (architected QARMA5 algorithm)", + .capability = ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA5, .type = ARM64_CPUCAP_BOOT_CPU_FEATURE, .sys_reg = SYS_ID_AA64ISAR1_EL1, .sign = FTR_UNSIGNED,
@@ -2260,8 +2260,8 @@ static const struct arm64_cpu_capabilities arm64_features[] = { .matches = has_address_auth_metacap, }, { - .desc = "Generic authentication (architected algorithm)", - .capability = ARM64_HAS_GENERIC_AUTH_ARCH, + .desc = "Generic authentication (architected QARMA5 algorithm)", + .capability = ARM64_HAS_GENERIC_AUTH_ARCH_QARMA5, .type = ARM64_CPUCAP_SYSTEM_FEATURE, .sys_reg = SYS_ID_AA64ISAR1_EL1, .sign = FTR_UNSIGNED,
arch/arm64/tools/cpucaps +2 -2
@@ -7,7 +7,7 @@ BTI HAS_32BIT_EL0_DO_NOT_USE HAS_32BIT_EL1 HAS_ADDRESS_AUTH -HAS_ADDRESS_AUTH_ARCH +HAS_ADDRESS_AUTH_ARCH_QARMA5 HAS_ADDRESS_AUTH_IMP_DEF HAS_AMU_EXTN HAS_ARMv8_4_TTL
@@ -21,7 +21,7 @@ HAS_E0PD HAS_ECV HAS_EPAN HAS_GENERIC_AUTH -HAS_GENERIC_AUTH_ARCH +HAS_GENERIC_AUTH_ARCH_QARMA5 HAS_GENERIC_AUTH_IMP_DEF HAS_IRQ_PRIO_MASKING HAS_LDAPR
Signature · 7 lines
2.7.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v2 3/4] arm64: cpufeature: Mark existing PAuth architected algorithm as QARMA5
Quoted 4 lines · Vladimir Murzin
In preparation of supporting PAuth QARMA3 architected algorithm mark existing one as QARMA5, so we can distingwish between two.
Signed-off-by Vladimir Murzin <[email protected]>
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 4/4 arm64: Add support of PAuth QARMA3 architected algorithm
In reply to Vladimir MurzinQARMA3 is relaxed version of the QARMA5 algorithm which expected to reduce the latency of calculation while still delivering a suitable level of security.
Support for QARMA3 can be discovered via ID_AA64ISAR2_EL1
APA3, bits [15:12] Indicates whether the QARMA3 algorithm is
implemented in the PE for address authentication in AArch64 state.
GPA3, bits [11:8] Indicates whether the QARMA3 algorithm is
implemented in the PE for generic code authentication in AArch64 state.
--- arch/arm64/include/asm/asm_pointer_auth.h | 3 ++ arch/arm64/include/asm/cpufeature.h | 1 + arch/arm64/include/asm/kvm_hyp.h | 1 + arch/arm64/include/asm/sysreg.h | 12 +++++++ arch/arm64/kernel/cpufeature.c | 45 +++++++++++++++++++++++--- arch/arm64/kernel/idreg-override.c | 16 +++++++-- arch/arm64/kvm/arm.c | 1 + arch/arm64/kvm/hyp/include/nvhe/fixed_config.h | 5 +++ arch/arm64/kvm/hyp/nvhe/sys_regs.c | 14 ++++++++ arch/arm64/kvm/sys_regs.c | 5 +++ arch/arm64/tools/cpucaps | 2 ++ 11 files changed, 99 insertions(+), 6 deletions(-)
arch/arm64/include/asm/asm_pointer_auth.h +3 -0
@@ -60,6 +60,9 @@ alternative_else_nop_endif .macro __ptrauth_keys_init_cpu tsk, tmp1, tmp2, tmp3 mrs \tmp1, id_aa64isar1_el1 ubfx \tmp1, \tmp1, #ID_AA64ISAR1_APA_SHIFT, #8 + mrs_s \tmp2, SYS_ID_AA64ISAR2_EL1 + ubfx \tmp2, \tmp2, #ID_AA64ISAR2_APA3_SHIFT, #4 + orr \tmp1, \tmp1, \tmp2 cbz \tmp1, .Lno_addr_auth\@ mov_q \tmp1, (SCTLR_ELx_ENIA | SCTLR_ELx_ENIB | \ SCTLR_ELx_ENDA | SCTLR_ELx_ENDB)
arch/arm64/include/asm/cpufeature.h +1 -0
@@ -854,6 +854,7 @@ static inline unsigned int get_vmid_bits(u64 mmfr1)extern struct arm64_ftr_override id_aa64mmfr1_override;extern struct arm64_ftr_override id_aa64pfr1_override;extern struct arm64_ftr_override id_aa64isar1_override; +extern struct arm64_ftr_override id_aa64isar2_override;u32 get_kvm_ipa_limit (void );void dump_cpu_features (void );
arch/arm64/include/asm/kvm_hyp.h +1 -0
@@ -118,6 +118,7 @@ extern u64 kvm_nvhe_sym(id_aa64pfr0_el1_sys_val);extern u64 kvm_nvhe_sym (id_aa64pfr1_el1_sys_val );extern u64 kvm_nvhe_sym (id_aa64isar0_el1_sys_val );extern u64 kvm_nvhe_sym (id_aa64isar1_el1_sys_val ); +extern u64 kvm_nvhe_sym (id_aa64isar2_el1_sys_val );extern u64 kvm_nvhe_sym (id_aa64mmfr0_el1_sys_val );extern u64 kvm_nvhe_sym (id_aa64mmfr1_el1_sys_val );extern u64 kvm_nvhe_sym (id_aa64mmfr2_el1_sys_val );
arch/arm64/include/asm/sysreg.h +12 -0
@@ -773,6 +773,8 @@#define ID_AA64ISAR1_GPI_IMP_DEF 0x1/* id_aa64isar2 */ +#define ID_AA64ISAR2_APA3_SHIFT 12 +#define ID_AA64ISAR2_GPA3_SHIFT 8#define ID_AA64ISAR2_RPRES_SHIFT 4#define ID_AA64ISAR2_WFXT_SHIFT 0
@@ -786,6 +788,16 @@#define ID_AA64ISAR2_WFXT_NI 0x0#define ID_AA64ISAR2_WFXT_SUPPORTED 0x2 +#define ID_AA64ISAR2_APA3_NI 0x0 +#define ID_AA64ISAR2_APA3_ARCHITECTED 0x1 +#define ID_AA64ISAR2_APA3_ARCH_EPAC 0x2 +#define ID_AA64ISAR2_APA3_ARCH_EPAC2 0x3 +#define ID_AA64ISAR2_APA3_ARCH_EPAC2_FPAC 0x4 +#define ID_AA64ISAR2_APA3_ARCH_EPAC2_FPAC_CMB 0x5 + +#define ID_AA64ISAR2_GPA3_NI 0x0 +#define ID_AA64ISAR2_GPA3_ARCHITECTED 0x1 +/* id_aa64pfr0 */ #define ID_AA64PFR0_CSV3_SHIFT 60#define ID_AA64PFR0_CSV2_SHIFT 56
arch/arm64/kernel/cpufeature.c +41 -4
103 lines not on this page · raw message
arch/arm64/kernel/idreg-override.c +14 -2
@@ -17,7 +17,7 @@#define FTR_DESC_NAME_LEN 20#define FTR_DESC_FIELD_LEN 10#define FTR_ALIAS_NAME_LEN 30 -#define FTR_ALIAS_OPTION_LEN 80 +#define FTR_ALIAS_OPTION_LEN 116struct ftr_set_desc {char name[FTR_DESC_NAME_LEN ];
@@ -71,6 +71,16 @@ static const struct ftr_set_desc isar1 __initconst = { }, }; +static const struct ftr_set_desc isar2__initconst = { + .name ="id_aa64isar2" , + .override = &id_aa64isar2_override, + .fields = { + {"gpa3" ,ID_AA64ISAR2_GPA3_SHIFT }, + {"apa3" ,ID_AA64ISAR2_APA3_SHIFT }, + {} + }, +}; +extern struct arm64_ftr_override kaslr_feature_override;static const struct ftr_set_desc kaslr__initconst = {
@@ -88,6 +98,7 @@ static const struct ftr_set_desc * const regs[] __initconst = { &mmfr1, &pfr1, &isar1, + &isar2, &kaslr, };
@@ -100,7 +111,8 @@ static const struct { { "arm64.nobti", "id_aa64pfr1.bt=0" }, { "arm64.nopauth","id_aa64isar1.gpi=0 id_aa64isar1.gpa=0 " - "id_aa64isar1.api=0 id_aa64isar1.apa=0" }, +"id_aa64isar1.api=0 id_aa64isar1.apa=0 " + "id_aa64isar2.gpa3=0 id_aa64isar2.apa3=0" }, { "arm64.nomte", "id_aa64pfr1.mte=0" }, { "nokaslr", "kaslr.disabled=1" }, };
arch/arm64/kvm/arm.c +1 -0
@@ -1855,6 +1855,7 @@ static int kvm_hyp_init_protection(u32 hyp_va_bits)kvm_nvhe_sym (id_aa64pfr1_el1_sys_val) =read_sanitised_ftr_reg (SYS_ID_AA64PFR1_EL1 );kvm_nvhe_sym (id_aa64isar0_el1_sys_val) =read_sanitised_ftr_reg (SYS_ID_AA64ISAR0_EL1 );kvm_nvhe_sym (id_aa64isar1_el1_sys_val) =read_sanitised_ftr_reg (SYS_ID_AA64ISAR1_EL1 ); +kvm_nvhe_sym (id_aa64isar2_el1_sys_val) =read_sanitised_ftr_reg (SYS_ID_AA64ISAR2_EL1 );kvm_nvhe_sym (id_aa64mmfr0_el1_sys_val) =read_sanitised_ftr_reg (SYS_ID_AA64MMFR0_EL1 );kvm_nvhe_sym (id_aa64mmfr1_el1_sys_val) =read_sanitised_ftr_reg (SYS_ID_AA64MMFR1_EL1 );kvm_nvhe_sym (id_aa64mmfr2_el1_sys_val) =read_sanitised_ftr_reg (SYS_ID_AA64MMFR2_EL1 );
arch/arm64/kvm/hyp/include/nvhe/fixed_config.h +5 -0
@@ -192,6 +192,11 @@ ARM64_FEATURE_MASK(ID_AA64ISAR1_I8MM) \ ) +#define PVM_ID_AA64ISAR2_ALLOW (\ + ARM64_FEATURE_MASK(ID_AA64ISAR2_GPA3) | \ + ARM64_FEATURE_MASK(ID_AA64ISAR2_APA3) \ + ) +u64 pvm_read_id_reg (const struct kvm_vcpu *vcpu,u32 id);bool kvm_handle_pvm_sysreg (struct kvm_vcpu *vcpu,u64 *exit_code);bool kvm_handle_pvm_restricted (struct kvm_vcpu *vcpu,u64 *exit_code);
arch/arm64/kvm/hyp/nvhe/sys_regs.c +14 -0
@@ -22,6 +22,7 @@ u64 id_aa64pfr0_el1_sys_val;u64 id_aa64pfr1_el1_sys_val;u64 id_aa64isar0_el1_sys_val;u64 id_aa64isar1_el1_sys_val; +u64 id_aa64isar2_el1_sys_val;u64 id_aa64mmfr0_el1_sys_val;u64 id_aa64mmfr1_el1_sys_val;u64 id_aa64mmfr2_el1_sys_val;
@@ -183,6 +184,17 @@ static u64 get_pvm_id_aa64isar1(const struct kvm_vcpu *vcpu)return id_aa64isar1_el1_sys_val & allow_mask; } +static u64 get_pvm_id_aa64isar2 (const struct kvm_vcpu *vcpu) +{ +u64 allow_mask =PVM_ID_AA64ISAR2_ALLOW ; + +if (!vcpu_has_ptrauth (vcpu)) + allow_mask &= ~(ARM64_FEATURE_MASK (ID_AA64ISAR2_APA3 ) | +ARM64_FEATURE_MASK (ID_AA64ISAR2_GPA3 )); + +return id_aa64isar2_el1_sys_val & allow_mask; +} +static u64 get_pvm_id_aa64mmfr0 (const struct kvm_vcpu *vcpu) {u64 set_mask;
@@ -225,6 +237,8 @@ u64 pvm_read_id_reg(const struct kvm_vcpu *vcpu, u32 id)return get_pvm_id_aa64isar0 (vcpu);case SYS_ID_AA64ISAR1_EL1 :return get_pvm_id_aa64isar1 (vcpu); +case SYS_ID_AA64ISAR2_EL1 : +return get_pvm_id_aa64isar2 (vcpu);case SYS_ID_AA64MMFR0_EL1 :return get_pvm_id_aa64mmfr0 (vcpu);case SYS_ID_AA64MMFR1_EL1 :
arch/arm64/kvm/sys_regs.c +5 -0
@@ -1097,6 +1097,11 @@ static u64 read_id_reg(const struct kvm_vcpu *vcpu,ARM64_FEATURE_MASK (ID_AA64ISAR1_GPA ) | ARM64_FEATURE_MASK(ID_AA64ISAR1_GPI));break ; +case SYS_ID_AA64ISAR2_EL1 : +if (!vcpu_has_ptrauth (vcpu)) + val &= ~(ARM64_FEATURE_MASK (ID_AA64ISAR2_APA3 ) | +ARM64_FEATURE_MASK (ID_AA64ISAR2_GPA3 )); +break ;case SYS_ID_AA64DFR0_EL1 :/* Limit debug to ARMv8.0 */ val &= ~ARM64_FEATURE_MASK (ID_AA64DFR0_DEBUGVER );
arch/arm64/tools/cpucaps +2 -0
@@ -7,6 +7,7 @@ BTI HAS_32BIT_EL0_DO_NOT_USE HAS_32BIT_EL1 HAS_ADDRESS_AUTH +HAS_ADDRESS_AUTH_ARCH_QARMA3 HAS_ADDRESS_AUTH_ARCH_QARMA5 HAS_ADDRESS_AUTH_IMP_DEF HAS_AMU_EXTN
@@ -21,6 +22,7 @@ HAS_E0PD HAS_ECV HAS_EPAN HAS_GENERIC_AUTH +HAS_GENERIC_AUTH_ARCH_QARMA3 HAS_GENERIC_AUTH_ARCH_QARMA5 HAS_GENERIC_AUTH_IMP_DEF HAS_IRQ_PRIO_MASKING
Signature · 7 lines
2.7.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v2 4/4] arm64: Add support of PAuth QARMA3 architected algorithm
Quoted 15 lines · Vladimir Murzin
QARMA3 is relaxed version of the QARMA5 algorithm which expected to reduce the latency of calculation while still delivering a suitable level of security.
Support for QARMA3 can be discovered via
ID_AA64ISAR2_EL1APA3, bits [15:12] Indicates whether the QARMA3 algorithm is
implemented in the PE for address authentication in AArch64 state.GPA3, bits [11:8] Indicates whether the QARMA3 algorithm is
implemented in the PE for generic code authentication in AArch64 state.Signed-off-by Vladimir Murzin <[email protected]>
Quoted 13 lines
--- arch/arm64/include/asm/asm_pointer_auth.h | 3 ++ arch/arm64/include/asm/cpufeature.h | 1 + arch/arm64/include/asm/kvm_hyp.h | 1 + arch/arm64/include/asm/sysreg.h | 12 +++++++ arch/arm64/kernel/cpufeature.c | 45 +++++++++++++++++++++++--- arch/arm64/kernel/idreg-override.c | 16 +++++++-- arch/arm64/kvm/arm.c | 1 + arch/arm64/kvm/hyp/include/nvhe/fixed_config.h | 5 +++ arch/arm64/kvm/hyp/nvhe/sys_regs.c | 14 ++++++++ arch/arm64/kvm/sys_regs.c | 5 +++ arch/arm64/tools/cpucaps | 2 ++ 11 files changed, 99 insertions(+), 6 deletions(-)
For the non-KVM bits:
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Will Deacon
maintainerRe: [PATCH v2 4/4] arm64: Add support of PAuth QARMA3 architected algorithm
In reply to Vladimir MurzinQuoted 130 lines · Vladimir Murzin
QARMA3 is relaxed version of the QARMA5 algorithm which expected to reduce the latency of calculation while still delivering a suitable level of security.
Support for QARMA3 can be discovered via
ID_AA64ISAR2_EL1APA3, bits [15:12] Indicates whether the QARMA3 algorithm is
implemented in the PE for address authentication in AArch64 state.GPA3, bits [11:8] Indicates whether the QARMA3 algorithm is
implemented in the PE for generic code authentication in AArch64 state.Signed-off-by Vladimir Murzin <[email protected]>--- arch/arm64/include/asm/asm_pointer_auth.h | 3 ++ arch/arm64/include/asm/cpufeature.h | 1 + arch/arm64/include/asm/kvm_hyp.h | 1 + arch/arm64/include/asm/sysreg.h | 12 +++++++ arch/arm64/kernel/cpufeature.c | 45 +++++++++++++++++++++++--- arch/arm64/kernel/idreg-override.c | 16 +++++++-- arch/arm64/kvm/arm.c | 1 + arch/arm64/kvm/hyp/include/nvhe/fixed_config.h | 5 +++ arch/arm64/kvm/hyp/nvhe/sys_regs.c | 14 ++++++++ arch/arm64/kvm/sys_regs.c | 5 +++ arch/arm64/tools/cpucaps | 2 ++ 11 files changed, 99 insertions(+), 6 deletions(-)arch/arm64/include/asm/asm_pointer_auth.h +3
-0@@ -60,6 +60,9 @@ alternative_else_nop_endif .macro __ptrauth_keys_init_cpu tsk, tmp1, tmp2, tmp3 mrs \tmp1, id_aa64isar1_el1 ubfx \tmp1, \tmp1, #ID_AA64ISAR1_APA_SHIFT, #8 + mrs_s \tmp2, SYS_ID_AA64ISAR2_EL1 + ubfx \tmp2, \tmp2, #ID_AA64ISAR2_APA3_SHIFT, #4 + orr \tmp1, \tmp1, \tmp2 cbz \tmp1, .Lno_addr_auth\@ mov_q \tmp1, (SCTLR_ELx_ENIA | SCTLR_ELx_ENIB | \ SCTLR_ELx_ENDA | SCTLR_ELx_ENDB)arch/arm64/include/asm/cpufeature.h +1
-0@@ -854,6 +854,7 @@ static inline unsigned int get_vmid_bits(u64 mmfr1)extern struct arm64_ftr_override id_aa64mmfr1_override;extern struct arm64_ftr_override id_aa64pfr1_override;extern struct arm64_ftr_override id_aa64isar1_override; +extern struct arm64_ftr_override id_aa64isar2_override;u32 get_kvm_ipa_limit (void );void dump_cpu_features (void );arch/arm64/include/asm/kvm_hyp.h +1
-0@@ -118,6 +118,7 @@ extern u64 kvm_nvhe_sym(id_aa64pfr0_el1_sys_val);extern u64 kvm_nvhe_sym (id_aa64pfr1_el1_sys_val );extern u64 kvm_nvhe_sym (id_aa64isar0_el1_sys_val );extern u64 kvm_nvhe_sym (id_aa64isar1_el1_sys_val ); +extern u64 kvm_nvhe_sym (id_aa64isar2_el1_sys_val );extern u64 kvm_nvhe_sym (id_aa64mmfr0_el1_sys_val );extern u64 kvm_nvhe_sym (id_aa64mmfr1_el1_sys_val );extern u64 kvm_nvhe_sym (id_aa64mmfr2_el1_sys_val );arch/arm64/include/asm/sysreg.h +12
-0@@ -773,6 +773,8 @@#define ID_AA64ISAR1_GPI_IMP_DEF 0x1/* id_aa64isar2 */ +#define ID_AA64ISAR2_APA3_SHIFT 12 +#define ID_AA64ISAR2_GPA3_SHIFT 8#define ID_AA64ISAR2_RPRES_SHIFT 4#define ID_AA64ISAR2_WFXT_SHIFT 0@@ -786,6 +788,16 @@#define ID_AA64ISAR2_WFXT_NI 0x0#define ID_AA64ISAR2_WFXT_SUPPORTED 0x2 +#define ID_AA64ISAR2_APA3_NI 0x0 +#define ID_AA64ISAR2_APA3_ARCHITECTED 0x1 +#define ID_AA64ISAR2_APA3_ARCH_EPAC 0x2 +#define ID_AA64ISAR2_APA3_ARCH_EPAC2 0x3 +#define ID_AA64ISAR2_APA3_ARCH_EPAC2_FPAC 0x4 +#define ID_AA64ISAR2_APA3_ARCH_EPAC2_FPAC_CMB 0x5 + +#define ID_AA64ISAR2_GPA3_NI 0x0 +#define ID_AA64ISAR2_GPA3_ARCHITECTED 0x1 +/* id_aa64pfr0 */ #define ID_AA64PFR0_CSV3_SHIFT 60#define ID_AA64PFR0_CSV2_SHIFT 56arch/arm64/kernel/cpufeature.c +7
-0@@ -226,6 +226,10 @@ static const struct arm64_ftr_bits ftr_id_aa64isar1[] = { };static const struct arm64_ftr_bits ftr_id_aa64isar2[] = { +ARM64_FTR_BITS (FTR_VISIBLE_IF_IS_ENABLED (CONFIG_ARM64_PTR_AUTH ), +FTR_STRICT ,FTR_EXACT ,ID_AA64ISAR2_APA3_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_VISIBLE_IF_IS_ENABLED (CONFIG_ARM64_PTR_AUTH ), +FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64ISAR2_GPA3_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_VISIBLE ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64ISAR2_RPRES_SHIFT ,4 ,0 ),ARM64_FTR_END , };@@ -596,6 +600,7 @@ static const struct arm64_ftr_bits ftr_raz[] = {struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override;struct arm64_ftr_override __ro_after_init id_aa64pfr1_override;struct arm64_ftr_override __ro_after_init id_aa64isar1_override; +struct arm64_ftr_override __ro_after_init id_aa64isar2_override; static const struct __ftr_reg_entry { u32 sys_id;@@ -644,6 +649,8 @@ static const struct __ftr_reg_entry {ARM64_FTR_REG_OVERRIDE (SYS_ID_AA64ISAR1_EL1 , ftr_id_aa64isar1, &id_aa64isar1_override),ARM64_FTR_REG (SYS_ID_AA64ISAR2_EL1 , ftr_id_aa64isar2), +ARM64_FTR_REG_OVERRIDE (SYS_ID_AA64ISAR2_EL1 , ftr_id_aa64isar2, + &id_aa64isar2_override),/* Op1 = 0, CRn = 0, CRm = 7 */ ARM64_FTR_REG(SYS_ID_AA64MMFR0_EL1, ftr_id_aa64mmfr0),
arch/arm64/kernel/cpufeature.c static bool has_address_auth_metacap(const struct arm64_cpu_capabilities *entry, · line 1846
Quoted 7 lines
arch/arm64/kernel/cpufeature.c +2
-1@@ -1834,10 +1841,11 @@ static bool has_address_auth_metacap(const struct arm64_cpu_capabilities *entry, {bool api =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_IMP_DEF ], scope);bool apa =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA5 ], scope); +bool apa3 =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA3 ], scope); -WARN_ON (apa && api); +WARN_ON ((apa && api) || (apa && apa3) || (api && apa3));
I don't really get the point in this warning, what is somebody supposed to do if they hit it? The kernel isn't the right place to make assertions about the CPU design.
Will
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v2 4/4] arm64: Add support of PAuth QARMA3 architected algorithm
Quoted 136 lines · Will Deacon
Quoted 135 lines · Vladimir Murzin
QARMA3 is relaxed version of the QARMA5 algorithm which expected to reduce the latency of calculation while still delivering a suitable level of security.
Support for QARMA3 can be discovered via
ID_AA64ISAR2_EL1APA3, bits [15:12] Indicates whether the QARMA3 algorithm is
implemented in the PE for address authentication in AArch64 state.GPA3, bits [11:8] Indicates whether the QARMA3 algorithm is
implemented in the PE for generic code authentication in AArch64 state.Signed-off-by Vladimir Murzin <[email protected]>--- arch/arm64/include/asm/asm_pointer_auth.h | 3 ++ arch/arm64/include/asm/cpufeature.h | 1 + arch/arm64/include/asm/kvm_hyp.h | 1 + arch/arm64/include/asm/sysreg.h | 12 +++++++ arch/arm64/kernel/cpufeature.c | 45 +++++++++++++++++++++++--- arch/arm64/kernel/idreg-override.c | 16 +++++++-- arch/arm64/kvm/arm.c | 1 + arch/arm64/kvm/hyp/include/nvhe/fixed_config.h | 5 +++ arch/arm64/kvm/hyp/nvhe/sys_regs.c | 14 ++++++++ arch/arm64/kvm/sys_regs.c | 5 +++ arch/arm64/tools/cpucaps | 2 ++ 11 files changed, 99 insertions(+), 6 deletions(-)arch/arm64/include/asm/asm_pointer_auth.h +3
-0@@ -60,6 +60,9 @@ alternative_else_nop_endif .macro __ptrauth_keys_init_cpu tsk, tmp1, tmp2, tmp3 mrs \tmp1, id_aa64isar1_el1 ubfx \tmp1, \tmp1, #ID_AA64ISAR1_APA_SHIFT, #8 + mrs_s \tmp2, SYS_ID_AA64ISAR2_EL1 + ubfx \tmp2, \tmp2, #ID_AA64ISAR2_APA3_SHIFT, #4 + orr \tmp1, \tmp1, \tmp2 cbz \tmp1, .Lno_addr_auth\@ mov_q \tmp1, (SCTLR_ELx_ENIA | SCTLR_ELx_ENIB | \ SCTLR_ELx_ENDA | SCTLR_ELx_ENDB)arch/arm64/include/asm/cpufeature.h +1
-0@@ -854,6 +854,7 @@ static inline unsigned int get_vmid_bits(u64 mmfr1)extern struct arm64_ftr_override id_aa64mmfr1_override;extern struct arm64_ftr_override id_aa64pfr1_override;extern struct arm64_ftr_override id_aa64isar1_override; +extern struct arm64_ftr_override id_aa64isar2_override;u32 get_kvm_ipa_limit (void );void dump_cpu_features (void );arch/arm64/include/asm/kvm_hyp.h +1
-0@@ -118,6 +118,7 @@ extern u64 kvm_nvhe_sym(id_aa64pfr0_el1_sys_val);extern u64 kvm_nvhe_sym (id_aa64pfr1_el1_sys_val );extern u64 kvm_nvhe_sym (id_aa64isar0_el1_sys_val );extern u64 kvm_nvhe_sym (id_aa64isar1_el1_sys_val ); +extern u64 kvm_nvhe_sym (id_aa64isar2_el1_sys_val );extern u64 kvm_nvhe_sym (id_aa64mmfr0_el1_sys_val );extern u64 kvm_nvhe_sym (id_aa64mmfr1_el1_sys_val );extern u64 kvm_nvhe_sym (id_aa64mmfr2_el1_sys_val );arch/arm64/include/asm/sysreg.h +12
-0@@ -773,6 +773,8 @@#define ID_AA64ISAR1_GPI_IMP_DEF 0x1/* id_aa64isar2 */ +#define ID_AA64ISAR2_APA3_SHIFT 12 +#define ID_AA64ISAR2_GPA3_SHIFT 8#define ID_AA64ISAR2_RPRES_SHIFT 4#define ID_AA64ISAR2_WFXT_SHIFT 0@@ -786,6 +788,16 @@#define ID_AA64ISAR2_WFXT_NI 0x0#define ID_AA64ISAR2_WFXT_SUPPORTED 0x2 +#define ID_AA64ISAR2_APA3_NI 0x0 +#define ID_AA64ISAR2_APA3_ARCHITECTED 0x1 +#define ID_AA64ISAR2_APA3_ARCH_EPAC 0x2 +#define ID_AA64ISAR2_APA3_ARCH_EPAC2 0x3 +#define ID_AA64ISAR2_APA3_ARCH_EPAC2_FPAC 0x4 +#define ID_AA64ISAR2_APA3_ARCH_EPAC2_FPAC_CMB 0x5 + +#define ID_AA64ISAR2_GPA3_NI 0x0 +#define ID_AA64ISAR2_GPA3_ARCHITECTED 0x1 +/* id_aa64pfr0 */ #define ID_AA64PFR0_CSV3_SHIFT 60#define ID_AA64PFR0_CSV2_SHIFT 56arch/arm64/kernel/cpufeature.c +8
-0@@ -226,6 +226,10 @@ static const struct arm64_ftr_bits ftr_id_aa64isar1[] = { };static const struct arm64_ftr_bits ftr_id_aa64isar2[] = { +ARM64_FTR_BITS (FTR_VISIBLE_IF_IS_ENABLED (CONFIG_ARM64_PTR_AUTH ), +FTR_STRICT ,FTR_EXACT ,ID_AA64ISAR2_APA3_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_VISIBLE_IF_IS_ENABLED (CONFIG_ARM64_PTR_AUTH ), +FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64ISAR2_GPA3_SHIFT ,4 ,0 ),ARM64_FTR_BITS (FTR_VISIBLE ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64ISAR2_RPRES_SHIFT ,4 ,0 ),ARM64_FTR_END , };@@ -596,6 +600,7 @@ static const struct arm64_ftr_bits ftr_raz[] = {struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override;struct arm64_ftr_override __ro_after_init id_aa64pfr1_override;struct arm64_ftr_override __ro_after_init id_aa64isar1_override; +struct arm64_ftr_override __ro_after_init id_aa64isar2_override; static const struct __ftr_reg_entry { u32 sys_id;@@ -644,6 +649,8 @@ static const struct __ftr_reg_entry {ARM64_FTR_REG_OVERRIDE (SYS_ID_AA64ISAR1_EL1 , ftr_id_aa64isar1, &id_aa64isar1_override),ARM64_FTR_REG (SYS_ID_AA64ISAR2_EL1 , ftr_id_aa64isar2), +ARM64_FTR_REG_OVERRIDE (SYS_ID_AA64ISAR2_EL1 , ftr_id_aa64isar2, + &id_aa64isar2_override),/* Op1 = 0, CRn = 0, CRm = 7 */ ARM64_FTR_REG(SYS_ID_AA64MMFR0_EL1, ftr_id_aa64mmfr0),@@ -1834,10 +1841,11 @@ static bool has_address_auth_metacap(const struct arm64_cpu_capabilities *entry, {bool api =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_IMP_DEF ], scope);bool apa =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA5 ], scope); +bool apa3 =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA3 ], scope);
Quoted 6 lines
arch/arm64/kernel/cpufeature.c static bool has_address_auth_metacap(const struct arm64_cpu_capabilities *entry, · line 1846
Quoted 2 lines
arch/arm64/kernel/cpufeature.c +1
-1-WARN_ON (apa && api); +WARN_ON ((apa && api) || (apa && apa3) || (api && apa3));I don't really get the point in this warning, what is somebody supposed to do if they hit it? The kernel isn't the right place to make assertions about the CPU design.
Right, there is nothing user can do other than reporting about that. It was inspired by the similar check in cpu_has_fwb(), yet I was under impression that assertion can be triggered via id regester override as well - now I see that invalid override is ignored. I'm fine with removing assertion as long as code base use assertions consistently...
Cheers
Vladimir
Quoted 3 lines
Will
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Will Deacon
maintainerRe: [PATCH v2 4/4] arm64: Add support of PAuth QARMA3 architected algorithm
Quoted 18 lines · Vladimir Murzin
Quoted 17 lines · Will Deacon
Quoted 16 lines · Vladimir Murzin
QARMA3 is relaxed version of the QARMA5 algorithm which expected to reduce the latency of calculation while still delivering a suitable level of security.
Support for QARMA3 can be discovered via
ID_AA64ISAR2_EL1APA3, bits [15:12] Indicates whether the QARMA3 algorithm is
implemented in the PE for address authentication in AArch64 state.GPA3, bits [11:8] Indicates whether the QARMA3 algorithm is
implemented in the PE for generic code authentication in AArch64 state.Signed-off-by Vladimir Murzin <[email protected]>---
[...]
Quoted 30 lines
Quoted 23 lines
Quoted 23 lines
arch/arm64/kernel/cpufeature.c +4
-0@@ -596,6 +600,7 @@ static const struct arm64_ftr_bits ftr_raz[] = {struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override;struct arm64_ftr_override __ro_after_init id_aa64pfr1_override;struct arm64_ftr_override __ro_after_init id_aa64isar1_override; +struct arm64_ftr_override __ro_after_init id_aa64isar2_override; static const struct __ftr_reg_entry { u32 sys_id;@@ -644,6 +649,8 @@ static const struct __ftr_reg_entry {ARM64_FTR_REG_OVERRIDE (SYS_ID_AA64ISAR1_EL1 , ftr_id_aa64isar1, &id_aa64isar1_override),ARM64_FTR_REG (SYS_ID_AA64ISAR2_EL1 , ftr_id_aa64isar2), +ARM64_FTR_REG_OVERRIDE (SYS_ID_AA64ISAR2_EL1 , ftr_id_aa64isar2, + &id_aa64isar2_override),/* Op1 = 0, CRn = 0, CRm = 7 */ ARM64_FTR_REG(SYS_ID_AA64MMFR0_EL1, ftr_id_aa64mmfr0),@@ -1834,10 +1841,11 @@ static bool has_address_auth_metacap(const struct arm64_cpu_capabilities *entry, {bool api =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_IMP_DEF ], scope);bool apa =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA5 ], scope); +bool apa3 =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA3 ], scope);Quoted 6 lines
arch/arm64/kernel/cpufeature.c static bool has_address_auth_metacap(const struct arm64_cpu_capabilities *entry, · line 1846
Quoted 2 lines
arch/arm64/kernel/cpufeature.c +1
-1-WARN_ON (apa && api); +WARN_ON ((apa && api) || (apa && apa3) || (api && apa3));I don't really get the point in this warning, what is somebody supposed to do if they hit it? The kernel isn't the right place to make assertions about the CPU design.
Quoted 5 lines
Right, there is nothing user can do other than reporting about that. It was inspired by the similar check in
cpu_has_fwb(), yet I was under impression that assertion can be triggered via id regester override as well - now I see that invalid override is ignored. I'm fine with removing assertion as long as code base use assertions consistently...
Yes, please send a version with these WARN_ON()s and I can queue it up.
Cheers,
Will
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v2 4/4] arm64: Add support of PAuth QARMA3 architected algorithm
Quoted 52 lines · Will Deacon
Quoted 18 lines · Vladimir Murzin
Quoted 17 lines · Will Deacon
Quoted 16 lines · Vladimir Murzin
QARMA3 is relaxed version of the QARMA5 algorithm which expected to reduce the latency of calculation while still delivering a suitable level of security.
Support for QARMA3 can be discovered via
ID_AA64ISAR2_EL1APA3, bits [15:12] Indicates whether the QARMA3 algorithm is
implemented in the PE for address authentication in AArch64 state.GPA3, bits [11:8] Indicates whether the QARMA3 algorithm is
implemented in the PE for generic code authentication in AArch64 state.Signed-off-by Vladimir Murzin <[email protected]>---
[...]
Quoted 30 lines
Quoted 29 lines
Quoted 18 lines
arch/arm64/kernel/cpufeature.c +3
-0@@ -596,6 +600,7 @@ static const struct arm64_ftr_bits ftr_raz[] = {struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override;struct arm64_ftr_override __ro_after_init id_aa64pfr1_override;struct arm64_ftr_override __ro_after_init id_aa64isar1_override; +struct arm64_ftr_override __ro_after_init id_aa64isar2_override; static const struct __ftr_reg_entry { u32 sys_id;@@ -644,6 +649,8 @@ static const struct __ftr_reg_entry {ARM64_FTR_REG_OVERRIDE (SYS_ID_AA64ISAR1_EL1 , ftr_id_aa64isar1, &id_aa64isar1_override),ARM64_FTR_REG (SYS_ID_AA64ISAR2_EL1 , ftr_id_aa64isar2), +ARM64_FTR_REG_OVERRIDE (SYS_ID_AA64ISAR2_EL1 , ftr_id_aa64isar2, + &id_aa64isar2_override),/* Op1 = 0, CRn = 0, CRm = 7 */ ARM64_FTR_REG(SYS_ID_AA64MMFR0_EL1, ftr_id_aa64mmfr0),arch/arm64/kernel/cpufeature.c static bool has_address_auth_metacap(const struct arm64_cpu_capabilities *entry, · line 1846
Quoted 7 lines
arch/arm64/kernel/cpufeature.c +2
-1@@ -1834,10 +1841,11 @@ static bool has_address_auth_metacap(const struct arm64_cpu_capabilities *entry, {bool api =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_IMP_DEF ], scope);bool apa =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA5 ], scope); +bool apa3 =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA3 ], scope); -WARN_ON (apa && api); +WARN_ON ((apa && api) || (apa && apa3) || (api && apa3));I don't really get the point in this warning, what is somebody supposed to do if they hit it? The kernel isn't the right place to make assertions about the CPU design.
Quoted 7 lines
Quoted 5 lines
Right, there is nothing user can do other than reporting about that. It was inspired by the similar check in
cpu_has_fwb(), yet I was under impression that assertion can be triggered via id regester override as well - now I see that invalid override is ignored. I'm fine with removing assertion as long as code base use assertions consistently...Yes, please send a version with these WARN_ON()s and I can queue it up.
^^^^^^
Sorry, Will, did you mean *without*?
Do you want separate patch to remove WARN_ON from cpu_has_fwb() as well?
Cheers
Vladimir
Quoted 5 lines
Cheers,
Will
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Will Deacon
maintainerRe: [PATCH v2 4/4] arm64: Add support of PAuth QARMA3 architected algorithm
Quoted 59 lines · Vladimir Murzin
Quoted 58 lines · Will Deacon
Quoted 18 lines · Vladimir Murzin
Quoted 17 lines · Will Deacon
Quoted 16 lines · Vladimir Murzin
QARMA3 is relaxed version of the QARMA5 algorithm which expected to reduce the latency of calculation while still delivering a suitable level of security.
Support for QARMA3 can be discovered via
ID_AA64ISAR2_EL1APA3, bits [15:12] Indicates whether the QARMA3 algorithm is
implemented in the PE for address authentication in AArch64 state.GPA3, bits [11:8] Indicates whether the QARMA3 algorithm is
implemented in the PE for generic code authentication in AArch64 state.Signed-off-by Vladimir Murzin <[email protected]>---
[...]
Quoted 35 lines
Quoted 23 lines
Quoted 23 lines
arch/arm64/kernel/cpufeature.c +4
-0@@ -596,6 +600,7 @@ static const struct arm64_ftr_bits ftr_raz[] = {struct arm64_ftr_override __ro_after_init id_aa64mmfr1_override;struct arm64_ftr_override __ro_after_init id_aa64pfr1_override;struct arm64_ftr_override __ro_after_init id_aa64isar1_override; +struct arm64_ftr_override __ro_after_init id_aa64isar2_override; static const struct __ftr_reg_entry { u32 sys_id;@@ -644,6 +649,8 @@ static const struct __ftr_reg_entry {ARM64_FTR_REG_OVERRIDE (SYS_ID_AA64ISAR1_EL1 , ftr_id_aa64isar1, &id_aa64isar1_override),ARM64_FTR_REG (SYS_ID_AA64ISAR2_EL1 , ftr_id_aa64isar2), +ARM64_FTR_REG_OVERRIDE (SYS_ID_AA64ISAR2_EL1 , ftr_id_aa64isar2, + &id_aa64isar2_override),/* Op1 = 0, CRn = 0, CRm = 7 */ ARM64_FTR_REG(SYS_ID_AA64MMFR0_EL1, ftr_id_aa64mmfr0),@@ -1834,10 +1841,11 @@ static bool has_address_auth_metacap(const struct arm64_cpu_capabilities *entry, {bool api =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_IMP_DEF ], scope);bool apa =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA5 ], scope); +bool apa3 =has_address_auth_cpucap (cpu_hwcaps_ptrs[ARM64_HAS_ADDRESS_AUTH_ARCH_QARMA3 ], scope);Quoted 6 lines
arch/arm64/kernel/cpufeature.c static bool has_address_auth_metacap(const struct arm64_cpu_capabilities *entry, · line 1846
Quoted 2 lines
arch/arm64/kernel/cpufeature.c +1
-1-WARN_ON (apa && api); +WARN_ON ((apa && api) || (apa && apa3) || (api && apa3));I don't really get the point in this warning, what is somebody supposed to do if they hit it? The kernel isn't the right place to make assertions about the CPU design.
Right, there is nothing user can do other than reporting about that. It was inspired by the similar check in
cpu_has_fwb(), yet I was under impression that assertion can be triggered via id regester override as well - now I see that invalid override is ignored. I'm fine with removing assertion as long as code base use assertions consistently...
Quoted 3 lines
Quoted 1 line
Yes, please send a version with these WARN_ON()s and I can queue it up.
^^^^^^Sorry, Will, did you mean *without*?
Urgh, yes, sorry about that.
Quoted 1 line
Do you want separate patch to remove
WARN_ONfromcpu_has_fwb()as well?
Yes, good thinking.
Will
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 10 lines · Vladimir Murzin
QARMA3 is relaxed version of the QARMA5 algorithm which expected to reduce the latency of calculation while still delivering a suitable level of security.
Feature advertised via a new ID fields in
ID_AA64ISAR2_EL1[1], so we need to teach the kernel to identify this.
Quoted 6 lines
Changelog:
v1 -> v2
- Removed unintended whitespace change insysreg.h
-FTR_ALIAS_OPTION_LENnow accounts null terminator
- Extract only APA3 bits fromID_AA64ISAR2_APA3_SHIFT(in
^^^^^^^^^^^^^^^^^^^^^^^
should be read as ID_AA64ISAR2
Quoted 13 lines
contrast to
id_aa64isar1_el1where both APA and API bits are extracted) inasm_pointer_auth.hThanks!
Vladimir Murzin (4):
arm64: cpufeature: Accountmin_field_valuewhen cheking secondaries
for PAuth
arm64: cpufeature: Warn if mutually exclusive PAuth algorithms
detected
arm64: cpufeature: Mark existing PAuth architected algorithm as QARMA5
arm64: Add support of PAuth QARMA3 architected algorithm
Quoted 13 lines
arch/arm64/include/asm/asm_pointer_auth.h | 3 ++ arch/arm64/include/asm/cpufeature.h | 1 + arch/arm64/include/asm/kvm_hyp.h | 1 + arch/arm64/include/asm/sysreg.h | 12 +++++ arch/arm64/kernel/cpufeature.c | 63 ++++++++++++++++++++++---- arch/arm64/kernel/idreg-override.c | 16 ++++++- arch/arm64/kvm/arm.c | 1 + arch/arm64/kvm/hyp/include/nvhe/fixed_config.h | 5 ++ arch/arm64/kvm/hyp/nvhe/sys_regs.c | 14 ++++++ arch/arm64/kvm/sys_regs.c | 5 ++ arch/arm64/tools/cpucaps | 6 ++- 11 files changed, 114 insertions(+), 13 deletions(-)
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 22 lines · Vladimir Murzin
QARMA3 is relaxed version of the QARMA5 algorithm which expected to reduce the latency of calculation while still delivering a suitable level of security.
Feature advertised via a new ID fields in
ID_AA64ISAR2_EL1[1], so we need to teach the kernel to identify this.Changelog:
v1 -> v2
- Removed unintended whitespace change insysreg.h
-FTR_ALIAS_OPTION_LENnow accounts null terminator
- Extract only APA3 bits fromID_AA64ISAR2_APA3_SHIFT(in contrast toid_aa64isar1_el1where both APA and API bits are extracted) inasm_pointer_auth.hThanks!
Quoted 7 lines
Vladimir Murzin (4):
arm64: cpufeature: Accountmin_field_valuewhen cheking secondaries
for PAuth
arm64: cpufeature: Warn if mutually exclusive PAuth algorithms
detected
arm64: cpufeature: Mark existing PAuth architected algorithm as QARMA5
arm64: Add support of PAuth QARMA3 architected algorithm
For the series:
M.
Signature · 6 lines
Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel