qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] kvm ept fault BUG_ON()
@ 2016-03-18 18:26 Stefanos Gerangelos
  0 siblings, 0 replies; only message in thread
From: Stefanos Gerangelos @ 2016-03-18 18:26 UTC (permalink / raw)
  To: kvm; +Cc: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 1242 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-18 19:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-18 18:26 [Qemu-devel] kvm ept fault BUG_ON() Stefanos Gerangelos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).