From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 10CACA00BE; Fri, 11 Feb 2022 10:58:39 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D110D41144; Fri, 11 Feb 2022 10:58:38 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id F255340150 for ; Fri, 11 Feb 2022 10:58:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644573518; x=1676109518; h=message-id:date:to:cc:references:from:subject: in-reply-to:content-transfer-encoding:mime-version; bh=l2iqWeHPZe5D2MZ+/kuAEX+uOTGiY08unuKMuVldcXk=; b=Edfa0zqFlIkd36WnoheCE/H0Whq8q4usIDDxj1DEehNRHjSGHDBp6/B/ OUslJnCGUj8QtPTcSGk954Qi/lY8gEsZIMXlwwGtsIlJpEoaCQe0TOwtu HJOKxcImUL+g3NJTKhj46XvWrrhd/Mnegm++9zTIiqPaQygoW/bB6jNVN hV/tMELRiDMfzFBaAOlC09bMXRBIv/ZOIO5XfMEJxXPNG1a6m/xaJ56ue 6UvLbRG86mxjeAhov5yf5rlxMTCgOmhpG0+DSNMmBHZuRGmjBa9zM2JwU ILafbRgwVRqXCs7YFE6Z9YCRySehlMVXEEOPkGKJ9x0pOAWwPBxPQoQhN g==; X-IronPort-AV: E=McAfee;i="6200,9189,10254"; a="233258504" X-IronPort-AV: E=Sophos;i="5.88,360,1635231600"; d="scan'208";a="233258504" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2022 01:58:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,360,1635231600"; d="scan'208";a="774200394" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga005.fm.intel.com with ESMTP; 11 Feb 2022 01:58:36 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Fri, 11 Feb 2022 01:58:36 -0800 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Fri, 11 Feb 2022 01:58:35 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Fri, 11 Feb 2022 01:58:35 -0800 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.106) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Fri, 11 Feb 2022 01:58:35 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NVVCyyE4facIp3w48dfpghcZYlHkkgVUh42gG/hHDwbuLLXZ3oiCVx2JMZgkbSxJpdZQ2VpfWBjXen2mwgmnZQjBNyiq8X/v3Ksk8EyshghEWzyrqXqcOOSt1Jn+soVHRkVZ4SwHpX4Nra00dGPs2/PuVvfjLGb95SaIXQ5iyy10h/HT6dtmM07JHayZ7I2DFUbozNnXqqKXphhxNfQrlyKa9Zu2SWSQXsA59PiJM18Ft9OJXp+zGkcegKm1kVF4TwUyqzQ7VU1R5dfOUj6ySplMWksPe9gA9Eh9H2BLBtJBOBIsHKcY+hjqfE2QLX+gm4hqKKCcgvkzp6eVhGaRxQ== 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=Pa7FWwDAx778HP6Ncwv2Bxcl7H0A0dGxPfoik+Ar0jc=; b=KLMU9IWTnfLCm7LQCoKA8QDqH1vSzM8ODP4hderOFwXv6MjoQyPGdiDyqb2ahY8yHbJoHoxLG3Mdd4P14psX8PpAB/Y1f0xeIPUSjkqTesLjtx14FkwoUcS9N6tsM6w/tRPPnU0GAdkAvdGHnqubJ/4RHBnkXGB6OLfi8i8bDKRJXTLhKFiw55cFiK8dd4/h1O8Q2i0/9SrG6Av9ZsAFhgMIVrqciOtflpqVy1/gezSReQhdKa0yZTsCDbUdbCm9f4BU6rpa7Qssd9mZz6ktQs0T7GyHZKJtAbg/HfBbweEJWCmg8py8VRtIpb2lhjqA7xDHyPknQVVAuWm3mVMZfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by BN7PR11MB2578.namprd11.prod.outlook.com (2603:10b6:406:b2::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Fri, 11 Feb 2022 09:58:33 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::98be:5506:5020:28a2]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::98be:5506:5020:28a2%4]) with mapi id 15.20.4975.011; Fri, 11 Feb 2022 09:58:33 +0000 Message-ID: Date: Fri, 11 Feb 2022 09:58:27 +0000 Content-Language: en-US To: Madhuker Mythri , =?UTF-8?Q?Ga=c3=abtan_Rivet?= CC: "dev@dpdk.org" References: <20220210071052.527-1-madhuker.mythri@oracle.com> <0a3f6aa6-2499-ce40-6dd0-721f70017003@intel.com> <9dc29099-0c73-4070-b017-69de6fc0e687@www.fastmail.com> From: Ferruh Yigit Subject: Re: [External] : Re: [PATCH] net/failsafe: Fix crash due to global devargs syntax parsing from secondary process X-User: ferruhy In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO2P265CA0123.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9f::15) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6ec26b08-c399-4ea4-6e38-08d9ed45107c X-MS-TrafficTypeDiagnostic: BN7PR11MB2578:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fSmTloAl3lugmNygXbC4LKVCmPw3t+OugCzeW1VzzFn3W+es5QyqoEaPItdPle1riOckkXrS3GAN+sGeEthmEnKSb3e2UjV3aXPosM4DbhESpLrXeuL8cT7+ZXvTH213XfkYjirHaLcw3SK2OqwglOBu7cV0CM4cROYJgRtQZwtPE6EQ5LboA5byt8OLMgYoOc1n74ecIUoB9fCfJVBUH8ZSlv3El/ZTirxPx4QwaFIkV0ubEJeT9vp6yh07XL5FmUCYe3cipQtbPtNO34OtrPOo9JRCHzOj5jH5UEDE+8N9SwvIYG69FNrdgDQnifzy5XguvsN67c6oZ8uU/YNHGa3j7lMI5as25rTeXZ24ZVoZq/mAGg0TZn/NHxkW4BXpKmrOblY0Cu7k9spVjHITPqNWOmL6kz4WmYCkj4XT9p6k2uP0xfEtjsloyQfych6qRkv8f86YojYO8c3DX+bmOcgEGUugyzSxyQxkGl8UvzNu83oHBW2C5MjXyMsqws0THIP7fVutF9jGXWKX0sLuwQZEfcDai9PdiIVyUAiSq3PSMoYv9GFHzMtuE13RFiDhMS0EfJsVQB8Vu3++1SnkEejdMtuThuPGDjZu9RnxQf8Gm0E6Afw7q+UKeq9sYfLKgBproBBXXeOQXdvH2WJ0w1ffSZYgTGIksBkWEG8ZuY4gaHDHPw3IIiuOK8Hnn9tyd36eOV/9uabuSD6UXORclKaBi1Ua9JnG5L3nw9Kem82YAxCdTtSeSIdWlH3yO5OY5CkBeW3dLOK+9bDrNhJfwVacutq7iQYGDCLQ5Ig6/yI= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5000.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(8936002)(5660300002)(186003)(82960400001)(2906002)(38100700002)(31696002)(44832011)(2616005)(26005)(6506007)(6666004)(508600001)(6486002)(966005)(6512007)(53546011)(55236004)(66946007)(66476007)(8676002)(4326008)(66556008)(110136005)(83380400001)(31686004)(316002)(66574015)(36756003)(86362001)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?R1hRQVRtUHJkUXAwcUZXdDJONUV2VjNZUXFjS1JNQUJhMndIbzBwRG9Zc3o5?= =?utf-8?B?ZzZxRlMvWkZvN0NYZjk2NGlJT2hOcE50K2ZaWFovQ0xzWkxqNGIwV1ZPT0k2?= =?utf-8?B?T3d0VW84ei91eVQzUHE2ekdUd1labTh4QnBSOTdjWVpXdWNLWFE4SEs5MHFE?= =?utf-8?B?SUdVbXFNR1NHMlpVTU45WTBaK2o5ZzlZTGcySHdiMXU2UFE5Vzl3aTI4bHN5?= =?utf-8?B?d1cyZVh4Q2pCT3h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4R1JpYzJJ?= =?utf-8?B?VkdVZXFabTBTVGEzWlNtRTdwYjAwbjNXSERNQXpueDU3RytKY2tMWHg5VDJS?= =?utf-8?B?Tlh6OXFLbWZKRDdla0g2U2YyQ0J3V0xSMzZDMEMza25leGxjdGp0RC9acnhC?= =?utf-8?Q?EQyV5KrGyZLR9W0JReZoE+A=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 6ec26b08-c399-4ea4-6e38-08d9ed45107c X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2022 09:58:33.7564 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5eyY9qP6ff1o3CVL6/eoe3h049MjLLnxGXvIcy03rmncPmRiz0gqYOEqOQposcNGXHFlzHnl6XriSy5HDcXK8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR11MB2578 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 2/11/2022 9:37 AM, Madhuker Mythri wrote: > Hi Gaetan and Ferruh, > >> >> -----Original Message----- >> From: Gaëtan Rivet >> Sent: 10 फरवरी 2022 21:39 >> To: Ferruh Yigit ; Madhuker Mythri >> Cc: dev@dpdk.org >> Subject: [External] : Re: >> >> On Thu, Feb 10, 2022, at 16:00, Ferruh Yigit wrote: >>> On 2/10/2022 7:10 AM, madhuker.mythri@oracle.com wrote: >>>> From: Madhuker Mythri >>>> >>>> Failsafe pmd started crashing with global devargs syntax as devargs >>>> is not memset to zero. Access it to in rte_devargs_parse resulted in >>>> a crash when called from secondary process. >>>> >>>> Bugzilla Id: 933 >>>> >>>> Signed-off-by: Madhuker Mythri >>>> --- >>>> drivers/net/failsafe/failsafe.c | 1 + >>>> 1 file changed, 1 insertion(+) >>>> >>>> diff --git a/drivers/net/failsafe/failsafe.c >>>> b/drivers/net/failsafe/failsafe.c index 3c754a5f66..aa93cc6000 100644 >>>> --- a/drivers/net/failsafe/failsafe.c >>>> +++ b/drivers/net/failsafe/failsafe.c >>>> @@ -360,6 +360,7 @@ rte_pmd_failsafe_probe(struct rte_vdev_device *vdev) >>>> if (sdev->devargs.name[0] == '\0') >>>> continue; >>>> >>>> + memset(&devargs, 0, sizeof(devargs)); >>>> /* rebuild devargs to be able to get the bus name. */ >>>> ret = rte_devargs_parse(&devargs, >>>> sdev->devargs.name); >>> >>> if 'rte_devargs_parse()' requires 'devargs' parameter to be memset, >>> what do you think memset it in the API? >>> This prevents forgotten cases like this. >> >> Hi, >> >> I was looking at it this morning. >> Before the last release, rte_devargs_parse() was only supporting legacy syntax. >> It never read from the devargs structure, only wrote to it. So it was safe to use with a non-memset devargs. >> >> The rte_devargs_layer_parse() however is more complex. To allow rte_dev_iterator_init() to call it without doing memory allocation, it reads parts of the devargs to make decisions. >> >> Doing a first call to rte_devargs_layer_parse() as part of rte_devargs_parse() thus modified the contract it had with the users, that it would never read from devargs. >> >> It is not possible to completely avoid reading from devargs in rte_devargs_layer_parse(). >> It is necessary for RTE_DEV_FOREACH() to be safe to interrupt without having to do iterator cleanup. >> >> This is my current understanding. In that context, yes I think it is preferrable to do memset() within rte_devargs_parse(). It will restore the previous part of the API saying that calling it with non-memset >devargs was safe to do. >> >> Thanks, >> -- >> Gaetan Rivet > > Thanks for your comments. > The rte_devargs_parse() is used in other 'netvsc' PMD also in netvsc_hotadd_callback(). > In this netvsc_hotadd_callback(), it was assigning the devargs with some other instance pointer(not sure, whether its just a pointer or with data values) before calling this rte_devargs_parse(), so if we memset inside this API, then the devargs data values will be nullified right. > I'm not fully familiar with this parsing functionality. So, please let me know, doing memset() inside this rte_devargs_parse() is valid or not, as this is a generic function for all the PMD's. > Hi Madhuker, Gaetan already sent a patch for it: https://patches.dpdk.org/project/dpdk/patch/20220210170131.2199922-1-grive@u256.net/