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 2F0B3A0560; Tue, 18 Oct 2022 10:21:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A3F04021D; Tue, 18 Oct 2022 10:21:15 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 9223740143; Tue, 18 Oct 2022 10:21:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666081273; x=1697617273; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=oWBC7zOveWXmNbED7IInzWwoqxw7Oi9IbUK8hS8BJ0g=; b=cbS9XQajgKAl4QisRq7/H+ifjB5BMh2KTSlM9iMMqB+PyVnQ6vBTqkqM atLZF1r4b5H8FQ7To0yyKucSh68cwNxngQPeCnyECi6VBSEw3scbxGGwQ kjzLGFF/TOXWUOLTkU/9WPgEXasgDyis96crg17V/+uskUJdysGC1PEUB 6Wttksx2o8wuZOGaE7/d0V+ZRLc6fy7lSEyyXacKoCHWGRadb1GnsGiLg D+hc0jSAMEtF6Uv5FJOhs+wKssb3irLeRR7rc0FneKKxUmPEFz7KQh1mI eb+3LEnJoBAxOhIDJbC0ah4x+rLLLci+/fjjDdxZRYejPlZsQJ0AbfTIs g==; X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="332576936" X-IronPort-AV: E=Sophos;i="5.95,193,1661842800"; d="scan'208";a="332576936" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2022 01:21:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="659692168" X-IronPort-AV: E=Sophos;i="5.95,193,1661842800"; d="scan'208";a="659692168" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga008.jf.intel.com with ESMTP; 18 Oct 2022 01:21:11 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 18 Oct 2022 01:21:11 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Tue, 18 Oct 2022 01:21:11 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.107) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Tue, 18 Oct 2022 01:21:11 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KrVJsnljDjzb8BTrbakUe5Aenh6JlmBkF4XsH+fl5OFAVkMsx2pXZ61SHU2ciGV3TfnOd6XhF/RA9o+lBabsPHgAlGttypasnd5teNWcQqYwRiZv5tsRI9Rmcfaw42spxagVJMCejnTvZZHjChB276wvOmJ/5jrtYkWTsJCRcQaDQYsZ7nA9RgrArFGZ1whs7Xg/SfYokqH+0FlGtqjubctO1TIG70U6HA2FO3zjBslcsyfQnrkPjMNi/WXOG7wEgXXH/Xx/jtmapElvlIfduEWGTLif732qU9bQj6uah3wf1b3G9RDLJdwXMxQ8CbS3zUmRt85ZtC9JrsniQZdbrA== 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=Kmoolv3N3I/uskZ14uc4OSbd00EpobRR/gLDdW2fhUc=; b=UAULUJuSP+F6ijBpiMwLI5Q42iDJklHyos6ddhuaA0MvSqMjRZPBK+4viDmmpBgUhiHr0v0+CMzJFshqXVtiWGO3Zlet43e7ptJwIhRDEIkOFY5nK7LPtIrDPJytOZ68WL/EozdpVKMORGN9/mukXGgvG93sv0khRtBdKvcE/PxojJbc7cLTv2f59XqMiYt1CXEJfN+MbppOKdGHfJztsOdG+Mu6nkAPvokdd20MfwaEOFGOSxaEzBL5UNHtzcfKi5N9xe/oFAuDrtpBzMLSLtxhS5l1XO8kF7fZl63yGht+XjYluJdwuo6uczz01iX4hUlpkKdskO1DUtrye1CohQ== 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 CY5PR11MB6487.namprd11.prod.outlook.com (2603:10b6:930:31::17) by MW4PR11MB7104.namprd11.prod.outlook.com (2603:10b6:303:22b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Tue, 18 Oct 2022 08:21:09 +0000 Received: from CY5PR11MB6487.namprd11.prod.outlook.com ([fe80::d550:5776:e363:748d]) by CY5PR11MB6487.namprd11.prod.outlook.com ([fe80::d550:5776:e363:748d%5]) with mapi id 15.20.5723.033; Tue, 18 Oct 2022 08:21:09 +0000 From: "Hu, Jiayu" To: Kumara Parameshwaran CC: "dev@dpdk.org" , "stable@dpdk.org" Subject: RE: [PATCH v2] gro : check for payload length after the trim Thread-Topic: [PATCH v2] gro : check for payload length after the trim Thread-Index: AQHY4W2pjDWfXfOHzUqHfgVTrhajc64T0TXg Date: Tue, 18 Oct 2022 08:21:09 +0000 Message-ID: References: <20221010175109.44282-1-kumaraparmesh92@gmail.com> <20221016144305.19249-1-kumaraparmesh92@gmail.com> In-Reply-To: <20221016144305.19249-1-kumaraparmesh92@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.500.17 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-traffictypediagnostic: CY5PR11MB6487:EE_|MW4PR11MB7104:EE_ x-ms-office365-filtering-correlation-id: 40142871-10b7-4398-9b5e-08dab0e1b5e7 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MoMJ3nYDK3nF9i0gdYX41lcPHqWhb5fzlGyiy9VZP7+SFW+yOgD/XmsuWP4EUU+cr17TOkFA/0We4/pVsFwgQy2dVfPhypQgzpc+UfkADO8lnRecMy1Pf4fo1R0VZltpP5sjM8WZH4A6PSd8nyKQFeBXOqm4aiTyGJ1tzxt7n/oNY9nO0E/cbF/9HEKUXfvudmOjhob0Eg0DhyhTe9X2Frn78VQU8Ut5YXFotRCBNq8PH1BHOt0k+85RxF1EYtUZheCM8AExZVmR+NaDIfImSZwIXWd0w4lMgqcdWHv7Yf9tbdPDj53TWUTSWEDTs83qAnHlrPUMNH6AWP+4nuFWmml9ssbaT1WNmcUsoJl2qcI8mSUjH9RPvGAlqj20aM2V+eeGcwQYVfKro2hCuLOHuZ2cFuS+cdkVMlJlRTHGy96/Yl1gpniFp+Ytcu5byxuQrsYW1JUDz2L+ygQ2agDXzIBI2QAo5nSZQbF1UQbaVr0I+Hj+A0IxZ4fPi4UoA1peGZNnlqmaAIuIoxnjQMBmhQt3xNMzTZld1BFxGIUK2kRnqpfo2p6jxwvFNWUkUvRR6YA3mp+DpAmqOLHR2JEtXm3yuIQ9eQF/Bxmkk9AzDHqXX5//4PqZVl2PbKgDRnEM+tWGsFqvFN5nQZ6n3ZltzcJHKsLudPX+AAcfHq1ZcyuXfhBivnZzoUj510j4atxUrQwbG+bi9KPKGhvy9P4turyRt17VlyR6SOalEveGTc56Sd8zwb+Wh6sHLmCHyQh1EU4smZXMdjMjB8fijqTdcg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY5PR11MB6487.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(136003)(366004)(346002)(376002)(39860400002)(451199015)(122000001)(53546011)(6506007)(9686003)(7696005)(83380400001)(26005)(186003)(54906003)(2906002)(5660300002)(55016003)(316002)(76116006)(71200400001)(52536014)(66446008)(8676002)(41300700001)(8936002)(4326008)(6916009)(64756008)(66476007)(66556008)(66946007)(478600001)(86362001)(33656002)(38100700002)(38070700005)(82960400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?+YCNO1HzeABKlch3elDVqGzs+uvQnDndgxE7snx5yavetyi6Tn1PwuFv4sLl?= =?us-ascii?Q?jXna5Vbf2J377vUx5F4V1fM2FMomWXbazZBG4p6YvRbqFWIyut1CIHi/HGU2?= =?us-ascii?Q?Rv6+/kWhon4TAoMryuLnRvm/Exwhm2DxM8ZwCFX38YuJDga04Ro9i4On3mu9?= =?us-ascii?Q?72r6d8lGS6GUQiH3lDQqt3/72cNZC+aOXeiYF/saQJe7wwUZ3n/BrsLgHqGK?= =?us-ascii?Q?djeD3S727wygTCA3hdrIjtxmol2hcNbD1sq+onofEFgutIHqbePwK1ZtBohi?= =?us-ascii?Q?RdPywW8mhzJw6ldpB33MrMKh5iw3Ohd4txYwOvMq+6nhCZQJOXWjxyV9emRk?= =?us-ascii?Q?WZ+8BY1CZ4Kk1QTFZN7nsHprHBY9Q1hMQHnRty6/T+C/bDCsBKFu480KV5E8?= =?us-ascii?Q?Se3qMktw+5W3Yke9xUjO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8J65?= =?us-ascii?Q?WjhwwZYqnhT5xMBywbTouYCxYYgG93PWJW0ZUeY/IWM60zZ8Yemc1rk6UNkT?= =?us-ascii?Q?bslHbxVvWTihwGvv+CAkzBd3LZDAl8M6YScRK6lYomtAVVgeuQGQxFvI1l0h?= =?us-ascii?Q?4bsbS+uyA2+2cMNCT3Y3zDlRU3lmXK3alWzq+Eu/pb6+WDgTHiTK/EwZDHGd?= =?us-ascii?Q?Hug+O1bv7Lu6xWtrk0H9V9n80IkvahTk6POx0eK2Xgx/xeZOgR3AD5j0Yv9C?= =?us-ascii?Q?+YCIG5Y/HJKnvv4Qt2UoJWymNQ81O7HSjTIZHwAg?= 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: CY5PR11MB6487.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 40142871-10b7-4398-9b5e-08dab0e1b5e7 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2022 08:21:09.2174 (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: 2r79VGxueBJiHRSSQRhFUk5BwSZcpe5Sh4smJkMeFPRiUOVLA+qzadGoT9BPz07YLQWEf51sxTEAe/Psf7dKyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB7104 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 > -----Original Message----- > From: Kumara Parameshwaran > Sent: Sunday, October 16, 2022 10:43 PM > To: Hu, Jiayu > Cc: dev@dpdk.org; Kumara Parameshwaran > ; stable@dpdk.org > Subject: [PATCH v2] gro : check for payload length after the trim >=20 > From: Kumara Parameshwaran >=20 > When packet is padded with extra bytes the the validation of the payload > length should be done after the trim operation >=20 > Fixes: b8a55871d5af ("gro: trim tail padding bytes") > Cc: stable@dpdk.org >=20 > Signed-off-by: Kumara Parameshwaran > --- > v1: > If there is padding to the ethernet frame cases where timestamp is > disabled > the packet length should be validated with the total ip length as > packet length > is used in the GRO merging logic >=20 > v2: > Trim the packet length and then check for the protocol payload > validation lib/gro/gro_tcp4.c | 11 ++++++----- lib/gro/gro_udp4.c | 10 > +++++----- > 2 files changed, 11 insertions(+), 10 deletions(-) >=20 > diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c index > 8f5e800250..0014096e63 100644 > --- a/lib/gro/gro_tcp4.c > +++ b/lib/gro/gro_tcp4.c > @@ -225,6 +225,12 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, > */ > if (tcp_hdr->tcp_flags !=3D RTE_TCP_ACK_FLAG) > return -1; > + > + /* trim the tail padding bytes */ > + ip_tlen =3D rte_be_to_cpu_16(ipv4_hdr->total_length); > + if (pkt->pkt_len > (uint32_t)(ip_tlen + pkt->l2_len)) > + rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_tlen - pkt->l2_len); > + > /* > * Don't process the packet whose payload length is less than or > * equal to 0. > @@ -233,11 +239,6 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, > if (tcp_dl <=3D 0) > return -1; >=20 > - /* trim the tail padding bytes */ > - ip_tlen =3D rte_be_to_cpu_16(ipv4_hdr->total_length); > - if (pkt->pkt_len > (uint32_t)(ip_tlen + pkt->l2_len)) > - rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_tlen - pkt->l2_len); > - > /* > * Save IPv4 ID for the packet whose DF bit is 0. For the packet > * whose DF bit is 1, IPv4 ID is ignored. > diff --git a/lib/gro/gro_udp4.c b/lib/gro/gro_udp4.c index > 839f9748b7..42596d33b6 100644 > --- a/lib/gro/gro_udp4.c > +++ b/lib/gro/gro_udp4.c > @@ -220,6 +220,11 @@ gro_udp4_reassemble(struct rte_mbuf *pkt, > if (!is_ipv4_fragment(ipv4_hdr)) > return -1; >=20 > + ip_dl =3D rte_be_to_cpu_16(ipv4_hdr->total_length); > + /* trim the tail padding bytes */ > + if (pkt->pkt_len > (uint32_t)(ip_dl + pkt->l2_len)) > + rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_dl - pkt->l2_len); > + > /* > * Don't process the packet whose payload length is less than or > * equal to 0. > @@ -227,14 +232,9 @@ gro_udp4_reassemble(struct rte_mbuf *pkt, > if (pkt->pkt_len <=3D hdr_len) > return -1; >=20 > - ip_dl =3D rte_be_to_cpu_16(ipv4_hdr->total_length); > if (ip_dl <=3D pkt->l3_len) > return -1; >=20 > - /* trim the tail padding bytes */ > - if (pkt->pkt_len > (uint32_t)(ip_dl + pkt->l2_len)) > - rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_dl - pkt->l2_len); > - > ip_dl -=3D pkt->l3_len; > ip_id =3D rte_be_to_cpu_16(ipv4_hdr->packet_id); > frag_offset =3D rte_be_to_cpu_16(ipv4_hdr->fragment_offset); > -- > 2.25.1 Acked-by: Jiayu Hu Thanks, Jiayu