Hi Lorenzo,
On Tue, 22 Sep 2026 19:07:53 +0100, Oliver Upton [off-list ref] wrote:
[...]
I'd favor doing something like below and sticking the comment inline in
the ioctl handler. Unless I'm missing something blatantly obvious, I
don't see why the x86 or s390 pre-conditions can't be tested early too.
[...]
quoted hunk ↗ jump to hunk
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
[...]
quoted hunk ↗ jump to hunk
+int kvm_arch_pre_fault_allowed(struct kvm_vcpu *vcpu)
+{
+ if (!kvm_vcpu_initialized(vcpu))
+ return -ENOEXEC;
+
+ return 0;
+}
The same goes for arm64's pKVM check: kvm_arch_vcpu_pre_fault_memory()
returns -EOPNOTSUPP for is_protected_kvm_enabled() only after
vcpu_load(), so on a pKVM host the ioctl loads a vCPU the hypervisor
may not have created yet before rejecting it. Could that check move
into kvm_arch_pre_fault_allowed() as well?
Cheers,
/fuad