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

Re: [PATCH v2][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 17:11:15 +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=jbkpyKsGP2H59wfl58+O1sN6CTAlszEnW1TPSoDA6PI=; b=CEUBHOoyGVQxXKcHkz1Mo/YV0SnyWUQQtoLT6yiMZ822cubjYOKLZl/JR7LkBIpvusXlUeDb38OmE6iU9KaantfCTIPFC7M9RTexUe20dB1tbW4qdHHWVWmlNi8BlH9RgggUTYRVZuTf93/sRpQ2Q+hTUbx6qyV+V8ucVyXq4M9tgJCavOgzqIfOVtjtlrjjIJfvbdszF2Hi1cWa0yYVx1KEqTwEtYgYtTX/uf8+ValHQNgpN5OuGugQVAmp6EFLcDfv8KaJx1vhqabwngMAKMnK/iorb6Uy1EN41t+r4V1tVyJxOYfeDIyqM7HQ/GeFC7v2qIEUHEwEfB8lT29pwA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ajc8TUQxyynmuOpQnGnMadylbSlDjU729F/hhxrY+YSwsM/uhoJopuirGen7sD7qsiWSUz0MDG4FUd8WIij9MhsZxEtsGQyf9dVY1/y4GavVMzjUO5YIPiyyji+Q8B0KC0lwvU9Xig5bkfXEZbBAxpFkg+rstpJax7f+0kGhPZAOTdyDfQaksgEvzFUXlxuCAFyvoCkduzpen+aPT3tvUFrggm+AJFUv/nMDfaRwM4GZWK41lqCugfvwWbvIEJaTzgReCVo57YOam3F5T9EgYZ7wTK0Y/W+3Ohi6Aw4UR7i4R5AF3JYxswpBkYG1Ov/VxP6djTP+KrVoiC/ohWJtfA==
  • 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 16:11:28 +0000
  • Ironport-sdr: bTQJDP0O7BbF0wV/ZqN8XrfTYJj7Z4/rwhgnB4pG50DVvcP6NB1mnwFwhxZpE03Xnq/gBxGMsu AwhvWZV72rToOb/2L5+dcLUZ6LjQoYhcj7ZVF57mIAZOSDCnMV/qNKAe0/hfnE9GrTcdwKXVxq OZ8cL+Vio5Ekw4UbdJ3WSU9gncc0hs+NBrC0iXmayKHkGBgU01YZf3gEes0rc/RI6/elFYuXRi pyzFQ6YjL/R5/T7ajkaRzV278xiAT3ypreobVGLLHBcA2cmE8FUCllpMwlOcZGLucBKMFa5+Om KMI=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Feb 22, 2021 at 04:50:14PM +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.
> 
> While this could be conditionalized upon CONFIG_PV32 &&
> CONFIG_SPECULATIVE_HARDEN_GUEST_ACCESS, omitting such extra conditionals
> keeps the code more legible imo.
> 
> Fixes: 4dc181599142 ("x86/PV: harden guest memory accesses against 
> speculative abuse")
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> Release-Acked-by: Ian Jackson <iwj@xxxxxxxxxxxxxx>

Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

One comment nit below.

> ---
> v2: Rename PERDOMAIN2_VIRT_START to PERDOMAIN_ALT_VIRT_START.
> 
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -1727,6 +1727,11 @@ void init_xen_l4_slots(l4_pgentry_t *l4t
>                 (ROOT_PAGETABLE_FIRST_XEN_SLOT + slots -
>                  l4_table_offset(XEN_VIRT_START)) * sizeof(*l4t));
>      }
> +
> +    /* Slot 511: Per-domain mappings mirror. */
> +    if ( !is_pv_64bit_domain(d) )
> +        l4t[l4_table_offset(PERDOMAIN_ALT_VIRT_START)] =
> +            l4e_from_page(d->arch.perdomain_l3_pg, __PAGE_HYPERVISOR_RW);
>  }
>  
>  bool fill_ro_mpt(mfn_t mfn)
> --- a/xen/include/asm-x86/config.h
> +++ b/xen/include/asm-x86/config.h
> @@ -159,11 +159,11 @@ extern unsigned char boot_edid_info[128]
>   *    1:1 direct mapping of all physical memory.
>  #endif
>   *  0xffff880000000000 - 0xffffffffffffffff [120TB,             PML4:272-511]
> - *    PV: Guest-defined use.
> + *    PV (64-bit): Guest-defined use.
>   *  0xffff880000000000 - 0xffffff7fffffffff [119.5TB,           PML4:272-510]
>   *    HVM/idle: continuation of 1:1 mapping
>   *  0xffffff8000000000 - 0xffffffffffffffff [512GB, 2^39 bytes  PML4:511]
> - *    HVM/idle: unused
> + *    HVM / 32-bit PV: Secondary per-domain mappings.

I would use "Mirrored per-domain mappings." to make it clear this is
indented to be backed up by the same physical range as the original
per-domain mappings.

Thanks, Roger.



 


Rackspace

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