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 1A65AA00C5; Wed, 2 Feb 2022 11:00:45 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B976440DF4; Wed, 2 Feb 2022 11:00:43 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 7A95540688 for ; Wed, 2 Feb 2022 11:00:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643796042; x=1675332042; h=message-id:date:subject:to:cc:references:from: in-reply-to:mime-version; bh=GR2FBaCPLFBQCSrn9kN4qroAOLOnIgskz4cFZSTuJOk=; b=AXk3Ufj+xOjjqceHVieXaZpZPt6dSDILChoruuTsXGfjMIiCtOLNEtLi 6c2M29xp7ALvWhz9Q/+hqap7H9xkSp40gsvsWf/CZIb5k1OkTBiq1TbMY knNHM//u3zSHG3JUfUDezgkM3b+OPHuvT9uBo+A5qUV6PHC7YSYJkFC0A 4NO9bGLoi2nIgqFRIAjxDl3AqnBrdc+OKStVCQ3Ls6svpIAk0q0OxsfA7 3E0qmfpK8Z4MnNMQxYccOhy2iHmVvxoqP7IFeO9u4FOG8Z2qWmMeXvta7 ApQHEissBL8lgqtKOgVOwwLVLO+j2JoPpXVpIdf7PAcJXOXgPrvqZdOIx A==; X-IronPort-AV: E=McAfee;i="6200,9189,10245"; a="308613553" X-IronPort-AV: E=Sophos;i="5.88,336,1635231600"; d="scan'208,217";a="308613553" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 02:00:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,336,1635231600"; d="scan'208,217";a="599490689" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga004.fm.intel.com with ESMTP; 02 Feb 2022 02:00:41 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 2 Feb 2022 02:00:40 -0800 Received: from orsmsx605.amr.corp.intel.com (10.22.229.18) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 2 Feb 2022 02:00:40 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Wed, 2 Feb 2022 02:00:40 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.106) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Wed, 2 Feb 2022 02:00:40 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eNXcEGEznYHBGyUNZiOii9UYvyJVCKFgXcPNAkuC05LGNi3RmWpEggJhSsA0/0+gyPz+vq+AJSh8m9HZVxgWg8F8Ew4jlf+hDXazT6aQYjPfypPvxjcPth6jqnxMisWbaGLSrj7qIMpbI+94hqarAmXnIPfRRAAs+rylQj6wYC/JRaysSoj7NUzbZAHYI94Pn6Ql5dGo9L9+PQ2alCEbmEGqCfnmZZ4euXN71UPZ9lOQwVFqVABCYJMudAx3XkH+MLSTwA3G9XdSTm5YloPz3o4+n9N3JlDSlu+jFjnTF4a1O1/xMzuAZRqX/Uxojns6xQ09+bjD9PyJmgvIq5M4DA== 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=UIs6H2cUhNkP0vxDjQ77iIJaOt5CFgIfA118rXo2J5M=; b=ZmdKJxQncpQIJzk5xiVaHgxknMRD+ooDYMFYIEeoW+KpCc/u8Kc0SoEd9SSFE0p9OBamzTDnXhLAXOp5RJZPCibo5RZl0sYpLe8vuXeaysp05u3LJpjV1S3xpvxE4K7dfTMj0khGIhfDBYtc2pUFsm6uZiV7X/CDZGZr2z0X6hIRgBCFe9Gn6dKhDHuHfj+NWG68gD6Y8Kouc+G6xtI464EDT9vlPA4OBvrzfT88Di4LMvRxN5PC7tPTaHRdNS/yApdRTvacyRB9HpZj1fYaSB03QBRUl10HLpVjD/decXZwRcSytHgyfQ/VzgP5LBatHRPNFYRvHygpI4ovevu88w== 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 MWHPR11MB0062.namprd11.prod.outlook.com (2603:10b6:301:67::34) by BL0PR11MB3458.namprd11.prod.outlook.com (2603:10b6:208:6a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.20; Wed, 2 Feb 2022 10:00:36 +0000 Received: from MWHPR11MB0062.namprd11.prod.outlook.com ([fe80::417b:7df4:d3fb:2b0a]) by MWHPR11MB0062.namprd11.prod.outlook.com ([fe80::417b:7df4:d3fb:2b0a%3]) with mapi id 15.20.4930.020; Wed, 2 Feb 2022 10:00:36 +0000 Content-Type: multipart/alternative; boundary="------------2CCQo3g3bEAcRj7Stu3ovUQF" Message-ID: <261cd7e4-a166-bf48-98e0-8bf6e257a7b4@intel.com> Date: Wed, 2 Feb 2022 15:30:25 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH 2/2] app/testpmd: fix stack overflow for EEPROM display Content-Language: en-US To: Steve Yang , CC: , , , Ferruh Yigit References: <20220120025931.574106-1-stevex.yang@intel.com> <20220120025931.574106-3-stevex.yang@intel.com> From: "Singh, Aman Deep" In-Reply-To: <20220120025931.574106-3-stevex.yang@intel.com> X-ClientProxiedBy: PN0PR01CA0001.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:4f::6) To MWHPR11MB0062.namprd11.prod.outlook.com (2603:10b6:301:67::34) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: af0d1f4b-ea9b-4bcc-70a5-08d9e632db92 X-MS-TrafficTypeDiagnostic: BL0PR11MB3458:EE_ X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:451; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UVTtVCvQHvrj29Fz8xyBjPFaHBnsF0CKrBSq7F8jJcQW9POsOfuV6TOyTknrxOdrFT/jdrE0wEKTM32rhbHsfx8c7j6fI3G6R7pKsw4X4ojE5bPCM1hNENDUCU9FLV7UVPp32vy1r/4P4zq7U66W+g/vF0lL1cXMqQX7nuRcUgLTRUZCituvnqBm5Rel1rUrDUccu0Wf25obPBH3GEm9q4TBRktc9pWR7PSZU6zqTzQKWOsUHusVTn86LV9txFhJ4RVqgF8bkuyKFnSGY2PTWYCB0sTBXgw/PrOk9k4CvhSFT8tptPHHX/lsDYc6H2buDToyozvvFMZPV7Er28bGEsN5UlMM1DTFKLeVLq2UIgk1dDmVv6c6oPcWhbtno5UncSQGwCJmT2RlcM7K7B7UDyZkDlT0Hh2cLT4tIVx5cE/63xo57/mUnq/TMaZNkxn8VL3M2tuHSsrvLKKnLKD3Hk9/Tkwg6q2fPvFwSsG7EwdLUXbByFjD9c/GPmbQQc/qm2IBTShGh/jrB/1CTxtftw6PsGwSeXyDNedNlCNoC0FC9m2vbLLlVXYds0stdbDa5TqM+eULYyRkBvPB+275Yjxho/flDbPfFcNV6yBeDZReHH3ANkQrRnYH2qTE011wPnJRnoYDtvN8ue7zxGQbuY/KkuEBnCVWptadKgaXBlY8IrwfFIlxG8AX2q8tuJMg96HHDu39c0bFabkoVZaxQeDR7P8fiHS2uPLLc7kDjkU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB0062.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(316002)(31686004)(38100700002)(31696002)(66556008)(508600001)(66476007)(66946007)(6486002)(4326008)(8936002)(8676002)(86362001)(82960400001)(33964004)(6506007)(83380400001)(6512007)(6666004)(36756003)(107886003)(53546011)(2906002)(5660300002)(26005)(186003)(2616005)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Y1VTZkc3eVNiSlFoNlVPcXA1RWhEd2NscEE4SlR6RHhiRGFWS3dEUEsvVWRY?= =?utf-8?B?RmRsT2ZNYkFhczlJaC8xT3c3L3ZLZnpNS1U5a0ZGaitncmUzQ25paStWRjVt?= =?utf-8?B?WVRyV0NBNm9peUZudWtRTmxSaFBZcHZPT1hpSHhpU0U4bnFiNnFSbG92NmtP?= =?utf-8?B?blh3UFZaQitUb3hrM1JTQ1E3c2V2TGlDV2lCTERHMjhBWXA5eWZySEhtSkkw?= =?utf-8?B?NGpwaERMZmNFRUk1Lz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FB?= =?utf-8?B?SWE1UitVOUU1aVEzZ3FSMTVoRU9kcjFId203cldiRllCVVNVamlRczJMakU0?= =?utf-8?B?YzFDMG5sUUZqVElMc0lIbmVna0ZOaWg4SVBabnNtUjhHeUFVQ0hhV0crTXdV?= =?utf-8?B?Ukt4Nlo3THpWOWVOMGtBelBGSkkvTFl6ak1IYzdZditlY29pbWZiVFhacGxv?= =?utf-8?Q?mUYYhT9ADENediAhl0n944L5Bscz+wcUqIQLp9gATc=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: af0d1f4b-ea9b-4bcc-70a5-08d9e632db92 X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB0062.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2022 10:00:35.9633 (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: 4irLIxZNaI+lccwwuxq/MYKrg0c9u0KcYJgUFW4gJd0FiM62Kc8AET/W5Ygj/Bo8htpyAMu9C2QVu/VY1czuT8/L7aVa1lEFQJmkfSMeqME= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR11MB3458 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 --------------2CCQo3g3bEAcRj7Stu3ovUQF Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit Hi Steve The patch looks ok to me. On 1/20/2022 8:29 AM, Steve Yang wrote: > When the size of EEPROM exceeds the default thread stack size(8MB), > e.g.: 10Mb size, it will be cashed with stack overflow. Just spelling: 10Mb/10MB, cashed/crashed Can even rephrase, like: it will crash due to stack overflow > Allocate the data of EPPROM information on the heap. > > Fixes: 6b67721dee2a ("app/testpmd: add EEPROM command") > > Signed-off-by: Steve Yang Acked-by: Aman Singh > --- > app/test-pmd/config.c | 22 ++++++++++++++++++---- > 1 file changed, 18 insertions(+), 4 deletions(-) > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index 1722d6c8f8..e812f57151 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -912,10 +912,15 @@ port_eeprom_display(portid_t port_id) > return; > } > > - char buf[len_eeprom]; > einfo.offset = 0; > einfo.length = len_eeprom; > - einfo.data = buf; > + einfo.data = calloc(1, len_eeprom); > + if (!einfo.data) { > + fprintf(stderr, > + "Allocation of port %u eeprom data failed\n", > + port_id); > + return; > + } > > ret = rte_eth_dev_get_eeprom(port_id, &einfo); > if (ret != 0) { > @@ -933,10 +938,12 @@ port_eeprom_display(portid_t port_id) > fprintf(stderr, "Unable to get EEPROM: %d\n", ret); > break; > } > + free(einfo.data); > return; > } > rte_hexdump(stdout, "hexdump", einfo.data, einfo.length); > printf("Finish -- Port: %d EEPROM length: %d bytes\n", port_id, len_eeprom); + free(einfo.data); } void @@ -972,10 +979,15 > @@ port_module_eeprom_display(portid_t port_id) return; } - char > buf[minfo.eeprom_len]; einfo.offset = 0; einfo.length = > minfo.eeprom_len; - einfo.data = buf; + einfo.data = calloc(1, > minfo.eeprom_len); + if (!einfo.data) { + fprintf(stderr, + "Allocation of port %u eeprom data failed\n", > + port_id); > + return; > + } > > ret = rte_eth_dev_get_module_eeprom(port_id, &einfo); > if (ret != 0) { > @@ -994,11 +1006,13 @@ port_module_eeprom_display(portid_t port_id) > ret); > break; > } > + free(einfo.data); > return; > } > > rte_hexdump(stdout, "hexdump", einfo.data, einfo.length); > printf("Finish -- Port: %d MODULE EEPROM length: %d bytes\n", port_id, einfo.length); > + free(einfo.data); > } > > int --------------2CCQo3g3bEAcRj7Stu3ovUQF Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: 7bit

Hi Steve
The patch looks ok to me.

On 1/20/2022 8:29 AM, Steve Yang wrote:
When the size of EEPROM exceeds the default thread stack size(8MB),
e.g.: 10Mb size, it will be cashed with stack overflow.
Just spelling: 10Mb/10MB, cashed/crashed
Can even rephrase, like: it will crash due to stack overflow

Allocate the data of EPPROM information on the heap.

Fixes: 6b67721dee2a ("app/testpmd: add EEPROM command")

Signed-off-by: Steve Yang <stevex.yang@intel.com>

Acked-by: Aman Singh <aman.deep.singh@intel.com>
---
 app/test-pmd/config.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 1722d6c8f8..e812f57151 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -912,10 +912,15 @@ port_eeprom_display(portid_t port_id)
 		return;
 	}
 
-	char buf[len_eeprom];
 	einfo.offset = 0;
 	einfo.length = len_eeprom;
-	einfo.data = buf;
+	einfo.data = calloc(1, len_eeprom);
+	if (!einfo.data) {
+		fprintf(stderr,
+			"Allocation of port %u eeprom data failed\n",
+			port_id);
+		return;
+	}
 
 	ret = rte_eth_dev_get_eeprom(port_id, &einfo);
 	if (ret != 0) {
@@ -933,10 +938,12 @@ port_eeprom_display(portid_t port_id)
 			fprintf(stderr, "Unable to get EEPROM: %d\n", ret);
 			break;
 		}
+		free(einfo.data);
 		return;
 	}
 	rte_hexdump(stdout, "hexdump", einfo.data, einfo.length);
 	printf("Finish -- Port: %d EEPROM length: %d bytes\n", port_id, len_eeprom);
+	free(einfo.data);
 }
 
 void
@@ -972,10 +979,15 @@ port_module_eeprom_display(portid_t port_id)
 		return;
 	}
 
-	char buf[minfo.eeprom_len];
 	einfo.offset = 0;
 	einfo.length = minfo.eeprom_len;
-	einfo.data = buf;
+	einfo.data = calloc(1, minfo.eeprom_len);
+	if (!einfo.data) {
+		fprintf(stderr,
+			"Allocation of port %u eeprom data failed\n",
+			port_id);
+		return;
+	}
 
 	ret = rte_eth_dev_get_module_eeprom(port_id, &einfo);
 	if (ret != 0) {
@@ -994,11 +1006,13 @@ port_module_eeprom_display(portid_t port_id)
 				ret);
 			break;
 		}
+		free(einfo.data);
 		return;
 	}
 
 	rte_hexdump(stdout, "hexdump", einfo.data, einfo.length);
 	printf("Finish -- Port: %d MODULE EEPROM length: %d bytes\n", port_id, einfo.length);
+	free(einfo.data);
 }
 
 int
--------------2CCQo3g3bEAcRj7Stu3ovUQF--