From: Tim Deegan Date: Thu, 2 Jun 2011 12:16:52 +0000 (+0100) Subject: x86/mm/p2m: Fix locking discipline around p2m updates. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~10233 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=eb4fb7f1e4c3c368a3510ce245e957312cbeed97;p=xen.git x86/mm/p2m: Fix locking discipline around p2m updates. Direct callers of the p2m setting functions must hold the p2m lock. Signed-off-by: Tim Deegan --- diff --git a/xen/arch/x86/mm/hap/nested_hap.c b/xen/arch/x86/mm/hap/nested_hap.c index bddc51f228..e23cf33c0f 100644 --- a/xen/arch/x86/mm/hap/nested_hap.c +++ b/xen/arch/x86/mm/hap/nested_hap.c @@ -103,9 +103,12 @@ nestedhap_fix_p2m(struct p2m_domain *p2m, paddr_t L2_gpa, paddr_t L0_gpa, ASSERT(p2m); ASSERT(p2m->set_entry); - rv = p2m->set_entry(p2m, L2_gpa >> PAGE_SHIFT, + p2m_lock(p2m); + rv = set_p2m_entry(p2m, L2_gpa >> PAGE_SHIFT, page_to_mfn(maddr_to_page(L0_gpa)), 0 /*4K*/, p2mt, p2ma); + p2m_unlock(p2m); + if (rv == 0) { gdprintk(XENLOG_ERR, "failed to set entry for 0x%"PRIx64" -> 0x%"PRIx64"\n", diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 6608cad3f7..460fbab9dc 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -140,6 +140,8 @@ int set_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn, unsigned int order; int rc = 1; + ASSERT(p2m_locked_by_me(p2m)); + while ( todo ) { if ( hap_enabled(d) )