]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: PPC: Book3S HV: Add sanity check to copy_tofrom_guest
authorFabiano Rosas <farosas@linux.ibm.com>
Thu, 5 Aug 2021 21:26:15 +0000 (18:26 -0300)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 24 Aug 2021 13:14:06 +0000 (23:14 +1000)
commiteb393d63b8a750c0aba97a2ac7efdff63eaea1dd
treea78315996e8556ea6a80f9b11377590c68f12e52
parent01f9d45667e9b4aaefa0619bf91d43afc952c9a5
KVM: PPC: Book3S HV: Add sanity check to copy_tofrom_guest

Both paths into __kvmhv_copy_tofrom_guest_radix ensure that we arrive
with an effective address that is smaller than our total addressable
space and addresses quadrant 0.

- The H_COPY_TOFROM_GUEST hypercall path rejects the call with
H_PARAMETER if the effective address has any of the twelve most
significant bits set.

- The kvmhv_copy_tofrom_guest_radix path clears the top twelve bits
before calling the internal function.

Although the callers make sure that the effective address is sane, any
future use of the function is exposed to a programming error, so add a
sanity check.

Suggested-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210805212616.2641017-3-farosas@linux.ibm.com
arch/powerpc/kvm/book3s_64_mmu_radix.c