qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] kvm ept fault BUG_ON()


From: Stefanos Gerangelos
Subject: [Qemu-devel] kvm ept fault BUG_ON()
Date: Fri, 18 Mar 2016 20:26:22 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

Hi,

apologies if I am not posting to the appropriate list(s).

I am using QEMU-KVM and try to implement a simple character device which
offers mmap() functionality of host device memory to guest userspace.
For this purpose, I have written a dummy guest driver which communicates
with a qemu backend device.

Specifically, the guest driver allocates a page and passes the
associated address to qemu, which then translates it to host virtual
address (cpu_physical_memory_map()). It then calls mmap() with MAP_FIXED
and this host virtual address, which succeeds, and sends back the
response.

The problem arises here, when guest (either in kernespace or in
userspace via remap_pfn_range()) tries to access the relevant address
and faults with EPT. The path goes to handle_ept_violation() in kvm
module and eventually BUG_ON() is triggered at:

virt/kvm/kvm_main.c:1252 (version 3.16):

-- cut here --

pfn = ((addr - vma->vm_start) >> PAGE_SHIFT) +
        vma->vm_pgoff;
BUG_ON(!kvm_is_mmio_pfn(pfn));

-- cut here --

addr == vma->vm_start and pfn is assigned the value of vma->vm_pgoff !!


What am I missing here? Is this scenario invalid? Can you please shed
some light?

Thanks in advance!


--Stefanos

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]