Muli Ben-Yehuda
2006-May-31 16:14 UTC
[Xen-devel] [PATCH] free the right 1st level page table page in map_pages_to_xen
Hi Keir,
I think there''s a buglet in map_pages_to_xen(), although it''s
entirely
possible I''m mis-reading it. In the case where we end up replacing a
non-super-page 2nd level entry with a super-page entry, we should free
the page table page pointed to by the old entry, not the new entry
(which doesn''t actually point to a 1st level page).
Here''s an untested "obviously correct" patch.
Signed-off-by: Muli Ben-Yehuda <muli@il.ibm.com>
diff -r 0d17e9d6353d xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Wed May 31 10:22:47 2006 -0400
+++ b/xen/arch/x86/mm.c Wed May 31 12:11:46 2006 -0400
@@ -3708,8 +3708,9 @@ int map_pages_to_xen(
if ( (l2e_get_flags(ol2e) & _PAGE_PRESENT) )
{
local_flush_tlb_pge();
+ /* Free the 1st level ptpage pointed to old 2nd level entry. */
if ( !(l2e_get_flags(ol2e) & _PAGE_PSE) )
- free_xen_pagetable(l2e_get_page(*pl2e));
+ free_xen_pagetable(l2e_get_page(ol2e));
}
virt += 1UL << L2_PAGETABLE_SHIFT;
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Keir Fraser
2006-May-31 16:21 UTC
[Xen-devel] Re: [PATCH] free the right 1st level page table page in map_pages_to_xen
On 31 May 2006, at 17:14, Muli Ben-Yehuda wrote:> I think there''s a buglet in map_pages_to_xen(), although it''s entirely > possible I''m mis-reading it. In the case where we end up replacing a > non-super-page 2nd level entry with a super-page entry, we should free > the page table page pointed to by the old entry, not the new entry > (which doesn''t actually point to a 1st level page). > > Here''s an untested "obviously correct" patch.Agreed. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel