[PATCH] KVM: arm/arm64: fix MMIO handling on userland induced accesses

Andre Przywara andre.przywara at arm.com
Tue Mar 24 09:03:16 PDT 2015


The guest is not the only user of the MMIO handling routines, userland
can also read and write to those handlers. Since we don't use the
KVM iobus framework in this case, we have to set the data pointer to
some actual memory before executing the handler routines.
This allows to use QEMU as the userland control tool.

Signed-off-by: Andre Przywara <andre.przywara at arm.com>
---
Hi,

just embarrassingly realised that I haven't tested the latest version of this
series with QEMU, so this bug slipped me. Sorry for that! I will merge this
patch in the next revision of this series (or just send a new version of
11/12).

Cheers,
Andre.

 virt/kvm/arm/vgic-v2-emul.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/virt/kvm/arm/vgic-v2-emul.c b/virt/kvm/arm/vgic-v2-emul.c
index 12cb1361..a715054 100644
--- a/virt/kvm/arm/vgic-v2-emul.c
+++ b/virt/kvm/arm/vgic-v2-emul.c
@@ -666,6 +666,7 @@ static int vgic_attr_regs_access(struct kvm_device *dev,
 	struct kvm_vcpu *vcpu, *tmp_vcpu;
 	struct vgic_dist *vgic;
 	struct kvm_exit_mmio mmio;
+	u32 data;
 
 	offset = attr->attr & KVM_DEV_ARM_VGIC_OFFSET_MASK;
 	cpuid = (attr->attr & KVM_DEV_ARM_VGIC_CPUID_MASK) >>
@@ -687,6 +688,7 @@ static int vgic_attr_regs_access(struct kvm_device *dev,
 
 	mmio.len = 4;
 	mmio.is_write = is_write;
+	mmio.data = &data;
 	if (is_write)
 		mmio_data_write(&mmio, ~0, *reg);
 	switch (attr->group) {
-- 
1.7.9.5




More information about the linux-arm-kernel mailing list