From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: [PATCH 2/2] memory: don't hand MFN info to translated guests Date: Tue, 04 Apr 2017 07:14:26 -0600 Message-ID: <58E3B852020000780014CA6E@prv-mh.provo.novell.com> References: <58E3B354020000780014CA30@prv-mh.provo.novell.com> <58E3B354020000780014CA30@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part6D54DB22.4__=" Return-path: Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cvOI3-0006FS-UI for xen-devel@lists.xenproject.org; Tue, 04 Apr 2017 13:14:32 +0000 In-Reply-To: <58E3B354020000780014CA30@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel Cc: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part6D54DB22.4__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline We shouldn't hand MFN info back from increase-reservation for translated domains, just like we don't for populate-physmap and memory-exchange. For full symmetry also check for a NULL guest handle in populate_physmap() (but note this makes no sense in memory_exchange(), as there the array is also an input). Signed-off-by: Jan Beulich --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -122,7 +122,8 @@ static void increase_reservation(struct } =20 /* Inform the domain of the new page's machine address. */=20 - if ( !guest_handle_is_null(a->extent_list) ) + if ( !paging_mode_translate(d) && + !guest_handle_is_null(a->extent_list) ) { mfn =3D page_to_mfn(page); if ( unlikely(__copy_to_guest_offset(a->extent_list, i, &mfn, = 1)) ) @@ -238,7 +239,8 @@ static void populate_physmap(struct memo =20 guest_physmap_add_page(d, _gfn(gpfn), _mfn(mfn), a->extent_ord= er); =20 - if ( !paging_mode_translate(d) ) + if ( !paging_mode_translate(d) && + !guest_handle_is_null(a->extent_list) ) { for ( j =3D 0; j < (1U << a->extent_order); j++ ) set_gpfn_from_mfn(mfn + j, gpfn + j); --=__Part6D54DB22.4__= Content-Type: text/plain; name="memory-increase-trans-no-wb.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="memory-increase-trans-no-wb.patch" memory: don't hand MFN info to translated guests=0A=0AWe shouldn't hand = MFN info back from increase-reservation for=0Atranslated domains, just = like we don't for populate-physmap and=0Amemory-exchange. For full = symmetry also check for a NULL guest handle=0Ain populate_physmap() (but = note this makes no sense in=0Amemory_exchange(), as there the array is = also an input).=0A=0ASigned-off-by: Jan Beulich =0A=0A--= - a/xen/common/memory.c=0A+++ b/xen/common/memory.c=0A@@ -122,7 +122,8 @@ = static void increase_reservation(struct=0A }=0A =0A /* = Inform the domain of the new page's machine address. */ =0A- if ( = !guest_handle_is_null(a->extent_list) )=0A+ if ( !paging_mode_transl= ate(d) &&=0A+ !guest_handle_is_null(a->extent_list) )=0A = {=0A mfn =3D page_to_mfn(page);=0A if ( = unlikely(__copy_to_guest_offset(a->extent_list, i, &mfn, 1)) )=0A@@ -238,7 = +239,8 @@ static void populate_physmap(struct memo=0A =0A = guest_physmap_add_page(d, _gfn(gpfn), _mfn(mfn), a->extent_order);=0A =0A- = if ( !paging_mode_translate(d) )=0A+ if ( !paging_mod= e_translate(d) &&=0A+ !guest_handle_is_null(a->extent_list)= )=0A {=0A for ( j =3D 0; j < (1U << a->extent_= order); j++ )=0A set_gpfn_from_mfn(mfn + j, gpfn + = j);=0A --=__Part6D54DB22.4__= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --=__Part6D54DB22.4__=--