Anthony Liguori wrote:
>>
>>
>>>
>>> struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn)
>>> {
>>> - return pfn_to_page(gfn_to_pfn(kvm, gfn));
>>> + pfn_t pfn;
>>> +
>>> + pfn = gfn_to_pfn(kvm, gfn);
>>> + if (pfn_valid(pfn))
>>> + return pfn_to_page(pfn);
>>> +
>>> + return NULL;
>>> }
>>>
>>
>> You're returning NULL here, not bad_page.
>>
>
> My thinking was that bad_page indicates that the gfn is invalid. This
> is a different type of error though. The problem is that the guest is
> we are trying to kmap() a page that has no struct page associated with
> it. I'm not sure what the right thing to do here is.
>
It depends on what's going on? Does a page table point to mmio? Or the
glommerclock?
Not sure there is a single answer.
> Perhaps we should be replacing consumers of gfn_to_page() with
> copy_to_user() instead?
Indeed we should. The problem is access in atomic contexts. It's easy
to detect failure, but not always easy to handle it.
--
Any sufficiently difficult bug is indistinguishable from a feature.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel