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

Re: [PATCH 05/12] libxenguest: complete loops in xc_map_domain_meminfo()


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Fri, 25 Jun 2021 19:30:02 +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=1nJvP+9uFsJIXLduVWEcB6WqwnucemD0Bt0vSwzrOb4=; b=hCCPhPuz6MyCaIYFLB7Vgg274P8eabXKO8dw7UIddn3KU/2DNn6iLV1mQCm+O0iC8AKwgqTdJWavNnOmm4pfSBJtzyRYcT/XuQNN6uwXAIM1kRWDZKzNjm05NKYKMXn6kDQTBriAEtCmvUtgnl3Ufoxcun/K6Z23B4eVzxPM9sB54qnPQqoLsbMn6RI3xBJfqgYDNuPje9qBf6GaCMw89NlftzSpBgHq2Tb5up3b2aIYc9B9qpdY+3921wC+HravTIvtB3NjGOuRbE2W+U6MXYN+9zZtknQWaJjXAP+ZR204dEZJsVY7lOmksn7IR8ELt+Dsigktxo9RDvjABx8l8Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZWMElGv2eMI8J0CNeIuXc5AxAkitdAofU2WgaEgHGxYxRr0StW1whpiLja8rz8IT+iV0S1uc5b96mrKeiLcQW7/ofqjMUo4erZiSnjsdkctE2bUXUvmpOoaArAX/NHt0ZWlrfhTgN5zTuu1UvpuFBsfxenr5gUPt7/Naeb6NBBh5nkpsTHa4zRlQ8/Nrbx0AmzjCCQZkMq/nukfA5oD39jGNl2Ll66A9m8ufg8ANSvXnZK/K5V9gljepe71ylHGEzky/K1Usd/8ZrpIdX3rkurGpGNOUbWqYaDf+wiy4mDSP+v4irkyblNrZI2+LzN+9D/N007gOLj+vu1tvWYNmjA==
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Fri, 25 Jun 2021 18:30:29 +0000
  • Ironport-hdrordr: A9a23:jRW7g6z2l49B409VEounKrPxyOskLtp133Aq2lEZdPULSKKlfp GV88jziyWZtN9wYhEdcdDpAtjlfZquz+8K3WB3B8bcYOCGghrVEGgG1+rfKlLbalbDH4JmpM Fdmu1FeaDN5DtB/LTHCWuDYq4dKbC8mcjC74qurAYOPHVXguNbnmBE426gYz5LrWJ9dOME/f Snl696TnabCA4qhpPRPAh0YwGPnayEqLvWJTo9QzI34giHij2lrJb8Dhijxx8bFxdC260r/2 TpmxHwovzLiYD69jbsk0voq7hGktrozdVOQOSKl8guMz3pziKlfp5oVbGutC085Muv9FEput /RpApIBbUz11rhOkWO5Tf90Qjp1zgjr1X4z0WDvHflqcvlABonFston+tiA17kwntlmOs5/L NA3mqfuZYSJwjHhj7B69/BUAwvvlaooEAljfUYgxVkIMkjgYdq3MsiFX5uYdE99HqQ0vF/LA AuNrCe2B9uSyLfU5iD1VMfmOBFNx8Ib2K7qktrgL3Z79EZpgEj86O0rPZv1kvoz6hNPaWs0d 60eJiApIs+OfP+UpgNTdvpYfHHRlAlEii8f157HzzcZeo60iX22u/KCfMOlbuXRKA=
  • Ironport-sdr: VcNld3m5D5MHLdoI4b6pvA+A92bvhDpVKdMMKk7yMDkq1r5NdigIFdQG2VyfEt34fUnOkeedfy +kDqTJt32v33b5l3Cop99A9a0lFTlhR61atKcDnIDJRf9110tw5aE/uBEWMboVxHCC3OyGUQ0c aMdEMGWIg/xo+1mpDL+OCp+99v314Gr5QmnWvMwHyseqJ7/Vf6BipSFHXXR/YF71+xG91jojm3 WGclPMrOI1BX9pVpyjnOQv1HZuug5rekFA1zwwHX6bQfu3wuw31ER2rXsQ0s8PD9OvBVcO4K2Q 8cM=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 25/06/2021 14:19, Jan Beulich wrote:
> minfo->p2m_size may have more than 31 significant bits. Change the
> induction variable to unsigned long, and (largely for signed-ness
> consistency) a helper variable to unsigned int.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>
> --- a/tools/libs/guest/xg_domain.c
> +++ b/tools/libs/guest/xg_domain.c
> @@ -40,7 +40,7 @@ int xc_map_domain_meminfo(xc_interface *
>      xc_dominfo_t info;
>      shared_info_any_t *live_shinfo;
>      xen_capabilities_info_t xen_caps = "";
> -    int i;
> +    unsigned long i;
>  
>      /* Only be initialized once */
>      if ( minfo->pfn_type || minfo->p2m_table )
> @@ -116,12 +116,12 @@ int xc_map_domain_meminfo(xc_interface *
>      /* Retrieve PFN types in batches */
>      for ( i = 0; i < minfo->p2m_size ; i+=1024 )
>      {
> -        int count = ((minfo->p2m_size - i ) > 1024 ) ?
> -                        1024: (minfo->p2m_size - i);
> +        unsigned int count = ((minfo->p2m_size - i) > 1024) ?
> +                             1024 : (minfo->p2m_size - i);

min().

Otherwise, Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

This whole infrastructure is almost abandoned, and broken.  Its used by
xen-mfndump (debugging only) and xen-hptool mem-offline.

The mem-offline functionally cannot possibly work usefully.  It is PV
only, despite not having an HVM check, and in particular reads the dead
page in an attempt to restore the contents elsewhere.  There is also no
thought given to writes from outside sources, such as DMA from
passthrough or a different dom0 foreign mapping.

This is perhaps ok as an academic demonstration of "can I shuffle memory
behind an alive VM in ideal circumstances", but will be killed by the
dom0 kernel if you ever try running it to resolve a real memory error on
a VM, because there is no possibility of recovering the data.

The mem-offline functionality needs deleting.  It isn't production
ready, and can't credibly be made so.

~Andrew




 


Rackspace

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