KVM: Enforce error in ioctl for compat tasks when !KVM_COMPAT
authorMarc Zyngier <marc.zyngier@arm.com>
Sun, 17 Jun 2018 09:16:21 +0000 (10:16 +0100)
committerMarc Zyngier <marc.zyngier@arm.com>
Thu, 21 Jun 2018 16:17:50 +0000 (17:17 +0100)
commit7ddfd3e0df29106c728dda2a6bd6591ee43a4e3c
tree881292b233bf620c55ae432583778e59a18f4591
parent47a91b7232fa25abc7e0b7fc1c69ae4f81061594
KVM: Enforce error in ioctl for compat tasks when !KVM_COMPAT

The current behaviour of the compat ioctls is a bit odd.
We provide a compat_ioctl method when KVM_COMPAT is set, and NULL
otherwise. But NULL means that the normal, non-compat ioctl should
be used directly for compat tasks, and there is no way to actually
prevent a compat task from issueing KVM ioctls.

This patch changes this behaviour, by always registering a compat_ioctl
method, even if KVM_COMPAT is not selected. In that case, the callback
will always return -EINVAL.

Fixes: de8e5d744051568c8aad ("KVM: Disable compat ioctl for s390")
Reported-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
virt/kvm/kvm_main.c