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 64830A0093; Wed, 9 Mar 2022 16:57:50 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 584B740687; Wed, 9 Mar 2022 16:57:50 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id A34AD4013F for ; Wed, 9 Mar 2022 16:57:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646841468; x=1678377468; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=0/vqhsCKLPF2LdMC+XbWIdgUq2VquUXptU0+BC0XiB8=; b=FiEX3WCJyUhmupyxYuEGrCVhCWl2+d8nH0uypzP7M+VDSDMRXyYSQmoI 7HlWObNW96U9vTmvpbVly7O0cwDN5I51OU52WTtgegE8MvaRVIzJa6o2e 8VgeI0pnJihiM990ugNXLJCYMrgvshvzHXhz1hbmwUFNmdZreQ5cegMFI 7HvUspJS3RQpx/f8MgLGdQialy11FzKx+XZIbB+oOWIZITvrnQT7Kjojm wLGwup5imsd5s3fw6TkN1oaMkdqHoJx6JvutecwLdBqWOrmblmNzvugzZ 8+ePC7yetxyZ26m1NrCJqgdfr0O4KPLADu2jUD1nXK5sAxZJ0a5vIe1Dr g==; X-IronPort-AV: E=McAfee;i="6200,9189,10281"; a="254735949" X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="254735949" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 07:57:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,167,1643702400"; d="scan'208";a="632646334" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by FMSMGA003.fm.intel.com with ESMTP; 09 Mar 2022 07:57:47 -0800 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) 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.21; Wed, 9 Mar 2022 07:57:46 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 9 Mar 2022 07:57:46 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21 via Frontend Transport; Wed, 9 Mar 2022 07:57:46 -0800 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.49) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.21; Wed, 9 Mar 2022 07:57:45 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BDt1Wt6BRSY2sWlvUovOaTMWAZ+Uu7rC43NMYQtZnClwr3qSH13K9iMo5SaNIKssbdtLQDhEcEeztdqWkkMop/TD/MQT+744a7D3pCJVVD1l3A9TA6TfCH6BMj7LfSIxa4l6OGwS26otDR74kbHyecmKxg89RqlbQVqsbB4/SKwKPr3udWnuKBknovznlHBTQF6GF8Jw3f4ZgEIoHUs7e40bRN6q5qnzx7JGdy0pAynKqyKQZQGzR/zVJajmv1vnPw2ZnDfoAnZ+e2c5Dny1NuAQsm/wbkQQmsQOpLK4cxYIqtLT9qU5wGSvy6xwbnzhGh+D14DCCn3iUT/JsALtww== 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=EVwMu0Un/ZimxZyMoj+yYNO6gF5AikIaldqwYoi8a+Y=; b=TGQW5q4qcrHHy3YoBgwGDX2SO+yuqPX1xQ+IMr6cpaVYM4khJ+4kdmhQ2cLrLwyCTH/BuLwEGRbwlz/6gWEfD8FvvUnwB5vEKzxPvGzQha38NfLE7lkWGpE+GuFzS1f2eE4L2jsGs2tT1QKOlubJonjUcFftoALJ3Ux7JvnYzANFtRmHNvwHT+CrERdKwKYaeRAU3bMLBGl/wFxpcO2NHCY8ODTzmUvbRSsxNtlqGU/rz3+tHmkkHcDZ+m0l5g3/LPWRLC9bQMQvBphbuI0lCL7ID7fPiFVKXtZXv0RCCyt04YaRm+MfVGCwFsvglj++QZurepmiNA+b/eTMc3s8Zw== 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 DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19) by BYAPR11MB3320.namprd11.prod.outlook.com (2603:10b6:a03:18::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.16; Wed, 9 Mar 2022 15:57:43 +0000 Received: from DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::8ccc:ed65:78fa:1b07]) by DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::8ccc:ed65:78fa:1b07%4]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 15:57:42 +0000 From: "Ananyev, Konstantin" To: Rahul Bhansali , "dev@dpdk.org" , "Walsh, Conor" , "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: AQHYBunbAty7qVY52E+yd1t85RW3ray3jsMg Date: Wed, 9 Mar 2022 15:57:42 +0000 Message-ID: References: <20220111125005.554635-1-rbhansali@marvell.com> In-Reply-To: <20220111125005.554635-1-rbhansali@marvell.com> Accept-Language: en-GB, 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: 2b17c789-890a-4a1c-f894-08da01e58bba x-ms-traffictypediagnostic: BYAPR11MB3320: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: 5er9D2MrOEJboTLxIMGDLrbczhA5a6qq34bbD9lj6Dyy3gcxIgXIvf8Jx6JS3C8klwDQDfRUmEjpQkX3kWGn6rOhp72q2tbBQcWxgZJxF6Hk6d7jGN/zKoZlM/5+LrTBO4xp1IEo7+5KrjaUa3qQmbT4x/Au849NeiYkhObMdmLWTO9EvtOwm3em9kNv7XPSUNM41vWbujwoyzPeUw7ToX+H/Z7z66B00zLZhFBcAlGElxZRKxlctTKqV4BiZ/RyQ4mXlelf7BlmFj42N3+UjrMqdNh7gl9QRgsmw94DHCpHfkuRfTOBaE1vK3O0ml8ZJzKi6oQmw32DGWcpb9N+QYX86Dy/r+xd6OzHHdeJgm1EyieYJg1/mw0eNKhKkWiAZcwrdJS/CnlS4DPExC5xRZ05bYI8zpyDErb2v71wlOvir0jWlZ26tY24ahYEjCYSad2QAODheS/N96SE5jw9EOBVloGnNwPABKTIM9m2q01rdIlyiCd12cwQtpL7nH4Vu8ylTfwnHmvM/x45jro0jjSUcjhD7BB6NDRT3OzrLW0nWWLDKz0+CVkcy946pgtIFfPqGqr8ptGnTjB4W0GKjSgzgkvej95Ee/tj/phFU6cDsVPYIyRIV+zkSbKsWi59d9fGVTxojpWJzCbrY+iFvwuFzV2EM+OdV6MWEvSu6JidmfPBAzyFGdZnRTsmhpFRcQt0+yQuudpDOEknEaJpZA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4491.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(38100700002)(82960400001)(186003)(26005)(9686003)(5660300002)(55016003)(8936002)(2906002)(33656002)(52536014)(122000001)(86362001)(508600001)(76116006)(38070700005)(71200400001)(7696005)(6506007)(66946007)(83380400001)(66446008)(66476007)(64756008)(66556008)(8676002)(316002)(110136005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?xvOoQ+sSaWGViglvexT+zh2aR306qIGziDGvqOsqAJJjvfxzeE+cYgZT6vM5?= =?us-ascii?Q?M+jOU0Bxq9pmhRJY0TytnJ6d/MT4EWZx35JmAecKHtygNinhUak/Lq9xwqil?= =?us-ascii?Q?MJ6htfkR0ke8zGQtoUa4Le5nzr+T/3LZVbCEkY2Ec30rdoJSfdGjKBVYdOnl?= =?us-ascii?Q?saAxkfIjduXYdgSkreoCRF2BDY/Tp7GAW/IUkAwvwo5ihuegvGIisUKxSPso?= =?us-ascii?Q?FGJg03ni3LCREEGNAisjlUBGQqEQymLw/n38ZepiXRExVB3IoKnxTU3XSkYH?= =?us-ascii?Q?XLZAd+qs3RnwlsRlfEK7hCSN9enMt3zzrHylbhniWDdkHewHup1ag0txwQAZ?= =?us-ascii?Q?szbduqUoyAQPNu53UkgvCfvCWHwXOhv7ryWyqPWjGF+KGzD76mwIYCk30Sda?= =?us-ascii?Q?MmRkO0yVnmC4WiVTS1af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= =?us-ascii?Q?4MbM1pTti+pNgIPkZsjMInz7yFoytrS2gO4/qFY/oASKUCB+CIEmDqMAaJgp?= =?us-ascii?Q?S0mDCDLT48UmMBFWJEvqyipM19p+SiB3vslYcPKVzHbgJz0+kBofY6N/qLst?= =?us-ascii?Q?2p9A6z8uu+Ppp4uNvQeIBidWeNr5uBVjfSluq+bXozEiAyDfLU174H27Ctl8?= =?us-ascii?Q?wURuzJN9et6dk2RhRfKzBzZAeBGfvB1w5CTDZsyRpTM76RR9TkHe4AC+q4E8?= =?us-ascii?Q?C+VpqrVW3o+BkQx1XUQDQeSKP3S6WZypKnSY6YVgp2pEcCT+fLMqYgF0niEI?= =?us-ascii?Q?2xtmb7C9oTzAsFLf7+wEKuZY5xBIcJ6VwKEqTkQuzbXNu6vRnUtl+RHK9qm4?= =?us-ascii?Q?kDPYzA=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: DM6PR11MB4491.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b17c789-890a-4a1c-f894-08da01e58bba X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Mar 2022 15:57:42.8677 (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: xh4/ABupjNGpfzb0CDF/T19T+FmWUDxVtO78wrtuJ/RzgWntOOBEfeDwu42GyxU6a4x9YZ5d8/5wxMmOQtNtIvtIogWR4xh3+oA9Otgy5as= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3320 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 > 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 por= t, 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 por= t, struct rte_mbuf *m[], > } > } >=20 > +exit: > qconf->tx_mbufs[port].len =3D len; > } >=20 > -- Acked-by: Konstantin Ananyev > 2.25.1