From: "Jan Beulich" Subject: Re: [PATCH] x86: moke show_page_walk() more robust Date: Mon, 20 Jul 2009 07:39:28 +0100 Message-ID: <4A642D40020000780000B444@vpn.id2.novell.com> References: <4A605E7C020000780000B011@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org I very much think it is worthwhile: In the case given, a supposed guest = crash resulted in a host crash - the expected behavior would have been to do the page table walk, then forward the fault to the guest. Jan >>> Keir Fraser 17.07.09 21:48 >>> Is this worthwhile? It's kind of game over by this point, and we already dumped out the useful stuff. And the ensuing crash makes it very clear = that the page walk discovered an invalid mfn (rather than this alternative of silently truncating the walk). -- Keir On 17/07/2009 10:20, "Jan Beulich" wrote: > This should fix the host crash reported in the thread "d273:v3: > reserved bit in page table (ec=3D0019)" (but it specifically doesn't = deal > with the yet unknown original cause of the problem). >=20 > Also add in a missing line in x86-64's do_page_walk(). >=20 > Signed-off-by: Jan Beulich >=20 > --- 2009-07-10.orig/xen/arch/x86/x86_32/traps.c 2009-07-10 13:58:56.00000= 0000 > +0200 > +++ 2009-07-10/xen/arch/x86/x86_32/traps.c 2009-07-17 11:12:42.000000000 = +0200 > @@ -165,7 +165,8 @@ void show_page_walk(unsigned long addr) > printk(" L3[0x%03lx] =3D %"PRIpte" %08lx\n", > l3_table_offset(addr), l3e_get_intpte(l3e), pfn); > unmap_domain_page(l3t); > - if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) ) > + if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) || > + !mfn_valid(mfn) ) > return; > =20 > l2t =3D map_domain_page(mfn); > @@ -178,7 +179,8 @@ void show_page_walk(unsigned long addr) > (l2e_get_flags(l2e) & _PAGE_PSE) ? "(PSE)" : ""); > unmap_domain_page(l2t); > if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) || > - (l2e_get_flags(l2e) & _PAGE_PSE) ) > + (l2e_get_flags(l2e) & _PAGE_PSE) || > + !mfn_valid(mfn) ) > return; > =20 > l1t =3D map_domain_page(mfn); > --- 2009-07-10.orig/xen/arch/x86/x86_64/mm.c 2009-07-10 13:58:56.00000000= 0 > +0200 > +++ 2009-07-10/xen/arch/x86/x86_64/mm.c 2009-07-17 11:10:29.000000000 = +0200 > @@ -124,6 +124,7 @@ void *do_page_walk(struct vcpu *v, unsig > l3e =3D l3t[l3_table_offset(addr)]; > mfn =3D l3e_get_pfn(l3e); > if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) || !mfn_valid(mfn) ) > + return NULL; > if ( (l3e_get_flags(l3e) & _PAGE_PSE) ) > return mfn_to_virt(mfn) + (addr & ((1UL << L3_PAGETABLE_SHIFT) = - 1)); > =20 > --- 2009-07-10.orig/xen/arch/x86/x86_64/traps.c 2009-07-10 13:58:56.00000= 0000 > +0200 > +++ 2009-07-10/xen/arch/x86/x86_64/traps.c 2009-07-17 11:11:59.000000000 = +0200 > @@ -180,7 +180,8 @@ void show_page_walk(unsigned long addr) > pfn =3D mfn_valid(mfn) ? get_gpfn_from_mfn(mfn) : INVALID_M2P_ENTRY;= > printk(" L4[0x%03lx] =3D %"PRIpte" %016lx\n", > l4_table_offset(addr), l4e_get_intpte(l4e), pfn); > - if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) ) > + if ( !(l4e_get_flags(l4e) & _PAGE_PRESENT) || > + !mfn_valid(mfn) ) > return; > =20 > l3t =3D mfn_to_virt(mfn); > @@ -192,7 +193,8 @@ void show_page_walk(unsigned long addr) > l3_table_offset(addr), l3e_get_intpte(l3e), pfn, > (l3e_get_flags(l3e) & _PAGE_PSE) ? " (PSE)" : ""); > if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) || > - (l3e_get_flags(l3e) & _PAGE_PSE) ) > + (l3e_get_flags(l3e) & _PAGE_PSE) || > + !mfn_valid(mfn) ) > return; > =20 > l2t =3D mfn_to_virt(mfn); > @@ -204,7 +206,8 @@ void show_page_walk(unsigned long addr) > l2_table_offset(addr), l2e_get_intpte(l2e), pfn, > (l2e_get_flags(l2e) & _PAGE_PSE) ? "(PSE)" : ""); > if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) || > - (l2e_get_flags(l2e) & _PAGE_PSE) ) > + (l2e_get_flags(l2e) & _PAGE_PSE) || > + !mfn_valid(mfn) ) > return; > =20 > l1t =3D mfn_to_virt(mfn); >=20 >=20 >=20 >=20 > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com=20 > http://lists.xensource.com/xen-devel=20