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 2EE61A034D; Mon, 7 Mar 2022 05:27:13 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E91D44069F; Mon, 7 Mar 2022 05:27:12 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 49A3B4068F for ; Mon, 7 Mar 2022 05:27:11 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 2271XJDi021605; Sun, 6 Mar 2022 20:27:10 -0800 Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2047.outbound.protection.outlook.com [104.47.73.47]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3em88rd1xf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 06 Mar 2022 20:27:10 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VqO1ccbzmmhY1DDuVeNKeVydPkxsbrKkDHMy0F3BJaK1VrF6nGxJLfvewPCsc+G7rJ3IqOyiYUAs9mcOXd6hynGddWWtGBiOr7GT5LrdYvoj8RN6kUc0+c8zAV42iTlmTro9+A2Aj+tAtqfNmA8ujzt/rfAIbvdrupKuE3FwxVQhE/66/ip8kTMVlt27gLzsLKNNVvV0RpSXnA3Pw+yyE7GkYa1yf6taY104dZDNzvBVKxxiVuoTBWPlay4qpSq0hG7g6c44oH5YWgsYl1xTIysgoWaGxM7/3ZAyqKYreecC3VGqyPAh5DBgQf+ZO6zIKBCf9m+mQ6i+LC61njcSgw== 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=0/vgMA2gpVeN/b75IO+OkICFqios+9XbwLciWWGakoU=; b=lJr0Lf5DFkLObj9JYGOTeJSVCPdD/lcgjo7Bfm8J5KV4d75ZXMqh1ufYyd6wHNV9Bs3koVjwrLhZGdj5RnsivDXeBxDthZBpOo3itqIOhxoTAZDtBIW8n9Sgk7Rkup+xIMzXKKZYgD3r+2OUnWOEzPSQqbC0CmvmvMYWITHzoIdfiM/1OBySKwRKMWUjMUIBeWfjh8/hq0lcRrYTOUUZRmVjy1VsNIsI1y521+zh8wNWKEcz86fipq3yhmbY474zoPhpnRFYXg7opCneG+rM8rS08kgJHbhLfaE1LiDTGzeyzetzpkVkI+p6Oa6MJ5Zd52SF1nuVcdyW3JHPAJrDCA== 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=0/vgMA2gpVeN/b75IO+OkICFqios+9XbwLciWWGakoU=; b=OUZL/SE46tKRKFx0hkNsI6CPsnKQliShOIJxYeZwtJtURRpwE0MMJhg+XNtB4HY+8bPxH7UoFQ3l/uENOn8TNI3+D/kw4TeDw0/eYT/Lv0ttRLhv2hTLNUZLkh8454wj1UsAXWJBs87BjO0Fdx3xwKM4+5d/wgcZ9XpSKP96Dm0= Received: from CO6PR18MB3844.namprd18.prod.outlook.com (2603:10b6:5:340::7) by DM5PR18MB1626.namprd18.prod.outlook.com (2603:10b6:3:14c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Mon, 7 Mar 2022 04:27: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 04:27:06 +0000 From: Rahul Bhansali To: Thomas Monjalon CC: 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: AQHYBunK2hiyHbi6wUGnDXDzE8GoyKyzqDQA Date: Mon, 7 Mar 2022 04:27:06 +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: 86260ef5-faea-45ce-e46e-08d9fff2bcd4 x-ms-traffictypediagnostic: DM5PR18MB1626: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: GStJIX/6NRoCfMV26dhN1GMOW1YmNKiJMWGFoQRY4a8BNkpRLVur8MhzxylJKjNbIuF2K5ElB3wNqnMQ9VDaC+yzIkDgpsqkG1s3aOYmUm7DhlOd2AQj/TlCtscceNPdND3vtJqG1hTN7A0RfjVW2J3DSq+Grw54U0gMgzF4iODwgxy5Lz+u2AzyinAprsUQMilkcQGjUTDyw5hMj3cDQE3UDX9gdaP4kkbsxaMKkf/iA76jsyOrUeisseXi/WiM8e5y7hPHloXHXLYNhhi9zb/tqi+owKxvZm9AxV7p2hsjYt+N9vnmGi4gXCby3xy4xXc7zJsaNzPwqYt3NtZL6EwLMTrpCH8ngODcCEtB4n3gjq7m/RMSF3Bg5CTGA4v06HCPqiRBvPV26bdyaSv91+/1lCYMf1AYCbuSd8Qgzfi/pJDC5tjBNxKTqX5d57jMc/YpIPBnwIZHmjvzH+VGBVRoNbM5bI5Ls2xK8DaMBsi/UGO3EpcpsTemgD0/QEXrDqNzJcDJNIt+s3et0qKZ2YMX13HSiDRRHCUPNmh1B8gZ2y5awJsYAbtfN37u0s5fscjLdoRM+vf86FnlejdRihIbDSdf9honptichIXY/mY60fgI6wIRaJamP2za3CWjEDGvRuoqJfDH4bCl7M+FqrfxKWDPyxqd+nCVvasjUwm35IxDhy22R2KjkcsbuPgroUHBVWIv7x7d+6UzryAiXEhZkkL/0mWJwYgScUPSzR1XoP9Fiu1K/uwB3zgMGXQjvmdkaHXmq8hK2IPna+jTDVzbaAWDOqr33TjvIpZoTO0= 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)(71200400001)(9686003)(6506007)(7696005)(86362001)(122000001)(2906002)(966005)(316002)(38070700005)(38100700002)(33656002)(76116006)(508600001)(53546011)(8676002)(66476007)(66446008)(64756008)(66946007)(55016003)(4326008)(66556008)(26005)(8936002)(5660300002)(186003)(83380400001)(52536014)(54906003)(6916009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?kZqG9NTrANj4PEdX745ACaGKO9AlS8DtwOcZRIAsd8X6b126MEujXHWgrcFl?= =?us-ascii?Q?vEJ1aiv472SBPpM5+cwKf8qyzRxEQdTLIAlozdB88f2fWHy1kvMFOU9u99v5?= =?us-ascii?Q?42TOCnuFHLNgDIrLWYJJ2cxAoVs2fC18+tCHq7hnyAmb0r4qOf3aWO/zMzY0?= =?us-ascii?Q?SZFcfgSg2nQyf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?= =?us-ascii?Q?ro3mYrmunPdebm2C6uQbrZzE4KdFPpOqd5+5SEfYWUArfbMf24e9KvjjdMlv?= =?us-ascii?Q?4DveySnB5khGrslvh7F6IW+jZbcEbWL7cp3GHFaMS8RCVGDdPd/ORLtFTvhd?= =?us-ascii?Q?kYtUYrEjyPNWzc8hucnT2EGA8i8g4MLD9943xG2TO+/anWXXIKnULLlrT8wn?= =?us-ascii?Q?vsIpvuqUqP+K4G7TQrxS5uXvyCuBztsQT4UaC/TeghD/9WyRmA5pQEe7XuPi?= =?us-ascii?Q?ELaG4Hm+rQTF69HnjONCEVRN7TkPc8KcVLeHUkXX6owIQ/vonJ0ubzlCBozT?= =?us-ascii?Q?ONMHZa1JgjI1u9MZ50mp0FreW1tO89h2YdlD5Hk+VxydUQv37ewp4OGGxpMy?= =?us-ascii?Q?GuGHNkltLEWjzsY2ocepFGYOCufcYWcYNtIRrrZeszEFa6il/vO5FrNedCZl?= =?us-ascii?Q?t2QeMIPPhpeNFcj/v0lpNAa/Wmgw/Su31yDzPXl2lb24ZsJMA6dgAx7K4CmY?= =?us-ascii?Q?TgirUs/Mj7QDInl8y7Es0RFddcrzk1DiL9sMxvhiOp/sQgoAMRcNkIoaLRXj?= =?us-ascii?Q?hQ=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: 86260ef5-faea-45ce-e46e-08d9fff2bcd4 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Mar 2022 04:27:06.3154 (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: R2MwojyoBvoPvw7uqcAu3hdxsTE9afJXqlyfP8sdrrjBkkckqH0yUppVdSKErrxarV8q3vsqMOQCEOLJo+8XyQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR18MB1626 X-Proofpoint-ORIG-GUID: h567fR9i5fnf01aCeYq3TNyP9epzKFts X-Proofpoint-GUID: h567fR9i5fnf01aCeYq3TNyP9epzKFts 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 Hi Thomas, Below patch is pending for review and merge. Can you please check it ? http://patches.dpdk.org/project/dpdk/list/?series=3D21124 Regards, Rahul -----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