OSDN Git Service

KVM: Reject device ioctls from processes other than the VM's creator
authorSean Christopherson <sean.j.christopherson@intel.com>
Fri, 15 Feb 2019 20:48:39 +0000 (12:48 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2019 04:23:28 +0000 (06:23 +0200)
commit9aacea736c9a218d04cb01fff289a35d67d358cf
treef89893dd521e099f9da319a4b6d8a43a02e7f5eb
parent5ce6e5bd23f01ac83d912887267e60c319fda969
KVM: Reject device ioctls from processes other than the VM's creator

commit ddba91801aeb5c160b660caed1800eb3aef403f8 upstream.

KVM's API requires thats ioctls must be issued from the same process
that created the VM.  In other words, userspace can play games with a
VM's file descriptors, e.g. fork(), SCM_RIGHTS, etc..., but only the
creator can do anything useful.  Explicitly reject device ioctls that
are issued by a process other than the VM's creator, and update KVM's
API documentation to extend its requirements to device ioctls.

Fixes: 852b6d57dc7f ("kvm: add device control API")
Cc: <stable@vger.kernel.org>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/virtual/kvm/api.txt
virt/kvm/kvm_main.c