File tree Expand file tree Collapse file tree 2 files changed +16
-18
lines changed
Expand file tree Collapse file tree 2 files changed +16
-18
lines changed Original file line number Diff line number Diff line change @@ -1203,6 +1203,11 @@ static unsigned long system_supported_vcpu_features(void)
12031203 if (!system_supports_sve ())
12041204 clear_bit (KVM_ARM_VCPU_SVE , & features );
12051205
1206+ if (!system_has_full_ptr_auth ()) {
1207+ clear_bit (KVM_ARM_VCPU_PTRAUTH_ADDRESS , & features );
1208+ clear_bit (KVM_ARM_VCPU_PTRAUTH_GENERIC , & features );
1209+ }
1210+
12061211 return features ;
12071212}
12081213
@@ -1223,6 +1228,14 @@ static int kvm_vcpu_init_check_features(struct kvm_vcpu *vcpu,
12231228 if (features & ~system_supported_vcpu_features ())
12241229 return - EINVAL ;
12251230
1231+ /*
1232+ * For now make sure that both address/generic pointer authentication
1233+ * features are requested by the userspace together.
1234+ */
1235+ if (test_bit (KVM_ARM_VCPU_PTRAUTH_ADDRESS , & features ) !=
1236+ test_bit (KVM_ARM_VCPU_PTRAUTH_GENERIC , & features ))
1237+ return - EINVAL ;
1238+
12261239 if (!test_bit (KVM_ARM_VCPU_EL1_32BIT , & features ))
12271240 return 0 ;
12281241
Original file line number Diff line number Diff line change @@ -165,20 +165,9 @@ static void kvm_vcpu_reset_sve(struct kvm_vcpu *vcpu)
165165 memset (vcpu -> arch .sve_state , 0 , vcpu_sve_state_size (vcpu ));
166166}
167167
168- static int kvm_vcpu_enable_ptrauth (struct kvm_vcpu * vcpu )
168+ static void kvm_vcpu_enable_ptrauth (struct kvm_vcpu * vcpu )
169169{
170- /*
171- * For now make sure that both address/generic pointer authentication
172- * features are requested by the userspace together and the system
173- * supports these capabilities.
174- */
175- if (!test_bit (KVM_ARM_VCPU_PTRAUTH_ADDRESS , vcpu -> arch .features ) ||
176- !test_bit (KVM_ARM_VCPU_PTRAUTH_GENERIC , vcpu -> arch .features ) ||
177- !system_has_full_ptr_auth ())
178- return - EINVAL ;
179-
180170 vcpu_set_flag (vcpu , GUEST_HAS_PTRAUTH );
181- return 0 ;
182171}
183172
184173/**
@@ -233,12 +222,8 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
233222 }
234223
235224 if (test_bit (KVM_ARM_VCPU_PTRAUTH_ADDRESS , vcpu -> arch .features ) ||
236- test_bit (KVM_ARM_VCPU_PTRAUTH_GENERIC , vcpu -> arch .features )) {
237- if (kvm_vcpu_enable_ptrauth (vcpu )) {
238- ret = - EINVAL ;
239- goto out ;
240- }
241- }
225+ test_bit (KVM_ARM_VCPU_PTRAUTH_GENERIC , vcpu -> arch .features ))
226+ kvm_vcpu_enable_ptrauth (vcpu );
242227
243228 if (vcpu_el1_is_32bit (vcpu ))
244229 pstate = VCPU_RESET_PSTATE_SVC ;
You can’t perform that action at this time.
0 commit comments