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

Re: [PATCH][4.15] x86: mirror compat argument translation area for 32-bit PV


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 22 Feb 2021 15:46:11 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z5znb0meEW6WIg2ygXXgb/pfy3QminwbKmrSm+/8LeM=; b=mw7z8U0PSBziBhdR3V+Lm3Y2k1dVC7oTSWhSmXIIYJ1lWhs5mZBPqaMjgGJ+zAK5zV41LjS+1eIc9ZxrcFnYuQJdWbSVdD3x7lQGyeh8sR5mN75mYKMXNV2a1Wp2PraKVSSIs3igJfpYbhlUw/LXxaM5BirIjD+5xyr472Ztb0MTXKApq4MCirSuVarkvJZ9UJJz+DnRPaKFrs756HpI2azLdin6TxSAd3Izpv9FHe2GnFSKV+yOkLsrG9Nfvlo4YNdjDKe3t6MABlADsLbxOH+ZR7RNM1ICIBK6JNNA3rt/5oE92CZg0UthnlgQYntoaWn9AeBkqY9tJ0+pHe4Opw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YW7XWaViBCnvESqwAxr6LaINwkR25d5qYw+uc17+0LKMQqQIqfzc/ydgacJHPq0ItiSwa7pSLanaRAe3C3qKyB2y+ePEi8hdGAb/aL89335fLW03BCsJDEf2B3U2LfmBEtAE4OdxZ6QbkXYARy6Xgz7NY/sCtCj4xKziwN4LNkzLrQ43EnWHXSHtpCL28y9xtUe/0DbktqPk2ECcecrw2FEwj6b5XX696apQqa9bAPH476Mckx7Y1huLnFNIzk3tefxIsqj6erwlAV4E1Ld1MRx1RPZn4ehmvWXfl0U9T9tWtco2ojavWiGNPv4D4RBfP1VpAE6tqaLDa/NYU9Sw2Q==
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Mon, 22 Feb 2021 14:46:27 +0000
  • Ironport-sdr: GpHzofYtOioQ7Swf8sRu6kijspYGgVnryXNhpBZJAfcUsv1v6FBJpN6RRevA/8HugoJXnxBMv5 eN4Wdgb3PaFP03zmZ7gwcozX1/HoeBg3QawXGWTF7GWa3fcEDhz8L9ks74ChbDaYy3nSkmgLhw 86uDfnoCL594Xv3Dm8B9Q11C/Ox5+X6IvyMzAeAfgHyEBE52lnivPHTkb94li8q6DLf/RTniSK JgHK9WOLrq9/ECmbMmq8ZBGQkKJROwGuNTGrKeLLlMPsVcYHVdB42zX80gYNA8m17uaiCxi8hg iiQ=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Feb 22, 2021 at 03:20:24PM +0100, Jan Beulich wrote:
> On 22.02.2021 15:13, Roger Pau Monné wrote:
> > On Mon, Feb 22, 2021 at 12:35:21PM +0100, Roger Pau Monné wrote:
> >> On Mon, Feb 22, 2021 at 11:27:07AM +0100, Jan Beulich wrote:
> >>> Now that we guard the entire Xen VA space against speculative abuse
> >>> through hypervisor accesses to guest memory, the argument translation
> >>> area's VA also needs to live outside this range, at least for 32-bit PV
> >>> guests. To avoid extra is_hvm_*() conditionals, use the alternative VA
> >>> uniformly.
> >>
> >> Since you are double mapping the per-domain virtual area, won't it
> >> make more sense to map it just once outside of the Xen virtual space
> >> area? (so it's always using PML4_ADDR(511))
> > 
> > Right, that's not possible for PV 64bit domains because it's guest
> > owned linear address space in that case.
> > 
> > It seems like paravirt_ctxt_switch_to will modify the root_pgt to set
> > the PERDOMAIN_VIRT_START entry, does the same need to be done for
> > PERDOMAIN2_VIRT_START?
> 
> I don't think so, no. Argument translation doesn't happen when
> the restricted page tables are in use, and all other uses of
> the per-domain area continue to use the "normal" VA.

Oh, OK, thanks for the clarification. AFAICT the PERDOMAIN2_VIRT_START
slot won't get populated on the restricted page tables, and hence will
always trigger a page fault if access is attempted with those tables
loaded.

> > I would also consider giving the slot a more meaningful name, as
> > PERDOMAIN2_VIRT_START makes it seem like a new per-domain scratch
> > space, when it's just a different mapping of the existing physical
> > memory.
> > 
> > Maybe PERDOMAIN_MIRROR_VIRT_START? Or PERDOMAIN_XLAT_VIRT_START?
> 
> XLAT would be too specific - while we use it for xlat only, it's
> still all of the mappings that appear at the alternate addresses.

Well, given that such mappings won't be available when running 64bit
PV guests I still think it's unlikely to be used for anything that's
not XLAT specific, as it won't work for 64bit PV guests otherwise.

> I did consider using MIRROR, but it got too long for my taste.
> Now that I think about it maybe PERDOMAIN_ALT_VIRT_START would do?

Indeed, I would prefer that rather than PERDOMAIN2_VIRT_START if you
still consider XLAT to be too specific.

Thanks, Roger.



 


Rackspace

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