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

Re: [PATCH v4 3/3] domctl: Modify XEN_DOMCTL_getdomaininfo to fail if domid is not found


  • To: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 11 May 2023 12:41:13 +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=sYxnSEia4BAcz+5c5a5TbHBD4e9yV/qA5+E+R0E+xeg=; b=Msag0d6jcZSlNAQAZzU6ZCWkaL5nTIQEyFx4AKunGxj6/FNEBolaG1HgcfdzOr0zreESpmkwOJgepx38NirkW5MptXnPcdwbxvJtTJp7dom9b5sMMysKPwAt4zMd8wTlOl6YsIh4boHRDd8YV6mL2Q/i3N4tOrgLf3/fDhtMB4DZilQAg0CyeHFmJzj5ARmxeEh4Sd0EMJi48bJASnC/xurIAfSrhQUUSGtDuyD3/3dYvxraWEnb7Mz5OVB8PT13eg9qOYdL6VM/AeeXcuTNFatYDDbPGkyga3c1ISy+BhQy14BHhZ9/qq1bw7ucrww/ZIC4r9LQrPztjXZIIAnPSg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QE7MxBRNVnR+RXSbUWUiAz4kFNqqSFKZYqwpXA2jUjar8LzjkrqgYmBzrju2+6Vrk6c68TAxert/1q2tK6hTDuCazO+dv6R+dLcMtF+zePmRvqINzTVb/2lE+vhX9UrXZliGPJ0UwXK4snxOsBHsX3hHx/fq3lP4FuR0Q4e7Q32WP6fuwKdRrPC3G3mHxnE4Y2J19otEXQfHxz7OP0zqyJpHUK9nkcZuoGw0hWUy5N/CvMRoRULsHn25THTHCQtGZ8OnewI/j98PmWsVEg4hvV7krk7dBQub0/IooJ89BU3ob2hmWaUFSRghOMMO9kM14PwTNB/jQhaJYip0O2MAMQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 11 May 2023 10:41:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 09.05.2023 18:07, Alejandro Vallejo wrote:
> --- a/xen/common/domctl.c
> +++ b/xen/common/domctl.c
> @@ -314,7 +314,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) 
> u_domctl)
>          /* fall through */
>      default:
>          d = rcu_lock_domain_by_id(op->domain);
> -        if ( !d && op->cmd != XEN_DOMCTL_getdomaininfo )
> +        if ( !d )
>              return -ESRCH;
>      }
>  
> @@ -534,42 +534,14 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) 
> u_domctl)
>  
>      case XEN_DOMCTL_getdomaininfo:
>      {
> -        domid_t dom = DOMID_INVALID;
> -
> -        if ( !d )
> -        {
> -            ret = -EINVAL;
> -            if ( op->domain >= DOMID_FIRST_RESERVED )
> -                break;
> -
> -            rcu_read_lock(&domlist_read_lock);
> -
> -            dom = op->domain;
> -            for_each_domain ( d )
> -                if ( d->domain_id >= dom )
> -                    break;
> -        }
> -
> -        ret = -ESRCH;
> -        if ( d == NULL )
> -            goto getdomaininfo_out;
> -
>          ret = xsm_getdomaininfo(XSM_HOOK, d);
>          if ( ret )
> -            goto getdomaininfo_out;
> +            break;
>  
>          getdomaininfo(d, &op->u.getdomaininfo);
>  
>          op->domain = op->u.getdomaininfo.domain;
>          copyback = 1;
> -
> -    getdomaininfo_out:
> -        /* When d was non-NULL upon entry, no cleanup is needed. */
> -        if ( dom == DOMID_INVALID )
> -            break;
> -
> -        rcu_read_unlock(&domlist_read_lock);
> -        d = NULL;
>          break;
>      }
>  

I realize it's a little late that this occurs to me, but this being a binary
incompatible change it should imo have been accompanied by a bump of
XEN_DOMCTL_INTERFACE_VERSION (which we haven't bumped yet in this release
cycle).

Jan



 


Rackspace

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