diff options
author | Sean Christopherson <seanjc@google.com> | 2021-11-04 00:25:03 +0000 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-11-18 02:15:19 -0500 |
commit | 6b285a5587506bae084cf9a3ed5aa491d623b91b (patch) | |
tree | 90635cd56ad9d04107b3cf44290c7e942d07aff1 /ipc/mq_sysctl.c | |
parent | bda44d844758c70c8dc1478e6fc9c25efa90c5a7 (diff) | |
download | linux-6b285a5587506bae084cf9a3ed5aa491d623b91b.tar.bz2 |
KVM: Disallow user memslot with size that exceeds "unsigned long"
Reject userspace memslots whose size exceeds the storage capacity of an
"unsigned long". KVM's uAPI takes the size as u64 to support large slots
on 64-bit hosts, but does not account for the size being truncated on
32-bit hosts in various flows. The access_ok() check on the userspace
virtual address in particular casts the size to "unsigned long" and will
check the wrong number of bytes.
KVM doesn't actually support slots whose size doesn't fit in an "unsigned
long", e.g. KVM's internal kvm_memory_slot.npages is an "unsigned long",
not a "u64", and misc arch specific code follows that behavior.
Fixes: fa3d315a4ce2 ("KVM: Validate userspace_addr of memslot when registered")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Message-Id: <20211104002531.1176691-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'ipc/mq_sysctl.c')
0 files changed, 0 insertions, 0 deletions