[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] direct_remap_pfn_range vm_flags fix

On 8 Feb 2006, at 08:28, Chris Wright wrote:

direct_remap_pfn_range() does not properly mark vma with VM_PFNMAP.
This triggers improper reference counting on what rmap thought was
a normal page, and a subsequent BUG() such as:

It isn't really proper for direct_remap_pfn_range() to set VM_PFNMAP. Properly that function should actually be called remap_mfn_range(). vm_pgoff is an MFN, and what is mapped is a contiguous sequence of MFNs.

So the PFNMAP checks in vm_normal_page() do not work, since pte_pfn() will not return a contiguous sequence of PFNs starting from vm_pgoff -- the MFNs are contiguous, not the PFNs. What saves you currently is the cow_mapping() check in vm_normal_page(). If we created private mappings of any guest-local memory via direct_remap_pfn_range(), we would still crash.

Possible proper fixes:
1. Don't map local memory via that interface -- only xenstored does this, when mapping dom0's xenbus page. This could be changed. 2. Add a _PAGE_DIRECTMAP flag, just for Xen, that indicates unrefcounted PTEs.

 -- Keir

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.