* Reading / Writing guest page from host (tdp_page_fault) ?
@ 2013-10-14 21:16 Sunil
2013-10-15 10:35 ` Gleb Natapov
0 siblings, 1 reply; 2+ messages in thread
From: Sunil @ 2013-10-14 21:16 UTC (permalink / raw)
To: kvm@vger.kernel.org
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Reading / Writing guest page from host (tdp_page_fault) ?
2013-10-14 21:16 Reading / Writing guest page from host (tdp_page_fault) ? Sunil
@ 2013-10-15 10:35 ` Gleb Natapov
0 siblings, 0 replies; 2+ messages in thread
From: Gleb Natapov @ 2013-10-15 10:35 UTC (permalink / raw)
To: Sunil; +Cc: kvm@vger.kernel.org
On Mon, Oct 14, 2013 at 02:16:06PM -0700, Sunil wrote:
> 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
>
Use kvm_write_guest().
--
Gleb.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-15 10:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-14 21:16 Reading / Writing guest page from host (tdp_page_fault) ? Sunil
2013-10-15 10:35 ` Gleb Natapov
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).