From: Jan Beulich Date: Tue, 27 Oct 2015 13:46:12 +0000 (+0100) Subject: x86/PV: don't zero-map LDT X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=61031e64d3dafd2fb1953436444bf02eccb9b146;p=people%2Froyger%2Fxen.git x86/PV: don't zero-map LDT This effectvely reverts the LDT related part of commit cf6d39f819 ("x86/PV: properly populate descriptor tables"), which broke demand paged LDT handling in guests. Reported-by: David Vrabel Diagnosed-by: Andrew Cooper Signed-off-by: Jan Beulich Tested-by: David Vrabel Reviewed-by: Andrew Cooper --- diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 327b837999..87634146a2 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -508,7 +508,6 @@ static void invalidate_shadow_ldt(struct vcpu *v, int flush) { l1_pgentry_t *pl1e; unsigned int i; - unsigned long pfn, zero_pfn = PFN_DOWN(__pa(zero_page)); struct page_info *page; BUG_ON(unlikely(in_irq())); @@ -523,11 +522,10 @@ static void invalidate_shadow_ldt(struct vcpu *v, int flush) for ( i = 16; i < 32; i++ ) { - pfn = l1e_get_pfn(pl1e[i]); - if ( !(l1e_get_flags(pl1e[i]) & _PAGE_PRESENT) || pfn == zero_pfn ) + if ( !(l1e_get_flags(pl1e[i]) & _PAGE_PRESENT) ) continue; - l1e_write(&pl1e[i], l1e_from_pfn(zero_pfn, __PAGE_HYPERVISOR_RO)); - page = mfn_to_page(pfn); + page = l1e_get_page(pl1e[i]); + l1e_write(&pl1e[i], l1e_empty()); ASSERT_PAGE_IS_TYPE(page, PGT_seg_desc_page); ASSERT_PAGE_IS_DOMAIN(page, v->domain); put_page_and_type(page);