Reading / Writing guest page from host (tdp_page_fault) ?

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

 



Hello List,

I am trying to read / write to guest  page from the host when there is
ept violation on it. From tdp_page_fault() when I have the pfn, this
is what I am doing

struct page *page = pfn_to_page(pfn);
unsigned long addr = page_addrress(page);
unsigned char *buff = (unsigned char*) addr;

copy_to_user(buff, my_own_page, PAGE_SIZE);
or
copy_from_user(my_own_page, buff, PAGE_SIZE);

But in both above case, copy_from/to_user returns PAGE_SIZE indicating
that copying failed. I tried using memcpy instead, but it not able to
copy too.

Is there a way to achieve this ?

Would this work ?
     old_fs = get_fs();
     set_fs(KERNEL_DS);
     ...
     copy_from/to_user()
    set_fs(old_fs);

--
Sunil
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux