mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
x86/p2m: make p2m_get_page_from_gfn() handle grant case correctly
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>
This commit is contained in:
1 parent
772380f754
commit
cbbca7be4a
1 file changed
+2
-2
@@ -346,11 +346,11 @@ struct page_info *p2m_get_page_from_gfn(
|
||||
&& !((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;
|
||||
}
|
||||
|
||||