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)
1203
1203
if (!system_supports_sve ())
1204
1204
clear_bit (KVM_ARM_VCPU_SVE , & features );
1205
1205
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
+
1206
1211
return features ;
1207
1212
}
1208
1213
@@ -1223,6 +1228,14 @@ static int kvm_vcpu_init_check_features(struct kvm_vcpu *vcpu,
1223
1228
if (features & ~system_supported_vcpu_features ())
1224
1229
return - EINVAL ;
1225
1230
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
+
1226
1239
if (!test_bit (KVM_ARM_VCPU_EL1_32BIT , & features ))
1227
1240
return 0 ;
1228
1241
Original file line number Diff line number Diff line change @@ -165,20 +165,9 @@ static void kvm_vcpu_reset_sve(struct kvm_vcpu *vcpu)
165
165
memset (vcpu -> arch .sve_state , 0 , vcpu_sve_state_size (vcpu ));
166
166
}
167
167
168
- static int kvm_vcpu_enable_ptrauth (struct kvm_vcpu * vcpu )
168
+ static void kvm_vcpu_enable_ptrauth (struct kvm_vcpu * vcpu )
169
169
{
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
-
180
170
vcpu_set_flag (vcpu , GUEST_HAS_PTRAUTH );
181
- return 0 ;
182
171
}
183
172
184
173
/**
@@ -233,12 +222,8 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
233
222
}
234
223
235
224
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 );
242
227
243
228
if (vcpu_el1_is_32bit (vcpu ))
244
229
pstate = VCPU_RESET_PSTATE_SVC ;
You can’t perform that action at this time.
0 commit comments