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

Ping: [PATCH] x86/paging: restrict physical address width reported to guests


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 18 Oct 2021 10:32:50 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0ckteT9f09rmydGrRAXFDU1djCAJx0Y6/nZgDk36Vcw=; b=As/jVrJwbpwtw2UmHBYdg6fQ07S3vA1HOQBKjwNsGHV73GN+ugn4V9rdrhx64JciJWbRWzWvxPZ2uRz2LsEk1X1fhOQBt2u+Ng4vEcRaNZqQ3Mo4A6UpTgHbi3pEigZzxFNBvXNiAegmAJQZZqegj97xgHBP4xezt3TxCA6bJwGtFruYy0SMGlHZrVogRuiN3eUwwk0PlQNZJtz8ArKPCxaFP07/nLm3L5AXqhoAOUtgn05ucFL7sDsj7SqMlQjl34SHK7MaHdVC9pEOn4lBFQFuCPKjUosTRQ9tTZGnmkcdLWBgvRGBMwrWP1G08v97ErilzNHPL+yOcQtxiyrAow==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZEplxdq7J63IkKXsEyJutkPA6zfA8+h9wxSV4AGjDuJmM3mPEjUxm2VI8rD40QUPFNKGm5+Ypl2FakmyaGj3IXe4CNyoxzN0fDPOuYnV7Wj7yK8cfrveTyhAYOwcs1+Fd1s7ocpnUjCT3MexWojK1V0vVvaNEiE09abP9qTYH3KewJ41i3kktSxnIcjvV2iyTcHyt077Ru1bl9YbiTTa/rtFA4Ai2+PnEx9jgErseUMRh9nwBh8VgP27Tt8HdiN58izAk94vFMo6dGtVzUovdUPF7o9EVqOUFJgUpAtUjU+N//uBmrLhlJcv9TBc1RH9NjjbFNBiY/FNpTKDJrQCDg==
  • Authentication-results: xenproject.org; dkim=none (message not signed) header.d=none;xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Mon, 18 Oct 2021 08:32:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 29.09.2021 14:47, Jan Beulich wrote:
> Modern hardware may report more than 48 bits of physical address width.
> For paging-external guests our P2M implementation does not cope with
> larger values. Telling the guest of more available bits means misleading
> it into perhaps trying to actually put some page there (like was e.g.
> intermediately done in OVMF for the shared info page).
> 
> While there also convert the PV check to a paging-external one (which in
> our current code base are synonyms of one another anyway).
> 
> Fixes: 5dbd60e16a1f ("x86/shadow: Correct guest behaviour when creating PTEs 
> above maxphysaddr")
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Anyone?

Thanks, Jan

> --- a/xen/include/asm-x86/paging.h
> +++ b/xen/include/asm-x86/paging.h
> @@ -401,11 +401,18 @@ static always_inline unsigned int paging
>  {
>      unsigned int bits = paging_mode_hap(d) ? hap_paddr_bits : paddr_bits;
>  
> -    if ( !IS_ENABLED(CONFIG_BIGMEM) && paging_mode_shadow(d) &&
> -         !is_pv_domain(d) )
> +    if ( paging_mode_external(d) )
>      {
> -        /* Shadowed superpages store GFNs in 32-bit page_info fields. */
> -        bits = min(bits, 32U + PAGE_SHIFT);
> +        if ( !IS_ENABLED(CONFIG_BIGMEM) && paging_mode_shadow(d) )
> +        {
> +            /* Shadowed superpages store GFNs in 32-bit page_info fields. */
> +            bits = min(bits, 32U + PAGE_SHIFT);
> +        }
> +        else
> +        {
> +            /* Both p2m-ept and p2m-pt only support 4-level page tables. */
> +            bits = min(bits, 48U);
> +        }
>      }
>  
>      return bits;
> 
> 




 


Rackspace

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