Re: [PATCH v2 1/7] KVM: s390: Fix unlikely NULL gmap dereference
From: Janosch Frank
Date: Tue Jul 14 2026 - 09:29:12 EST
On 7/13/26 17:08, Claudio Imbrenda wrote:
When creating a new vCPU, kvm_vm_ioctl_create_vcpu() will callYep, that explains why other architecture have initialization tracking :)
kvm_arch_vcpu_postcreate() after the file descriptor for the new vCPU
has been created. The new file descriptor has not been returned yet,
but a malicious userspace program could try to guess it.
If a malicious userspace program manages to start the newly created vCPU
before kvm_arch_vcpu_postcreate() is called, __vcpu_run() will try to
dereference vcpu->arch.gmap and trigger a NULL pointer dereference.
Fix this by moving the initialization of vcpu->arch.gmap into
kvm_arch_vcpu_create(), which is called before the file descriptor for
the vCPU is created.
Fixes: dafd032a15f8 ("KVM: s390: move vcpu specific initalization to a later point")
Fixes: e38c884df921 ("KVM: s390: Switch to new gmap")
Signed-off-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
FWIW: We could also hide the sca fix in #6 behind this flag but having them separate is also ok