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 48C16A0C45; Wed, 22 Sep 2021 13:25:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9E5A41198; Wed, 22 Sep 2021 13:25:27 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 4459441196; Wed, 22 Sep 2021 13:25:26 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10114"; a="223604098" X-IronPort-AV: E=Sophos;i="5.85,313,1624345200"; d="scan'208";a="223604098" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2021 04:25:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,313,1624345200"; d="scan'208";a="474471912" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga007.jf.intel.com with ESMTP; 22 Sep 2021 04:25:25 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 22 Sep 2021 04:25:24 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Wed, 22 Sep 2021 04:25:24 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.176) 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.2242.12; Wed, 22 Sep 2021 04:25:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NGHNrJz1maVNDxP80L0Cz11V3kWdWQx41Wkx3RM7+vIIAaIRWko1SwkWw2gT5BQkTGyJ8yDxW4T9eG27ixueKVPVfhk18IwFiOiWMdf1war64NsowyE90cO9JKgfbalvB2IPjQMhwvr331+VrhJsfmfXiFq1nb93oCO1FZbF6yZPgeA6/q3P36nyfg0F0P8VFtCmrkk5pZFeYVWxfQ83e9gqDgsqmUB3vR4zu2emp4iFT7DlXbU3OE4qXo5VoeJ/R4qVyRGrF9UlJqm0olW3nCvkgdyXSBByPH4H+jhuC1QXCZhqPDmGgdCScki//8pYRZOHlBYkAIXZIQotTVq4gA== 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; bh=yRDVEhjgGMwM+i5LJB4p62302GFj+ebbC9pswrx7omk=; b=ZBLwPdLsH5mgw3XbaetbJ3Euhplmm1byGImddgxmMV0d4U7AlvfO5cwY5lZrvgE/7nT267qYk6d2lb2Z++QBXaOV+Grg0yyv7265t//DcRwKTYLGhmW5BryEMJdRW/wSFnc0txuxbN6/dueWE+lIyHGyKjMqoPGREJ2IX3vqE7yl7M8NroeEfDVv7rn+psajPQoKanec4/BkS0GGiDsJHr0/8aUERwwAsggzliC52M0FD27hNYfEqLLGRvl5SWat5CnkTvVJQz6n4Bk2nXLIIfvmXXr95jrwWutxaOLDxhhkEIPkWU57OyFcMDXDYt66QXM97GKY4EHXm8Eps+sB8w== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yRDVEhjgGMwM+i5LJB4p62302GFj+ebbC9pswrx7omk=; b=GYRNC/6F5Cuem7nVWWiSDTID6PGCfdzpZO+L5FQVG1+UBRA0+KHo/oPquh6ZMdpeS4VqDARI6khXAljql4Y7+U1DXsqy3PROwQydAKahQwa+84eBNYHyF9bGYlJ/ScwUz4hjnxhTe6YOkkXfyfzGba/W8lgKPe96kC91ohY75k0= Received: from DM4PR11MB5534.namprd11.prod.outlook.com (2603:10b6:5:391::22) by DM6PR11MB4234.namprd11.prod.outlook.com (2603:10b6:5:1dc::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Wed, 22 Sep 2021 11:25:23 +0000 Received: from DM4PR11MB5534.namprd11.prod.outlook.com ([fe80::3d9b:76d7:e274:bad3]) by DM4PR11MB5534.namprd11.prod.outlook.com ([fe80::3d9b:76d7:e274:bad3%3]) with mapi id 15.20.4544.015; Wed, 22 Sep 2021 11:25:22 +0000 From: "Li, Xiaoyun" To: Maxime Coquelin , "dev@dpdk.org" , "Xia, Chenbo" , "amorenoz@redhat.com" , "david.marchand@redhat.com" , "andrew.rybchenko@oktetlabs.ru" , "Yigit, Ferruh" , "michaelba@nvidia.com" , "viacheslavo@nvidia.com" CC: "stable@dpdk.org" , "nelio.laranjeiro@6wind.com" , "yvugenfi@redhat.com" , "ybendito@redhat.com" Thread-Topic: [PATCH v2 2/5] app/testpmd: fix RSS key length Thread-Index: AQHXr5h9TqId8PN4f0KsnG3qMQSMqquv6bIA Date: Wed, 22 Sep 2021 11:25:22 +0000 Message-ID: References: <20210922095742.229262-1-maxime.coquelin@redhat.com> <20210922095742.229262-3-maxime.coquelin@redhat.com> In-Reply-To: <20210922095742.229262-3-maxime.coquelin@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9d7219d0-93a2-4bce-402d-08d97dbbaaf1 x-ms-traffictypediagnostic: DM6PR11MB4234: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: pwLdOye4lQ41CvRD1Re3A85nO1VaVu5hgueYKIVNH1SslJ/tzera704ZrBfMNKLxLKGMND90jXV2uUiqjXAohKQT9L/HlUt4CUJN7VI6iLQ9XaMGIK0lPrcK33EPK10ywSGHGnWGPBQOaYZJabDGuJhdQS1ygGQeyZFLWL0cW3Zh5iQtHJRaotQjFV2i72LhcQvzXSTsqMhWDBTx5Pj7SJPnHM1zuOf6XvaKPh6DTSyxMyi4XGLqe05pFFyPNMFImhuhEMVVR03XbvnsL6+NiEhEkzXSXkryE0qlt2pyefkhjBjOZd3siBCf7uIOkTVjyj2GB9OW9S+KNy8eN6sFbHVRyOx87H4MgY935x0IeeNrkTLlzxi9p6xt/1fSQAzKZU2WQT0VZoa8lAAJO5WpgC0HbqxERuqfcUQ1cZCcbzaXk+GZJinrCK46CUu7uKzmb0tcqlx1/2ZCf+VuJQTP21z9SGqQmGD1a/sRRHwvYw6ScnEO1EPaZAac9FsnX2TXaTa0FuOiUyGVf9c7IHmufgY1PoVwpbxzBCK9D1eqEdGb9DleA4ixceN5uZUgS9l1ibWfBxfIHrMBakHjGH3nHDQIKDwp4Y0SXqjWxlhdwCeXB11S9D1Pqsamz/VpBYkAt4ILvS2SqnG/s0TJOx0i+WgEkkxjocJPcyAKTkn3VC74MP55Tvu6p+JbpReaWMOtqyTnJN79QLf3zgxTsGTLbuOQAHmL3AxuawWVQqIM4f0= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5534.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(55016002)(66946007)(2906002)(9686003)(26005)(38100700002)(83380400001)(33656002)(64756008)(8676002)(53546011)(7696005)(6506007)(4326008)(508600001)(76116006)(122000001)(186003)(921005)(71200400001)(38070700005)(8936002)(54906003)(5660300002)(110136005)(86362001)(52536014)(7416002)(66476007)(66446008)(66556008)(316002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?pB56pMIWuXlW8wsUQs5dRMWd+KGrqxhWn4KNMwj6WCNBjV/0slDWkHirK+Rl?= =?us-ascii?Q?0kmDKAPLpdmjHZ7aWm1P0kxJSG7aWYbrN9VD0ZgEZx3UXcJ890Fzd7QkJ6pN?= =?us-ascii?Q?D8wbOasWM+19jvYAn+pBKZYF9Y3R6iTl6V+Gn8zfqW2ChYQFKLeVivTYUep7?= =?us-ascii?Q?u8iSyjwumZG7EPIteJ8UVzGtYPf3F0zTcTFxR8QGj9zDFN3MgCuDsILHgu0s?= =?us-ascii?Q?o+bP/kj0/IKJCrVbnLd/viptt6Z4AW62dhEdgMmU71HPlvmvdKZYyF6eIqL1?= =?us-ascii?Q?tFbkgoiVdRouh0T/36y2E0IDmJT00u6AayzT1CRldUU1ep7KANbX9YQsQCWQ?= =?us-ascii?Q?sDxFHZwV//IDigpE8e4ux8u6pUTpeu8KL7ez/kCYBYaZw5DehQV3kphxZjL4?= =?us-ascii?Q?X6y1/fgHjhr8RdL4dle4PYYCdqPbefT7paIBPTbeWvkWx/M/nmNRxcsS1CnW?= =?us-ascii?Q?4zEW/Po7z6pmhLU/rUxCm3UPbEBKiSr8exYovHhXkZRopVUHrvbFMugdgZuO?= =?us-ascii?Q?EBlHOMp7yrE6eWAvRQLWqhr8ZRkHx4sKrU4Bz54Hu5Ct6btbWB/yAbwjw1Ny?= =?us-ascii?Q?OzwJjUYC+SAnbpmRSQSHMH1CVU8o9okVz4QrsKRuEuuTDfi84mX+ExPUfeDq?= =?us-ascii?Q?xKRp79RcohOfg+VNTY0yRbVlmKN9as2K2R3pyUNTzNMipnC8cX5gFWSqiQzT?= =?us-ascii?Q?fTU2vbLU7DyEf7ZynFg2P4Tg/01ulHaGVE5WTGKCCsZkiI1gCLat0xMlv2mX?= =?us-ascii?Q?T4Bi7742Mc82DVVZvQ8caDTE/VQQIja7cEsaFiX21AH8gjpXILvSuMF1Ug4m?= =?us-ascii?Q?OdpUhuoGpVdX+wyMqG6E3I54l4EMjId4PxerL/WIILUefGxOez+7ozW40UD4?= =?us-ascii?Q?v+2NJwn7BnR96LpUnLDCCy98Sfofgn9+gygow1nDDPLahWtQy59ZEH4xjD98?= =?us-ascii?Q?0LCKh8MCJaU25ekqSp0l15Imyg0F9zj+Dd6jvwXjGb7oV0WjBRPnolXa0bM/?= =?us-ascii?Q?LxMyziXNIBJ2xpWLAY4uhXPAavxCtEKo89Ci3MvfCh+Q+ASzTcIQNQjc1AUg?= =?us-ascii?Q?iexb4ufdROViw7tLiuoaXFjR0S1VxJY2pJh/Rt10BcR0++AlEYWqUrxxq7gv?= =?us-ascii?Q?EYtMNmyC1YeGo5Qxe4pzzF5D6fUSqHjTlWgglSwTnshJv3EnicVi0sqzz07f?= =?us-ascii?Q?gmt7rcLSnhrExarv4fyeO417DzD+Ps+1BPhHt1Lx3VTzVguhkL4O7oKTFEQz?= =?us-ascii?Q?Z0l8C4CxD4/9rnRcTPHcUPPZ3Db5tHDKq+f6GuDDCnpnIrE48YHwDF8fIbdo?= =?us-ascii?Q?1fE=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: DM4PR11MB5534.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d7219d0-93a2-4bce-402d-08d97dbbaaf1 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Sep 2021 11:25:22.8794 (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: n4ikJmRdp25qbjlpDVqMGKYYIu3343x9RIgoHPYI9sd9w3u9W+CD5yzObMtoe5mMIV38KLKa0xhJocC4kBbCOw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4234 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2 2/5] app/testpmd: fix RSS key length 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 Sender: "dev" > -----Original Message----- > From: Maxime Coquelin > Sent: Wednesday, September 22, 2021 17:58 > To: dev@dpdk.org; Xia, Chenbo ; > amorenoz@redhat.com; david.marchand@redhat.com; > andrew.rybchenko@oktetlabs.ru; Yigit, Ferruh ; > michaelba@nvidia.com; viacheslavo@nvidia.com; Li, Xiaoyun > > Cc: stable@dpdk.org; nelio.laranjeiro@6wind.com; yvugenfi@redhat.com; > ybendito@redhat.com; Maxime Coquelin > Subject: [PATCH v2 2/5] app/testpmd: fix RSS key length >=20 > port_rss_hash_key_update() initializes rss_conf with the RSS key configur= ation > provided by the user, but it calls > rte_eth_dev_rss_hash_conf_get() before calling rte_eth_dev_rss_hash_updat= e(), > which overrides the parsed RSS config. >=20 > While the RSS key value is set again after, this is not the case of the k= ey length. It > could cause out of bounds access if the key length parsed is smaller than= the one > read from rte_eth_dev_rss_hash_conf_get(). >=20 > This patch restores the key length before the > rte_eth_dev_rss_hash_update() call to ensure the RSS key value/length pai= r is > consistent. >=20 > Fixes: 8205e241b2b0 ("app/testpmd: add missing type to RSS hash commands"= ) > Cc: stable@dpdk.org >=20 > Signed-off-by: Maxime Coquelin > --- > app/test-pmd/config.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index > 9c66329e96..611965769c 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -2854,7 +2854,7 @@ port_rss_hash_key_update(portid_t port_id, char > rss_type[], uint8_t *hash_key, > unsigned int i; >=20 > rss_conf.rss_key =3D NULL; > - rss_conf.rss_key_len =3D hash_key_len; > + rss_conf.rss_key_len =3D 0; > rss_conf.rss_hf =3D 0; > for (i =3D 0; rss_type_table[i].str; i++) { > if (!strcmp(rss_type_table[i].str, rss_type)) @@ -2863,6 +2863,7 > @@ port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t > *hash_key, > diag =3D rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf); > if (diag =3D=3D 0) { > rss_conf.rss_key =3D hash_key; > + rss_conf.rss_key_len =3D hash_key_len; > diag =3D rte_eth_dev_rss_hash_update(port_id, &rss_conf); > } > if (diag =3D=3D 0) > -- > 2.31.1 Acked-by: Xiaoyun Li