[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>, Jan Beulich <jbeulich@xxxxxxxx>
  • From: Henry Wang <Henry.Wang@xxxxxxx>
  • Date: Fri, 9 Sep 2022 09:28:00 +0000
  • Accept-language: zh-CN, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=kgJSWlLo9EZdbb+rCibH02vHb+lE9i8BFvajnfVAn/Q=; b=cRk11qnxFoM5sV461PAXPFhHzJao4tZwYuoamizV1fPkdz3WLDvhdLoB1n/5z0yIHSiyI2jeRbUO644lQMpOOWwhLrJl5jSLjKMGUhhxYy0UEgOJa6Dmf/EhnUynU5AsgwPx/GLvlAjQ267525Wht2jraUHIIUyj68KO5iMOoh+TS5fRtNCbxxa+OmT+ufgvHBASZJZCdgR6Me6lzVxAm+MqYSs08Si/mPD4uUNanK50qG2yLjW6ThtJrAZRSxEGCHe68LONjgPcd9qBJg38KbeXB4rEA03hDi21EzeX35+JpsaLCiwnUULNy3fAe1wSTDDl7YjXLhj3NcTfFhGOAQ==
  • 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=kgJSWlLo9EZdbb+rCibH02vHb+lE9i8BFvajnfVAn/Q=; b=oD5um1sSyBnTpZKv08UXMxFpImjFRVAo/aSWU9xGSiROnmN3dEb2fH3WD0361EcfHTI/E85+RMfpt+jkMEUmR2iWFGO7tHmOU2b429RkG0tqWIJoCYj05U15BdfZvVMZ0og84ckT3yqJbl3q3oQxkt6EOyqZ79uJCm6HZmMKO8V6DBGioxuzNxE5Ngyuqy1c/iaJee7dudreU/r0js9oXDT0PNxJkKvYxFoHu4pTkLhJlLoePw0EiAIcFVnE1Q56xFlCYHh1jjhqD9R9tzVi+ZF7tQr4v/MYRrmVxTcOR9528V8L1jiO6Grlr/YY8Nnb6iN1AbcvzRPdn/OB1W1xew==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=CVfytnJrAEioKb5EnuSIeY2NnLZZErXf7cqMlEFGXVDTzp8hAIja/JOvt2vTgbTGV+jWp6Ousc7pZoviu42427oConD6vQOnTd72tKOpE60JnnFIuLceXi2zz6fkZSY6MVeKgHTWnxI8L464egECTz1UhVJwN39f2NmELMg5kJMQokI3U6vIL0CxveXCqj6qDFv0XgPC7XGqmZCgxDtaFk0C96Oz1v1rSUl3QtKwrZMR0SKch+4Tp0Ll3b8EETBVdZgmvVhcGeV1MRzWEO+gIV0pLnZ+IflHx10ZWzQ4NdQANV1Msm9VAKnXl/DWVQG5OoTMPopHsGGZyxMfnKd8RA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ba46xi9opBDiaHLG1aDN6Q7TbudErrucuIHmFRDq7n4G16sOsDcKeZywVZJZxHX+NywCleK8TTc2QLe/fHe9IP9tUu+ArhRZL91/EPE6Eau+yPztplXUFzOBsHqCS8mNboiTaST9XNyNOonqB/qVSmYaSLDPBDySQdljj8t4y6QNegOcPSMQKxqzLumK8f1oxGempXIl6wEaMrpsmq4198pFpUbmoflvOaKWln143isI62F7ljXyq+wPb7BblfL/EIvtjTYQ2onIoGJ7ZPNVy4UHIjhPY52nTCbzcXHegn7Xynd32neEl6J6ga12mzpSuYK5aUIyo4vhR4hAwaTUdA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: 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" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 09 Sep 2022 09:28:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYxCOLeMow4nnAdEmRQz42iuSBI63W0QoAgAADAYCAAABeMA==
  • Thread-topic: [PATCH] xen/gnttab: fix gnttab_acquire_resource()


Kind regards,
Henry



> -----Original Message-----
> From: Juergen Gross <jgross@xxxxxxxx>
> Sent: Friday, September 9, 2022 5:26 PM
> To: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Henry Wang <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
> Subject: Re: [PATCH] xen/gnttab: fix gnttab_acquire_resource()
> 
> On 09.09.22 11:15, Jan Beulich wrote:
> > 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.
> 
> Okay.
> 
> >
> >> @@ -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"?
> 
> I can do that, if you like that better.
> 
> 
> Juergen

 


Rackspace

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