aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/mm
diff options
context:
space:
mode:
authorTim Deegan <tim@xen.org>2013-03-07 13:22:32 +0000
committerTim Deegan <tim@xen.org>2013-03-14 10:35:56 +0000
commit6524455339349779c553af949b81d3d46f051797 (patch)
treed041073a3df002fed933b405fd8a3d8e987b7fd6 /xen/arch/x86/mm
parent97724f16028522c07f8251d94b6cca4552391fe4 (diff)
downloadxen-6524455339349779c553af949b81d3d46f051797.tar.gz
xen-6524455339349779c553af949b81d3d46f051797.tar.bz2
xen-6524455339349779c553af949b81d3d46f051797.zip
x86/ept: check for errors in a few callers of ept_set_entry.
AFAICT in all these cases we have the p2m lock and have just checked that the p2m trie is populated so the call should succeed. Make it explicit with ASSERT() rather than just ignoring the result. Signed-off-by: Tim Deegan <tim@xen.org> Acked-by: Jan Beulich <jbeulich@suse.com>
Diffstat (limited to 'xen/arch/x86/mm')
-rw-r--r--xen/arch/x86/mm/p2m-ept.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c
index a2d1591db6..595c6e79da 100644
--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -401,8 +401,9 @@ ept_set_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn,
/* then move to the level we want to make real changes */
for ( ; i > target; i-- )
- ept_next_level(p2m, 0, &table, &gfn_remainder, i);
-
+ if ( !ept_next_level(p2m, 0, &table, &gfn_remainder, i) )
+ break;
+ /* We just installed the pages we need. */
ASSERT(i == target);
index = gfn_remainder >> (i * EPT_TABLE_ORDER);
@@ -704,6 +705,7 @@ void ept_change_entry_emt_with_range(struct domain *d,
mfn_t mfn;
int order = 0;
struct p2m_domain *p2m = p2m_get_hostp2m(d);
+ int rc;
p2m_lock(p2m);
for ( gfn = start_gfn; gfn <= end_gfn; gfn++ )
@@ -732,7 +734,11 @@ void ept_change_entry_emt_with_range(struct domain *d,
order = level * EPT_TABLE_ORDER;
if ( need_modify_ept_entry(p2m, gfn, mfn,
e.ipat, e.emt, e.sa_p2mt) )
- ept_set_entry(p2m, gfn, mfn, order, e.sa_p2mt, e.access);
+ {
+ rc = ept_set_entry(p2m, gfn, mfn, order,
+ e.sa_p2mt, e.access);
+ ASSERT(rc);
+ }
gfn += trunk;
break;
}
@@ -741,8 +747,12 @@ void ept_change_entry_emt_with_range(struct domain *d,
}
else /* gfn assigned with 4k */
{
- if ( need_modify_ept_entry(p2m, gfn, mfn, e.ipat, e.emt, e.sa_p2mt) )
- ept_set_entry(p2m, gfn, mfn, order, e.sa_p2mt, e.access);
+ if ( need_modify_ept_entry(p2m, gfn, mfn,
+ e.ipat, e.emt, e.sa_p2mt) )
+ {
+ rc = ept_set_entry(p2m, gfn, mfn, order, e.sa_p2mt, e.access);
+ ASSERT(rc);
+ }
}
}
p2m_unlock(p2m);