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

Re: [PATCH] xen/gnttab: fix gnttab_acquire_resource()


  • To: Juergen Gross <jgross@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 9 Sep 2022 11:15:10 +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=6mawu4IQVyG0TwWaH5hY3MU3pQjCiPLg99tVXVJ98VI=; b=jqtoE8M0oWzLyqVU3pFjnqW7AhEYKOIc21CF4UdjS6uSSyvmV2JlKm9QPILoqMIWuLSuD5njQ1sOXbpinYB7TpA4gZV3W3jo78Kgmyie8v7ENA53AItsKFvJYO59fS3df+YLujMfOnL1RUVJXSt8LIkPwno7ZaIIL4Zc5H/m81leKCN1mMcUgTHkOdfh1a9jpTUpg/exgjGEMNpMknMiBNR5n5k7+wxgOESIz/m3ASdhHF6tqAIX7Q87ivXwY95jieam3bdCS87qxSW2TN0R/GPfhMmp7owf6aiLvbqiHk7Ma/fkaffYS/7Tn0a8OkRSekNf1cj/zBy1X0uaJwCRxA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GfOeb+rCDuOxAU76nqzl9PtiYkJsIQz3ia16+n0OyGtcppP7xSBeF2meU86F9BKYJmK7nOnEB+fJAnT2PWlMYOAK7p59571pTMxg1yjvPZkvT9nQTBFDd/Elux3XP3a2GRb6FDJ+o+Ppkrd7U9ExcFIc7TqltUe17VdzwcTI2zptia/tOK6AsmG8hKAHAI+cX4BdWb0iLsmBTtje5uOTp6n5ldneome3Pq31DMU5Hgj5/BB84/M7r0o8wuQiZ9onnBTWQd+qnzh6+Gcxm/udOPmZLYUcV+0v4u6vtnFFF+ZC6gA8yfZv9H69sWeWvPVb6XbDWeVfz3xfZMVgXIJQKA==
  • 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>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 09 Sep 2022 09:15:21 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 09.09.2022 10:09, Juergen Gross wrote:
> Commit 9dc46386d89d ("gnttab: work around "may be used uninitialized"
> warning") was wrong, as vaddr can legitimately be NULL in case
> XENMEM_resource_grant_table_id_status was specified for a grant table
> v1. This would result in crashes in debug builds due to
> ASSERT_UNREACHABLE() triggering.
> 
> Basically revert said commit, but keep returning -ENODATA in that case.
> 
> Fixes: 9dc46386d89d ("gnttab: work around "may be used uninitialized" 
> warning")
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
> ---
> Might be considered for 4.17 and for backporting
> ---
>  xen/common/grant_table.c | 14 +++-----------
>  1 file changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
> index ad773a6996..68e7f1df38 100644
> --- a/xen/common/grant_table.c
> +++ b/xen/common/grant_table.c
> @@ -4125,7 +4125,10 @@ int gnttab_acquire_resource(
>  
>      case XENMEM_resource_grant_table_id_status:
>          if ( gt->gt_version != 2 )
> +        {
> +            rc = -ENODATA;
>              break;
> +        }

This path is supposed to produce -EINVAL.

> @@ -4135,17 +4138,6 @@ int gnttab_acquire_resource(
>          break;
>      }
>  
> -    /*
> -     * Some older toolchains can't spot that vaddrs won't remain 
> uninitialized
> -     * on non-error paths, and hence it needs setting to NULL at the top of 
> the
> -     * function.  Leave some runtime safety.
> -     */
> -    if ( !vaddrs )

I guess this wants amending by "&& !rc"?

Jan



 


Rackspace

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