Skip to content

KVM: arm64: support MTE in protected VMs

Peter Collingbourne kvm kvmarm linux-arm-kernel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 4 repliesIn review
  2. v13 patches 2 repliesSuperseded

Changes in v2 from the cover letter

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3KVM: arm64: add a hypercall for disowning pagesarch/arm64/include/asm/kvm_asm.h arch/arm64/kvm/hyp/include/nvhe/mem_protect.h arch/arm64/kvm/hyp/include/nvhe/pkvm.h +2 more+23 -00 replies
2/3KVM: arm64: disown unused reserved-memory regionsarch/arm64/kvm/arm.c+46 -00 replies
3/3KVM: arm64: allow MTE in protected VMs if the tag storage is knownarch/arm64/include/asm/kvm_host.h arch/arm64/include/asm/kvm_pkvm.h arch/arm64/kernel/image-vars.h +3 more+54 -80 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] KVM: arm64: support MTE in protected VMs

Hi,

This patch series contains a proposed extension to pKVM that allows MTE to be exposed to the protected guests. It is based on the base pKVM series previously sent to the list [1] and later rebased to 5.19-rc3 and uploaded to [2].

This series takes precautions against host compromise of the guests via direct access to their tag storage, by preventing the host from accessing the tag storage via stage 2 page tables. The device tree must describe the physical memory address of the tag storage, if any, and the memory nodes must declare that the tag storage location is described. Otherwise, the MTE feature is disabled in protected guests.

Now that we can easily do so, we also prevent the host from accessing any unmapped reserved-memory regions without a driver, as the host has no business accessing that memory.

A proposed extension to the devicetree specification is available at [3], a patched version of QEMU that produces the required device tree nodes is available at [4] and a patched version of the crosvm hypervisor that enables MTE is available at [5].

v2:
- refcount the PTEs owned by NOBODY

[1] https://lore.kernel.org/all/[email protected]/
[2] https://android-kvm.googlesource.com/linux/ for-upstream/pkvm-base-v2
[3] https://github.com/pcc/devicetree-specification mte-alloc
[4] https://github.com/pcc/qemu mte-shared-alloc
[5] https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3719324

Peter Collingbourne (3):
KVM: arm64: add a hypercall for disowning pages
KVM: arm64: disown unused reserved-memory regions
KVM: arm64: allow MTE in protected VMs if the tag storage is known

 arch/arm64/include/asm/kvm_asm.h              |  1 +
 arch/arm64/include/asm/kvm_host.h             |  6 ++
 arch/arm64/include/asm/kvm_pkvm.h             |  4 +-
 arch/arm64/kernel/image-vars.h                |  3 +
 arch/arm64/kvm/arm.c                          | 83 ++++++++++++++++++-
 arch/arm64/kvm/hyp/include/nvhe/mem_protect.h |  1 +
 arch/arm64/kvm/hyp/include/nvhe/pkvm.h        |  1 +
 arch/arm64/kvm/hyp/nvhe/hyp-main.c            |  9 ++
 arch/arm64/kvm/hyp/nvhe/mem_protect.c         | 11 +++
 arch/arm64/kvm/hyp/nvhe/pkvm.c                |  8 +-
 arch/arm64/kvm/mmu.c                          |  4 +-
 11 files changed, 123 insertions(+), 8 deletions(-)
Signature · 1 line
2.37.0.144.g8ac04bfd2-goog