mirror of
https://github.com/torvalds/linux.git
synced 2026-09-19 00:58:02 +02:00
The user cannot use MTE on VMAs created by mapping a guest_memfd file,
as arch_calc_vm_flag_bits() does not set VM_MTE_ALLOWED.
When creating a guest_memfd backed memslot,
kvm_arch_prepare_memory_region() rejects the memslot if MTE is enabled for
the VM and if guest_memfd has been mapped in a VMA that intersects the
memslot.
However, the documentation for KVM_SET_USER_MEMORY_REGION2 explicitly
states that the only condition for userspace_addr is for it to be a legal
userspace address, but the mapping is not required to be valid nor
populated at memslot creation.
If userspace sets userspace_addr to an address that hasn't been mapped, or
if userspace_addr belongs to a VMA that isn't backed by the guest_memfd
file, or if the VMA doesn't intersect the memslot, memslot creation is
successful and KVM ends up with a VM with MTE and guest_memfd-backed
memslots.
The same happens if the order is reversed: when userspace enables MTE, KVM
does not check if memslots backed by guest_memfd are already present.
Fix both issues by rejecting guest_memfd-backed memslots when MTE is
enabled, and by rejecting MTE when guest_memfd-backed memslots are already
present.
Fixes:
|
||
|---|---|---|
| .. | ||
| hyp | ||
| vgic | ||
| .gitignore | ||
| arch_timer.c | ||
| arm.c | ||
| at.c | ||
| config.c | ||
| debug.c | ||
| emulate-nested.c | ||
| fpsimd.c | ||
| guest.c | ||
| handle_exit.c | ||
| hyp_trace.c | ||
| hyp_trace.h | ||
| hypercalls.c | ||
| inject_fault.c | ||
| Kconfig | ||
| Makefile | ||
| mmio.c | ||
| mmu.c | ||
| nested.c | ||
| pauth.c | ||
| pkvm.c | ||
| pmu-emul.c | ||
| pmu.c | ||
| psci.c | ||
| ptdump.c | ||
| pvtime.c | ||
| reset.c | ||
| stacktrace.c | ||
| sys_regs.c | ||
| sys_regs.h | ||
| trace_arm.h | ||
| trace_handle_exit.h | ||
| trace.h | ||
| trng.c | ||
| va_layout.c | ||
| vgic-sys-reg-v3.c | ||
| vmid.c | ||