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

Re: [PATCH for-4.17?] x86/paging: return -EINVAL for paging domctls for dying domains


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 8 Nov 2022 17:14:40 +0100
  • 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=kALdrl24ZbbLJDvnjcTuyysnkpdzbU7BO/GCV74y25o=; b=ZBY8anCl8tGBt5FITB+/9LeyS+vptUgiXbPoH5NI1ZAUeLbx5uiG8i5smDa74+UKM2otg3sKQJaOvViu77WT7FastYfSJ1uWSpM0JMWWYpO51NKW8F8sTRzL7kqNbcgH/ZnfgJZkE3VzW73iFsHus63+j3kPro4/Y6Jg0vDysSB3jgu0M+aIPtPtVkL3XI6vbANaBkCPCv0UUDnV9gtDb9E3bq0KgI+nDprBYuj+J2ovQC4GdhXUhWoWn3AFRy2FCjXi0U7gVTEJdLwSnmmoX+ITRM+pXHQ2TwO06hklOfpAZjwpYnnVIEVcdNUoFykmnpr8bUTtNncwwlTrzYs/aw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E7Qk+FLWdixCM5dhOOTsqBPuaLtB6LubCsWMVFWVZ7k4jfTZDA9kA0wMDniCiQNAfD/xFIAJnXTyvegW9ft8mL2NZ6W4zJPJENHIGGQToADH3157HoCX1jBlX1dzQy6c3JbuArRD+O39oW6bRSPEQkUDVKXBv4ELjUs81sJR2gl7cH5RmHUWTZ9WXfW7jaaXfaLR0GCeuCkQh3q28ujNLBjqoxZS3ArEmuDg5FDCPjCNKuoYWr5ksJDd4CkWQlqQou5ofx0aKCpc25FjswHqPpSsDGeurWkMQry35WYj1pWBiD2M1iSw0WH160nsodZKhS+m/Eu4+V4Szl6u3R6tmg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Henry.Wang@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Edwin Török <edvin.torok@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 08 Nov 2022 16:14:54 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 08.11.2022 12:38, Roger Pau Monne wrote:
> Like on the Arm side, return -EINVAL when attempting to do a p2m
> operation on dying domains.
> 
> The current logic returns 0 and leaves the domctl parameter
> uninitialized for any parameter fetching operations (like the
> GET_ALLOCATION operation), which is not helpful from a toolstack point
> of view, because there's no indication that the data hasn't been
> fetched.

While I can see how the present behavior is problematic when it comes
to consuming supposedly returned data, ...

> --- a/xen/arch/x86/mm/paging.c
> +++ b/xen/arch/x86/mm/paging.c
> @@ -694,9 +694,10 @@ int paging_domctl(struct domain *d, struct 
> xen_domctl_shadow_op *sc,
>  
>      if ( unlikely(d->is_dying) )
>      {
> -        gdprintk(XENLOG_INFO, "Ignoring paging op on dying domain %u\n",
> +        gdprintk(XENLOG_INFO,
> +                 "Tried to do a paging domctl op on dying domain %u\n",
>                   d->domain_id);
> -        return 0;
> +        return -EINVAL;
>      }

... going from "success" to "failure" here has a meaningful risk of
regressing callers. It is my understanding that it was deliberate to
mimic success in this case (without meaning to assign "good" or "bad"
to that decision). Can you instead fill the data to be returned in
some simple enough way? I assume a mere memset() isn't going to be
good enough, though (albeit public/domctl.h doesn't explicitly name
any input-only fields, so it may not be necessary to preserve
anything). Maybe zeroing ->mb and ->stats would do?

As a minor remark: _If_ you're changing the printk(), then please
also switch to using %pd.

Jan



 


Rackspace

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