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 BD2F3A0093; Mon, 7 Mar 2022 11:46:29 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4404640688; Mon, 7 Mar 2022 11:46:29 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 33CC74014E for ; Mon, 7 Mar 2022 11:46:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646649986; x=1678185986; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=9kcn7I7NnS5izLJNDv3pHzQBTNHrcP4ecy+n38xxjQ4=; b=j3RwrABdiY0ZafXVsGstKfR4krN80l4vhKn+2kn/vzeAnGXiFWoEE+tV beGbSEdcvF8gvysThlytJzL83udoGa12rvcmuXiVxCxbLko46aQttUI71 7fj/rxYe8mWsl+o8suGUsss2+QSdfeqAl5VfPYDsGMLQK+GE0HCOMH/DD W6ZV3oEBR2zFJj0OqKlqKsviFy6KBDiqMiStSFJGQ4UAbhoFVuyofFTGM pjSlIlwo4zILLHji7LeNm9iIzRU3RJgb/uk9OLnVI6ujmWCud+5bSHbOL kgoGVjJXZKLKCUYrPP5ajnrJoCUBdK2nUTj381LwHhIwzr+q6eY+skLhp g==; X-IronPort-AV: E=McAfee;i="6200,9189,10278"; a="315077289" X-IronPort-AV: E=Sophos;i="5.90,161,1643702400"; d="scan'208";a="315077289" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 02:46:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,161,1643702400"; d="scan'208";a="780284100" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by fmsmga006.fm.intel.com with ESMTP; 07 Mar 2022 02:46:24 -0800 Received: from orsmsx604.amr.corp.intel.com (10.22.229.17) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Mon, 7 Mar 2022 02:46:24 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21 via Frontend Transport; Mon, 7 Mar 2022 02:46:24 -0800 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.175) 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; Mon, 7 Mar 2022 02:46:23 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fR8dmpGxT2dWeoGMyplCKd0jV8UcuyFx+gx8JnTJTferqIDzR4qymnqeYwHZsVJYg4lqxPHEYWygYIu4ByS4rBZfKKtkoJUBu1IBduq5pVVBeR4+Uh+GQvLgH8zcLRT6bMiesIJANNmHVJx+kwPFIPViErBCz3IZbWwNk3W3GSg8biq73KiU+K6/vzlqoFdpZm37kNLuOLm2mIJe4MMFMU/JkY4UQ7IM6TInRMhBvocmSHGxisTrX/EEIHAnz1xH6fsQGpbsArR3AVA6AgWRo0MJ8OLYcwL2X0sxUuWAc2eBkMaVjjit5GvfNJ/WPFlbuItlm51Q7dmQPhoJ1oU6vg== 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=/nRkHoQJBAj55TkaEYtLQEpreOiLmVs1Yvd1v42cQh4=; b=VUib1aMLWMuJ1Gj+AsKdZ9/5+LQ/LcT49TtSFIIn/7Pl9iQXz1G8nOBAaXyYc/FxNF7FGrenk3X6/5pt9F0g/G6ia3D0XY+bQDj639ho7gbMFnYraXQ0iC/Xv5IzUJPPSzSg8CMrGOm39qbpvM6EI4cJsB8Mt121tm8ZxNnNU1SYRNiyltQJlHCosmQefWYSx6OMIuaz+Bme5qS5dNYciNDtvU4S5WTxugJ6L1Rh8sYGceQWICxYCPolxgavSvSiE9+wVDjOEYvaICXXS18C1JJsbiJmgoaFLHGCfVrfcWMLKTYwzUVSmTZLZ27ttkeoFz/QJRp/nYOFtWx5eI8Kyg== 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 PH0PR11MB5207.namprd11.prod.outlook.com (2603:10b6:510:32::15) by CY4PR11MB1959.namprd11.prod.outlook.com (2603:10b6:903:122::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.20; Mon, 7 Mar 2022 10:46:21 +0000 Received: from PH0PR11MB5207.namprd11.prod.outlook.com ([fe80::fd12:930:c411:8855]) by PH0PR11MB5207.namprd11.prod.outlook.com ([fe80::fd12:930:c411:8855%3]) with mapi id 15.20.5038.027; Mon, 7 Mar 2022 10:46:21 +0000 From: "Walsh, Conor" To: Rahul Bhansali , "dev@dpdk.org" , "david.marchand@redhat.com" Subject: RE: [PATCH] examples/l3fwd: resolve stack buffer overflow issue Thread-Topic: [PATCH] examples/l3fwd: resolve stack buffer overflow issue Thread-Index: AQHYBunQsDZtqZnJJEa9EkQ3Ky4wK6yzz+2AgAA5peA= Date: Mon, 7 Mar 2022 10:46:21 +0000 Message-ID: References: <20220111125005.554635-1-rbhansali@marvell.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.401.20 dlp-product: dlpe-windows 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: d8bf546a-3839-4310-b945-08da0027b7d7 x-ms-traffictypediagnostic: CY4PR11MB1959: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: kWhTFJMMksN3Diq3WlfbOhFbm3JDkWM5CDAuCiDJVjS6HxM7YKY1+JNeRUQVS0p1PZXLMfCXulH/1dZ7TnVhXHHnVH7HEGzSHxvE9xYOhrZtFsSKe/SIdjkXZmRlQ7Dpjm1tpMXjDgZDybibcliKsdE6Yp0F6Lb59zCTd3xADBcC7h6HfwA2yqsEyvOiQXcyw7cln0xkg4RIX4eEjL5pmk4kDmb8Wu1nHC55ATyVAojq6Fj8gOUX/6wCL1ucLIVw6DbRtz/UOQ0QdkYXIcZX/a/BlRvWzawrV1b/ntvOx58N6ov8O+ieyFEuqsIFs+dDwecW9mJj53Gh8yiwk4I/GzQcqdZKGRZLClilC4LjssB2gBVlPtc2peubchq0UYJ40YMZmx43ptt/ZRH57Nresq+/2CaVas1oFsfABN4uaqqehgfIE80kmmH90FeTKnihdYalmU0URRSUCX2oN3kMCglQf/aHt/3aXxmaUIL/V9GBXOGIEyAKImDBJqDE68SmuRjHw+gdZoPzrXMAf5wt3BrIXfTcHBu0lG/aGzeQqM1TD6doHuIg2INxh1+wcJMXI1fx4pEVALezSf271PFmwREwtuB4J0BPkHL0GbfcW9N01Urtbb+rFo3MuubT2sTYgX+DmkPcLI4VOV2NiWJepvEjYXpBPtB8bFfE1IJDuAeqezazQJzu2FYWWva3VH7sAWNgPbschHuCY/X20hhE4A== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5207.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(5660300002)(82960400001)(2906002)(26005)(122000001)(186003)(83380400001)(508600001)(33656002)(86362001)(66946007)(55016003)(316002)(66556008)(76116006)(66476007)(52536014)(8936002)(66446008)(9686003)(64756008)(8676002)(38100700002)(38070700005)(7696005)(6506007)(71200400001)(53546011)(110136005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?JWKxbZItYBYsZMWcpLqhyOqau5rlXDSiPlcAU9S2mVuOWMixR2UcWAOgwQH4?= =?us-ascii?Q?pdWbzdh3zrLIEpBKAK1iSCfo0UKsw6ZanPi4gIBMTYdYjDg2paeiM/TGV5uN?= =?us-ascii?Q?+YnzjpLSdUIWe+8i+h5Jx1slTcPQsqfJuQZAFptnXJQmisCfGXmrwR3P/SlI?= =?us-ascii?Q?6275EuTPApxP7nnc7uEi0N/DVAhpHFhnEWNBkDJVYKznMFO2A8CH6IqSYP8C?= =?us-ascii?Q?KuhYVtwQJDyBoUI/6tRK5z6WqgwJgSfrea+/lkkWG6sgp+GQI10rM6p6fqlq?= =?us-ascii?Q?57ag8PptCTDW/7GMzhpVYSmNKCa0sTJkTECWao9+lfqy530X1vqjjFZdOxqV?= =?us-ascii?Q?sj/ajNKPT6V0p946E0QnVfV+h2ouuFP0CNRi7oWYAbggFRa1dUCQJrZh+lFY?= =?us-ascii?Q?Fa6AA8cj1MvBwaANpDCcgzRbpX4fVm+MU4JUd/8DbaJsb6Cf//SoS+Kowgxy?= =?us-ascii?Q?DCDL5gQIR2BrM9Pj03NB1yDy6NLJXXzlKa5r1KFGOBtxQ0uJL/GcrZ++SXDP?= =?us-ascii?Q?84+N1FaeS5WqfLKJu9sqveiHA8naLQzVIf6R5J+kkIApm9yNvmmu+/LFWI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2d4ZGyQYC9H6nQVZG3vupS8qAp/4k6xahjsBx2?= =?us-ascii?Q?q7Su/iO85Qax6N4DWOM+kdE+qwbEKSVz05tGATpm2sYBYpTXxFOrK0BEZitw?= =?us-ascii?Q?17etWC8q9zSa8Qr3AmWSvn7nIiJcxjc4PlZac/8bIR7nAseA/ncq0l8rRmMd?= =?us-ascii?Q?cQ=3D=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: PH0PR11MB5207.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d8bf546a-3839-4310-b945-08da0027b7d7 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Mar 2022 10:46:21.3501 (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: +K8WDsSO2jOA3f0hvJ+LF81b1h3LTvRCqeqfs6rCx9qFMA4E+6gAH2gK2U8+N8a7QOojvMrwlQDouya8VfFnrw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1959 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 Hi Rahul, I must have forgot to put my tag on this because I thought I reviewed it al= ready. I reviewed and tested it again this morning. Thanks, Reviewed-by: Conor Walsh > -----Original Message----- > From: Rahul Bhansali > Sent: Monday 7 March 2022 06:45 > To: Rahul Bhansali ; dev@dpdk.org; Walsh, Conor > ; david.marchand@redhat.com > Subject: RE: [PATCH] examples/l3fwd: resolve stack buffer overflow issue >=20 > Ping.. >=20 > -----Original Message----- > From: Rahul Bhansali > Sent: Tuesday, January 11, 2022 6:20 PM > To: dev@dpdk.org; conor.walsh@intel.com; david.marchand@redhat.com > Cc: Rahul Bhansali > Subject: [PATCH] examples/l3fwd: resolve stack buffer overflow issue >=20 > This patch fixes the stack buffer overflow error reported from > AddressSanitizer. > Function send_packetsx4() tries to access out of bound data from rte_mbuf > and fill it into TX buffer even in the case where no pending packets (len= =3D 0). > Performance impact:- No >=20 > ASAN error report:- > =3D=3D819=3D=3DERROR: AddressSanitizer: stack-buffer-overflow on address > 0xffffe2c0dcf0 at pc 0x0000005e791c bp 0xffffe2c0d7e0 sp 0xffffe2c0d800 > READ of size 8 at 0xffffe2c0dcf0 thread T0 > #0 0x5e7918 in send_packetsx4 ../examples/l3fwd/l3fwd_common.h:251 > #1 0x5e7918 in send_packets_multi ../examples/l3fwd/l3fwd_neon.h:226 >=20 > Signed-off-by: Rahul Bhansali > --- > examples/l3fwd/l3fwd_common.h | 4 ++++ > 1 file changed, 4 insertions(+) >=20 > diff --git a/examples/l3fwd/l3fwd_common.h > b/examples/l3fwd/l3fwd_common.h index 7d83ff641a..de77711f88 100644 > --- a/examples/l3fwd/l3fwd_common.h > +++ b/examples/l3fwd/l3fwd_common.h > @@ -236,6 +236,9 @@ send_packetsx4(struct lcore_conf *qconf, uint16_t > port, struct rte_mbuf *m[], >=20 > /* copy rest of the packets into the TX buffer. */ > len =3D num - n; > + if (len =3D=3D 0) > + goto exit; > + > j =3D 0; > switch (len % FWDSTEP) { > while (j < len) { > @@ -258,6 +261,7 @@ send_packetsx4(struct lcore_conf *qconf, uint16_t > port, struct rte_mbuf *m[], > } > } >=20 > +exit: > qconf->tx_mbufs[port].len =3D len; > } >=20 > -- > 2.25.1