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 61DC1A034D; Mon, 7 Mar 2022 07:45:11 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2AF864068F; Mon, 7 Mar 2022 07:45:11 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id B23E740040 for ; Mon, 7 Mar 2022 07:45:09 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 226LssOL018754; Sun, 6 Mar 2022 22:45:08 -0800 Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3em63swtc1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 06 Mar 2022 22:45:08 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hlMe+EM7sry7JHfyWvejPmbQmiuMPTwq9bTAO1SjtE1F2NS7Qqu6ogDSmU5z4ujhSV78MVP5H5lS181SS4QCCeJgWjanT5t6WMvVX7DBr7NtCFh+l0Mwxe9juJJ3t74/cwAm+TnEXZAEeCR50yyiA7lvDx7gAzTzV0LSzAzwKPTF8NlAC4FoYBRyyUGNQ9+0tyz36ryIuRZM329Neo5eNOpe3hOTMjbE9b9xTtm1uLn4XuDfx62nMEjnxSwpzp7znk2tyHUyrrhlkAjwbMhhSeq4qWgy0W3fr+EdILUTTzK8Owx6aOmMgSnVQ/eH/0onvdfuuisk9U59M2ok5WYIKQ== 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=UY2cnMymTxh6k+F3ctQl33yV4H8B+//gMnCp9oFnQUc=; b=WF4kDSN/ImR7PdLVGspYtG7yntoveS9UHVG833zx07YbP6n3EYbIYVrQSHd393PJ8IHPm301ti6JiaDZkSkIXo1smIGlzBVZvOFc4qeVldoZPegKMpSaRu2eTs+P5LYGvoMcgO0x0SoHVkxcOB+7pWruxcPpYF3cbwsGmbg0m7FmBbSxBcfxY9Gvc5wzpIKJ8xx+xMgUORuF6DBVbe4RJ5CPNJp1rr4w5sLaSNwMYCWST9HtiJ0km0QdOUSy61nPTxacQqwWhlTBJrsnjR6DymprxhUBaPZTwHvz7Ly15D7wG5NI5TNgxgM7CToZYNOgIg5XGqEIWlSHcNNkQ8M0pA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UY2cnMymTxh6k+F3ctQl33yV4H8B+//gMnCp9oFnQUc=; b=bewNyLYTZ3mn4WfQbXEQxWIhFwf8iTIjatU210SEqPWOObi4kmY3bu7HcM9e1r8L1eRouaGI7dOsOvcNRiTEQJJY31ifweMzbz5c3Zi5mmZaPS9VQvQDu7k1+vJM1EnT/k4cp9E5Yp6qYiE1dhMATq0fEmykeBgIaMia6zQlDxM= Received: from CO6PR18MB3844.namprd18.prod.outlook.com (2603:10b6:5:340::7) by PH7PR18MB5204.namprd18.prod.outlook.com (2603:10b6:510:15f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.16; Mon, 7 Mar 2022 06:45:06 +0000 Received: from CO6PR18MB3844.namprd18.prod.outlook.com ([fe80::413a:be4:ae2a:2193]) by CO6PR18MB3844.namprd18.prod.outlook.com ([fe80::413a:be4:ae2a:2193%9]) with mapi id 15.20.5038.026; Mon, 7 Mar 2022 06:45:05 +0000 From: Rahul Bhansali To: Rahul Bhansali , "dev@dpdk.org" , "conor.walsh@intel.com" , "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: AQHYBunK2hiyHbi6wUGnDXDzE8GoyKyzy61Q Date: Mon, 7 Mar 2022 06:45:05 +0000 Message-ID: References: <20220111125005.554635-1-rbhansali@marvell.com> In-Reply-To: <20220111125005.554635-1-rbhansali@marvell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d0d39d41-0b73-4f47-c120-08da000603bd x-ms-traffictypediagnostic: PH7PR18MB5204: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: 7uTsz1kZd9SDBFqBethtX5zgzKqqwx3ZPf4mIoC9jALGMitSEfBtZ9H92QXW2jvHfoeQcfnpdAR/8kjmakY6jBIiIzvw+9bhjcVlbcX/IxticoNl5gGkwpEdgoOSy8d3Ur4pk/RsVrFTRYFIcv7OHA0OV5yskv+I2tY+UUrUMDqfQMBiT4HNQe/3deqIKsf46DkfvFUrf4J/kHxl5RZKAmSN6C77QWtWuPQKJTIoc32bjoXtN3bfXjtiJ3vu7vYwXetl1Tk+z7DOxxRkg/xXycbBrYYWnr9Me7+s+P2snsIcBNCntRWDgXVe9At5W6yomg7BLu0jjs6yZ+aJ7Wap2KxsjRbWSjtSCxGtXX+DG7G6AktgMvuzeVUDK2P6s+E47I+s7qNw64cY5CtUlB1zaVYM7zjrW6xPUjkFXkGbTJWHoaTzdaGZRLiPLU98baaDFmZOGUM+nz1o4zy0CqS+EFngMTUCzI6k3XSRgpPYhVXhYBPavGsSU08vZa3/IXH0TTffq1aNsPL/jjjaDbNpgy3UCT9C/gxMaVanGMJ2nO7PJS9uI5OPPh1IB718MOmYMIuLhxEbaK+KEE0ZwlR5wqp4FO6RskX2XhzSF585UN/3t1DNrBXL/2uCR9JqP0+XI/1dEECGqIFp75ymQZE7XZIStU2NLyLCiy9+88gCQi3Qrqjfbi9JTa5MPpPxga3dJUQ9lZdSNQTNNo0H/UvhLg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR18MB3844.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(5660300002)(66476007)(66556008)(66446008)(66946007)(64756008)(76116006)(316002)(9686003)(52536014)(8936002)(122000001)(8676002)(55016003)(86362001)(186003)(6506007)(7696005)(26005)(508600001)(71200400001)(33656002)(110136005)(53546011)(83380400001)(2906002)(38100700002)(38070700005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?4w3/wP6Vg9L1rE89aOCI3dYoXphbE1lc0nVVBf+rxNPEAC8t3I2RuYHPhnyM?= =?us-ascii?Q?tFx1AXgOIfxAbQBMnrXnvI/Zz9UwgBA7I7HXqO06yUMnqeg2Cfik5+3z8sEU?= =?us-ascii?Q?UIMl20egMBEaBd+UXycsC8Syj0ka/rTXS6eiaNqSnbj8Nzl/VGjTBNm6DylM?= =?us-ascii?Q?YgEntadWzFiavwiXUwb20w0T3OySqRYi72zh7OE92ITRShjqpeJuIEUDe1BF?= =?us-ascii?Q?SBJ1hBRCGwmXgs5jNYgLlBmoi7BSSiofJqYvhzUeX7PRPdBYY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5Bv7aswMGxjLmpW1o0S4K+iUdYDXLV?= =?us-ascii?Q?1FO9Gke1lf/fUfxx5TqstT2A6drBKGG441SZzfLCDgKi/zu8xhYxFhoGZYGz?= =?us-ascii?Q?VwmCeNwhfE3xWZkwH9oRD64qMlGhzSg+XjX9u/a5Q1puSQ7rwu2cq9I1cc/P?= =?us-ascii?Q?xJZfgh6ESg4GUKif+yUcDoZVVJy7hw1lzD2bo/Io63Kx6gbtnf2FG0oebOL0?= =?us-ascii?Q?mQJpXWW3sSjb+ruWAgHV/Jc4tFU8wyrGRsy+3kUvnhcwqtUiIx/d0SzIQJM8?= =?us-ascii?Q?IOoJi23N3gxwO8AohtUzKPuY9wY/zHlluAKX2SzNg4l7o95DcoGUIQd5tYei?= =?us-ascii?Q?x1dWhdTx/63JgNckZ+nY8ynRhFJkc1rNeAav+2BVPmD/OD3YzGXOs+D9YBDq?= =?us-ascii?Q?Xp4f2bESsUuP/+1R9vFlRw//KLvqHsVehxWaPqJjSra1ME6dbJb/ET2L+72T?= =?us-ascii?Q?ng=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR18MB3844.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0d39d41-0b73-4f47-c120-08da000603bd X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Mar 2022 06:45:05.7355 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: LnHdhTb9rlEM4zg/W447W4SOUxanL2hYqo9VqBnkBtEDowYw5wocP80ACMkfOksRNGPDFSxJ9xE9Wnbu+dcvlA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR18MB5204 X-Proofpoint-ORIG-GUID: l7LSGbcbKmkgIhOCZeUYe5S579rTxf8w X-Proofpoint-GUID: l7LSGbcbKmkgIhOCZeUYe5S579rTxf8w X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-07_01,2022-03-04_01,2022-02-23_01 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 Ping.. -----Original Message----- From: Rahul Bhansali =20 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 This patch fixes the stack buffer overflow error reported from AddressSanit= izer. Function send_packetsx4() tries to access out of bound data from rte_mbuf a= nd fill it into TX buffer even in the case where no pending packets (len = =3D 0). Performance impact:- No ASAN error report:- =3D=3D819=3D=3DERROR: AddressSanitizer: stack-buffer-overflow on address 0xffffe2c0dcf0 at pc 0x0000005e791c bp 0xffffe2c0d7e0 sp 0xffffe2c0d800 REA= D 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 Signed-off-by: Rahul Bhansali --- examples/l3fwd/l3fwd_common.h | 4 ++++ 1 file changed, 4 insertions(+) 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