mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
FROMGIT: KVM: Forbid the use of tagged userspace addresses for memslots
The use of a tagged address could be pretty confusing for the
whole memslot infrastructure as well as the MMU notifiers.
Forbid it altogether, as it never quite worked the first place.
Cc: stable@vger.kernel.org
Reported-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
(cherry picked from commit 139bc8a614
git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git fixes)
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I5a04c24948e1fc78c4d34cca514f348a0e7d9bc3
Bug: 178098380
Test: atest VirtualizationHostTestCases on an EL2-enabled device
This commit is contained in:
parent
d622e99971
commit
67ba3546fb
|
|
@ -1269,6 +1269,9 @@ field userspace_addr, which must point at user addressable memory for
|
|||
the entire memory slot size. Any object may back this memory, including
|
||||
anonymous memory, ordinary files, and hugetlbfs.
|
||||
|
||||
On architectures that support a form of address tagging, userspace_addr must
|
||||
be an untagged address.
|
||||
|
||||
It is recommended that the lower 21 bits of guest_phys_addr and userspace_addr
|
||||
be identical. This allows large pages in the guest to be backed by large
|
||||
pages in the host.
|
||||
|
|
|
|||
|
|
@ -1289,6 +1289,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
|
|||
return -EINVAL;
|
||||
/* We can read the guest memory with __xxx_user() later on. */
|
||||
if ((mem->userspace_addr & (PAGE_SIZE - 1)) ||
|
||||
(mem->userspace_addr != untagged_addr(mem->userspace_addr)) ||
|
||||
!access_ok((void __user *)(unsigned long)mem->userspace_addr,
|
||||
mem->memory_size))
|
||||
return -EINVAL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user