From: Tim Deegan Subject: Re: [PATCH 5 of 9] x86/mm: Ensure maps used by nested hvm code cannot be paged out Date: Thu, 1 Dec 2011 14:27:29 +0000 Message-ID: <20111201142729.GD61203@ocelot.phlegethon.org> References: <4ED60F1D02000078000644C4@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <4ED60F1D02000078000644C4@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jan Beulich Cc: xen-devel@lists.xensource.com, ian.campbell@citrix.com, andres@gridcentric.ca, keir.xen@gmail.com, Andres Lagar-Cavilla , ian.jackson@citrix.com, adin@gridcentric.ca List-Id: xen-devel@lists.xenproject.org At 10:10 +0000 on 30 Nov (1322647821), Jan Beulich wrote: > >>> On 29.11.11 at 21:21, Andres Lagar-Cavilla wrote: > > --- a/xen/arch/x86/hvm/hvm.c > > +++ b/xen/arch/x86/hvm/hvm.c > > @@ -1828,7 +1831,12 @@ static void *__hvm_map_guest_frame(unsig > > if ( writable ) > > paging_mark_dirty(d, mfn); > > > > - return map_domain_page(mfn); > > + pg = mfn_to_page(mfn); > > + page_get_owner_and_reference(pg); > > This can (at least theoretically) fail, and you must handle failure (or > explain in a comment why not). Also, you should probably be using get_page(pg, d); is there any reason to skip the ownership check? Tim.