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 A7C66A00C2; Tue, 8 Mar 2022 14:47:52 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 337CD4068E; Tue, 8 Mar 2022 14:47:52 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 48BA54068B; Tue, 8 Mar 2022 14:47:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646747270; x=1678283270; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=brfRJC22qQVz0+zv5NrvrSmkro+OT9U5KK9xlkkVxfM=; b=L4yuumE30dUfoqZxxv7/zQF8K6ht5UD7OtAEqvBdxfJmYIh5pkAQ7oFO 0SHa/WlpnCT54g2rYKXckxbkO6Z4OGGbKAVUSHAbEL1bCj+kQyvtHNYI6 McO463dQbxY4SJz/pmEzDMHT9+Dly6PdIUEfMyjoFaxZPUtchaustX3/j aJEVaZuA+XheNgSLFq74p31/U4l7evNPB1Fw8A7f+8k8TO22hLRPfJcKg hZnKUwkCKdl1I87T5x985aWkxs3AkNYuygCi5+oF2XfI3v+S72tOdMFJD SSt9OHQFbz8aoJOx6geCH1XWvJZVqTvPaqZt8DN+pgHxBp4jrFUhg//+r Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="315399160" X-IronPort-AV: E=Sophos;i="5.90,165,1643702400"; d="scan'208";a="315399160" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2022 05:47:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,165,1643702400"; d="scan'208";a="641748535" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga002.fm.intel.com with ESMTP; 08 Mar 2022 05:47:48 -0800 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 8 Mar 2022 05:47:48 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21 via Frontend Transport; Tue, 8 Mar 2022 05:47:48 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.100) 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.21; Tue, 8 Mar 2022 05:47:47 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bs3fzxdw/NQxg/1wwYvuQqM+JWKMsVaQ9fkINyHXqs1FCuFX4PX/ZowzCz6nMza+n+1foH8l/1d5Ri5kp+6sYxUElFOUZ7rE8rNgfWJRr5Ji++32GFGs8DoKMcQ/PRBZBcKjc3PT0iJvgQt09IqcUTWiext7DU0N43kNgRdRhX/2qi0+Xexd23vWKoLJvGycpZSpeWaD0OaI0LW4tHDakwj39io0uUbN0wp032VHjfpJWM3R2dppcjNVmjRxQsN3IDg9+ORS0kwq6rwQmYyQ4Ib/i9Tqz871NMzf1+2tD8Qm+ln7iULmwEOPKDF4ZfBuOfiy5ac4aFW/hqhw6uGg3w== 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=cocU4ryfSJ+epZ+tAF25VMNmUpI9KdYJbW3DYa7/HxA=; b=aLC9lFwHPFGErENitKflKz42AXWITQICqpjTdeCGmC2PaPZKmlJ9FebN6p3NxlOn4R5onO1c/4bjuIAUSoND3UFWnhSA4wUuZvWGV/OK49PK1UiYJivGSGbUM8Pw7I72XoOnGnNQ3j64IKKJDyTIfh4WcG5GwCE4jlfYyJ0GVkw9f54WZfYQ9UPDHwU/KAPAg0uLO+2wZbXiwnvyYut6B2gSsuK391KNwdOi/Jl67TY5USUWLcT8IgoIQAD/ap0/UrWcmueE9fF2hHDiIPC3RrbMwiY+Lan6LkcVSC1criQUJsj+fhoutLA1gtRxzY4uRMi/tb0RFNC+ViU2RxvajA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM6PR11MB3227.namprd11.prod.outlook.com (2603:10b6:5:5d::16) by CY4PR11MB1557.namprd11.prod.outlook.com (2603:10b6:910:d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.23; Tue, 8 Mar 2022 13:47:45 +0000 Received: from DM6PR11MB3227.namprd11.prod.outlook.com ([fe80::2dbf:7924:80cb:1fb5]) by DM6PR11MB3227.namprd11.prod.outlook.com ([fe80::2dbf:7924:80cb:1fb5%5]) with mapi id 15.20.5038.027; Tue, 8 Mar 2022 13:47:45 +0000 From: "Mcnamara, John" To: "Pattan, Reshma" , "dev@dpdk.org" , "thomas@monjalon.net" CC: "stephen@networkplumber.org" , "Yigit, Ferruh" , "Pattan, Reshma" , "vipin.varghese@intel.com" , "stable@dpdk.org" Subject: RE: [PATCH v4] app/pdump: check lcore is not the maximum core Thread-Topic: [PATCH v4] app/pdump: check lcore is not the maximum core Thread-Index: AQHYLIngbZfYhS68SEiirj3KSTB2KKy1jO1g Date: Tue, 8 Mar 2022 13:47:45 +0000 Message-ID: References: <20220222110224.56857-1-reshma.pattan@intel.com> <20220228095856.58563-1-reshma.pattan@intel.com> In-Reply-To: <20220228095856.58563-1-reshma.pattan@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.401.20 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 00f9e2f0-7663-4f22-de3d-08da010a39d3 x-ms-traffictypediagnostic: CY4PR11MB1557:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: k6wwdxeTYflrU555mLmJiHRaTiLw/XMV+XXKrAMDoU8iPuFxxkM1IWUUVR6GcoyEXkLBXMvX6BEGxoWMpwU6IbVWBytvFdOyUSo/JL/B/zo+LhcuTT2q07NQyP0hC53s1B38V8179IN+is0DlAEGwZeWRWsTN5OY6owDEo3OmrvtTnKN2P7vdjpa2UKEX0l17bODdgt4b6toLJ0NLrUOUQxT39lOd/+FuWYfpd8xdYQhrfRYOhcThDUd6LkRaPuk2tHrQ+0R5aJPKjZWaOFKqqrFj7jhsdjn1OR2IHrHvVSfcACdXfiOyrjtl8Qi4gc6xmTrRP4H9U1G9zSfQseF+86ZoTXEZTh86bnd9uhVGO0uMC3rtte4FiiH+gxg/D7YCaZN77rV2bB60tKNpbF9vLjm7iSQqxBTc63z92BSCCMMI/K+X0aISw2T8J66SktiWGyxH8Hd0lQadh6nYx7452QC+lARdomwQkgigUtQcT/DlZMBrnAu1xN2KioOIqdKqP+o4qSFZaCwpE0cIZOxR8NsUFcUuN1xg+GU6dM6w8PuJUpHgF9sCzgMCym9+ct9C4kerZNBOjkABD1MLj7vzEZoFM3BknioVXpqTy2gpdLVWl1/P5/lSxEE2TcDG824gRcxbOwXOCeBq9/Lfp5Q3R+DqCbsSAz4OppqKZr1RQKiLzmKG39qNawqZjQgNoP/nY5lRAWTUiHyntwK5M0q+Q== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB3227.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(52536014)(38070700005)(54906003)(2906002)(110136005)(8936002)(82960400001)(316002)(9686003)(186003)(83380400001)(86362001)(26005)(55016003)(53546011)(71200400001)(5660300002)(76116006)(66946007)(66476007)(8676002)(33656002)(7696005)(6506007)(4326008)(122000001)(66556008)(66446008)(64756008)(508600001)(38100700002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?0TuLGXNpXR+pNnGYfATD+q7OSwaCpUf1XfgZ4+3EjVmUwRGUwzl/zAoNLjVF?= =?us-ascii?Q?IKW0pt8wL0HcfP4eFpLgnT/Y8S53mV6njb65zgopRDFr9id1nbhq2RRjeDhA?= =?us-ascii?Q?uC9HVcxjNrLWByYpCkWFHii72GUbyLE+Nk9RGVPHZs71/ad4+ETz5ZvcbR3/?= =?us-ascii?Q?0k20r+JiryvP8HM0VXf9dQElqE7JeJVCBscOGTmeVBTGNnM8ZKUD3O4Hw4jf?= =?us-ascii?Q?PS+jWT6Vf1RJfKreQT7CuvaDkrc6L96KjqlNt02qwjG0NVhxgiYwhSswBIV9?= =?us-ascii?Q?EsSA2O4nl7wavCO4RYXCDwRU6lyOE3nTCqVSA/SrjSz51INltyipy5uG5F1l?= =?us-ascii?Q?OpmyY9Y5PriwKB6F1JNY+zz1bfDbhzna1XeICYUFpOwqqJKDTJyQbHMSL6pV?= =?us-ascii?Q?o9HyhtXuG+/sb8gmec4Mn5RxghL9sKqOa0hdzGqKcDTxR07jPY3wPDG3t0UT?= =?us-ascii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F3833HsrHTlaXPJ/Hj4nEti?= =?us-ascii?Q?L0nL7RK8EfGyMk3xh32Ez+9Zinc6xX0xEPw8YbZ50kpYOSmbr2zcs/auZF/V?= =?us-ascii?Q?wz02zGpDEDxvJ6bN8VsA6i0Wbs3y2Tnw8nx9G3SsxFABdzDcPWMNJHgzfVMR?= =?us-ascii?Q?NglYeelzXRON7/BmEI7FpJWeRCfISmjbck6Ks4BmEA6ClT86aKAFDeLGP8aG?= =?us-ascii?Q?VMYKh04YVM7kHOCBFVXRUrm1qcBlsR568Gxcf0Z06dFsiQ8w7+Q276KmKit8?= =?us-ascii?Q?aGrvIWFQFXruJ4I1kjx3AuY=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB3227.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00f9e2f0-7663-4f22-de3d-08da010a39d3 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Mar 2022 13:47:45.6583 (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: FZe/6vuHhOnAQN6gm2SxcOJAQQkYgTOtGXP/4/WMwEUq9ouXNFXyLWImm5NxHag4BTFKJRvwGo9jXjh7TF37tw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1557 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 Thomas, could you include this in RC3 if possible. > -----Original Message----- > From: Reshma Pattan > Sent: Monday, February 28, 2022 9:59 AM > To: dev@dpdk.org > Cc: stephen@networkplumber.org; Yigit, Ferruh ; > Pattan, Reshma ; vipin.varghese@intel.com; > stable@dpdk.org > Subject: [PATCH v4] app/pdump: check lcore is not the maximum core >=20 > Check lcore id value is not the maximum core supported. > Using lcore id without this check might cause out of bound access inside > the rte_eal_wait_lcore. >=20 > Coverity issue: 375841 > Fixes: b2854d5317e8 ("app/pdump: support multi-core capture") > Cc: vipin.varghese@intel.com > Cc: stable@dpdk.org >=20 > Signed-off-by: Reshma Pattan > --- > v4: Remove inline of new function > Change lcore type as unsigned int > return lcore from the function > --- > app/pdump/main.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) >=20 > diff --git a/app/pdump/main.c b/app/pdump/main.c index > 04a38e8911..96fa76f8da 100644 > --- a/app/pdump/main.c > +++ b/app/pdump/main.c > @@ -900,11 +900,21 @@ dump_packets_core(void *arg) > return 0; > } >=20 > +static unsigned int > +get_next_core(unsigned int lcore) > +{ > + lcore =3D rte_get_next_lcore(lcore, 1, 0); > + if (lcore =3D=3D RTE_MAX_LCORE) > + rte_exit(EXIT_FAILURE, > + "Max core limit %u reached for packet capture", > lcore); > + return lcore; > +} > + > static inline void > dump_packets(void) > { > int i; > - uint32_t lcore_id =3D 0; > + unsigned int lcore_id =3D 0; >=20 > if (!multiple_core_capture) { > printf(" core (%u), capture for (%d) tuples\n", @@ -930,12 > +940,12 @@ dump_packets(void) > return; > } >=20 > - lcore_id =3D rte_get_next_lcore(lcore_id, 1, 0); > + lcore_id =3D get_next_core(lcore_id); >=20 > for (i =3D 0; i < num_tuples; i++) { > rte_eal_remote_launch(dump_packets_core, > &pdump_t[i], lcore_id); > - lcore_id =3D rte_get_next_lcore(lcore_id, 1, 0); > + lcore_id =3D get_next_core(lcore_id); >=20 > if (rte_eal_wait_lcore(lcore_id) < 0) > rte_exit(EXIT_FAILURE, "failed to wait\n"); > -- > 2.25.1