From: Tim Deegan Subject: Re: [RFC PATCH 13/16]: PVH xen: introduce p2m_map_foreign Date: Thu, 7 Feb 2013 10:56:21 +0000 Message-ID: <20130207105621.GA77133@ocelot.phlegethon.org> References: <20130111180944.4ff10c8f@mantra.us.oracle.com> <20130124171815.GM20551@ocelot.phlegethon.org> <20130131183824.3af5e6a0@mantra.us.oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20130131183824.3af5e6a0@mantra.us.oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Mukesh Rathor Cc: "Xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org At 18:38 -0800 on 31 Jan (1359657504), Mukesh Rathor wrote: > On Thu, 24 Jan 2013 17:18:15 +0000 > Tim Deegan wrote: > > > At 18:09 -0800 on 11 Jan (1357927784), Mukesh Rathor wrote: > > > @@ -584,6 +584,11 @@ guest_physmap_add_entry(struct domain *d > > > { > > > ASSERT(mfn_valid(omfn)); > > > set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY); > > > + > > > + /* Because PVH domU uses kmalloc for grant pfn, we > > > need to save > > > + * and restore the old mfn */ > > > + if (is_pvh_domain(d) && p2m_is_grant(t)) > > > + free_domheap_page(mfn_to_page(omfn)); > > > > I think you'll need to explain this in more detail. The comment > > assumes that the guest is running linux, which is worrying. And in > > any case you can't just free_domheap_page() the guest's memory! What > > if another domain has a reference to it? > > Ok, I fixed linux side so instead of kmalloc it uses ballooning to > get pfn space for the grant table. That means there should not be > an omfn here. If there is, I think I should just fail the operation, > ie, guest_physmap_add_entry(), right? Currently, guest_physmap_add_entry() just overwrites the old entry, allowing the guest to leak it if it wants to. It's perhaps not the best interface in the world, but I think PVH guetst should get the same treatment as HVM ones. Tim.