From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id AFB121D7 for ; Tue, 13 Nov 2018 02:29:12 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Nov 2018 17:29:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,497,1534834800"; d="scan'208";a="107727566" Received: from kmsmsx154.gar.corp.intel.com ([172.21.73.14]) by orsmga001.jf.intel.com with ESMTP; 12 Nov 2018 17:29:10 -0800 Received: from pgsmsx109.gar.corp.intel.com (10.221.44.109) by KMSMSX154.gar.corp.intel.com (172.21.73.14) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 13 Nov 2018 09:29:09 +0800 Received: from pgsmsx103.gar.corp.intel.com ([169.254.2.114]) by PGSMSX109.gar.corp.intel.com ([169.254.14.66]) with mapi id 14.03.0415.000; Tue, 13 Nov 2018 09:29:09 +0800 From: "Zhao1, Wei" To: Adrien Mazarguil CC: "Peng, Yuan" , "dev@dpdk.org" Thread-Topic: FW: [PATCH] net/i40e: add parameter check for RSS flow init Thread-Index: AQHUem0X7hI/fkPBY0iQ1soVNyEexqVL599Q//++B4CAAUNWsA== Date: Tue, 13 Nov 2018 01:29:08 +0000 Message-ID: References: <1542014724-68073-1-git-send-email-wei.zhao1@intel.com> <20181112140305.GD17131@6wind.com> In-Reply-To: <20181112140305.GD17131@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [172.30.20.205] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] FW: [PATCH] net/i40e: add parameter check for RSS flow init X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Nov 2018 01:29:13 -0000 Hi, Adrien Mazarguil Peng yuan has find this problem, if you use the following test step, You = will find the problem. ./x86_64-native-linuxapp-gcc/app/testpmd -c 1ffff -n 4 - -i --nb-cores=3D8 = --rxq=3D4 --txq=3D4 --port-topology=3Dchained ............... testpmd> start testpmd> flow create 0 ingress pattern end actions rss types ipv4-udp end k= ey 67108863 / end Segmentation fault (core dumped) https://patches.dpdk.org/patch/47995/=20 This is the protection I have add, but you still need fix some bug in rte_f= low CLI. > -----Original Message----- > From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com] > Sent: Monday, November 12, 2018 10:03 PM > To: Zhao1, Wei > Cc: Peng, Yuan > Subject: Re: FW: [PATCH] net/i40e: add parameter check for RSS flow init >=20 > Hi Wei, >=20 > On Mon, Nov 12, 2018 at 10:02:20AM +0000, Zhao1, Wei wrote: > > Hi, adrien.mazarguil > > > > There is some error in CML layer for config this parameter, in > > i40e PMD it will get NULL of in->key even if tester config Some specif= ic key > from testpmd CLI, I add some protection but you also need fix that bug in= CLI > layer. >=20 > Odd, is that new? You shouldn't need to worry about the pointer if key_le= n is > zero. >=20 > Isn't this problem related to commit a4391f8bae85 "app/testpmd: set defau= lt > RSS key as null"? There's an ongoing discussion to revert this patch [1]. testpmd> flow create 0 ingress pattern end actions rss types ipv4-udp end k= ey 67108863 / end This CLI command key is not NLLL, but i40E PMD get NULL. > [1] https://mails.dpdk.org/archives/dev/2018-November/118633.html >=20 > > > -----Original Message----- > > > From: Zhao1, Wei > > > Sent: Monday, November 12, 2018 5:25 PM > > > To: dev@dpdk.org > > > Cc: Zhang, Qi Z ; stable@dpdk.org; Peng, Yuan > > > ; Zhao1, Wei > > > Subject: [PATCH] net/i40e: add parameter check for RSS flow init > > > > > > There need an parameter check for RSS flow init, or it may cause > > > core dump if pointer is NULL in memory copy. > > > > > > Fixes: ac8d22de2394 ("ethdev: flatten RSS configuration in flow > > > API") > > > > > > Signed-off-by: Wei Zhao > > > --- > > > drivers/net/i40e/i40e_ethdev.c | 5 ++++- > > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/net/i40e/i40e_ethdev.c > > > b/drivers/net/i40e/i40e_ethdev.c index 1c77906..217a8dc 100644 > > > --- a/drivers/net/i40e/i40e_ethdev.c > > > +++ b/drivers/net/i40e/i40e_ethdev.c > > > @@ -12552,13 +12552,16 @@ i40e_rss_conf_init(struct > > > i40e_rte_flow_rss_conf *out, > > > if (in->key_len > RTE_DIM(out->key) || > > > in->queue_num > RTE_DIM(out->queue)) > > > return -EINVAL; > > > + if (!in->key && in->key_len) > > > + return -EINVAL; > > > + if (out->key && in->key) > > > + out->conf.key =3D memcpy(out->key, in->key, in->key_len); > > > out->conf =3D (struct rte_flow_action_rss){ > > > .func =3D in->func, > > > .level =3D in->level, > > > .types =3D in->types, > > > .key_len =3D in->key_len, > > > .queue_num =3D in->queue_num, > > > - .key =3D memcpy(out->key, in->key, in->key_len), > > > .queue =3D memcpy(out->queue, in->queue, > > > sizeof(*in->queue) * in->queue_num), > > > }; > > > -- > > > 2.7.5 > > >=20 > -- > Adrien Mazarguil > 6WIND