The 'fast' path of p2m_get_page_from_gfn handles three cases: normal ram,
foreign p2m entries, and grant map entries. For normal ram and grant table
entries, get_page() is called, but for foreign entries,
page_get_owner_and_reference() is called, since the current domain is
expected not to be the owner.
Unfortunately, grant maps are *also* generally expected to be owned by
foreign domains; so this function will fail for any p2m entry containing a
grant map that doesn't happen to be local.
Have grant maps take the same path as foreign entries. Since grants may
actually be either foreign or local, adjust the assertion to allow for this.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: George Dunlap <george.dunlap@cloud.com>
Reviewed-by: George Dunlap <george.dunlap@cloud.com>
&& !((q & P2M_UNSHARE) && p2m_is_shared(*t)) )
{
page = mfn_to_page(mfn);
- if ( unlikely(p2m_is_foreign(*t)) )
+ if ( unlikely(p2m_is_foreign(*t)) || unlikely(p2m_is_grant(*t)) )
{
struct domain *fdom = page_get_owner_and_reference(page);
- ASSERT(fdom != p2m->domain);
+ ASSERT(!p2m_is_foreign(*t) || fdom != p2m->domain);
if ( fdom == NULL )
page = NULL;
}