[dpdk-dev] FW: [PATCH] net/i40e: add parameter check for RSS flow init

Zhao1, Wei wei.zhao1 at intel.com
Tue Nov 13 02:29:08 CET 2018


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=8 --rxq=4 --txq=4 --port-topology=chained
...............
testpmd> start
testpmd> flow create 0 ingress pattern end actions rss types ipv4-udp end key 67108863 / end
 Segmentation fault (core dumped)


https://patches.dpdk.org/patch/47995/ 
This is the protection I have add, but you still need fix some bug in rte_flow CLI.


> -----Original Message-----
> From: Adrien Mazarguil [mailto:adrien.mazarguil at 6wind.com]
> Sent: Monday, November 12, 2018 10:03 PM
> To: Zhao1, Wei <wei.zhao1 at intel.com>
> Cc: Peng, Yuan <yuan.peng at intel.com>
> Subject: Re: FW: [PATCH] net/i40e: add parameter check for RSS flow init
> 
> Hi Wei,
> 
> 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 specific key
> from testpmd CLI, I add some protection but you also need fix that bug in CLI
> layer.
> 
> Odd, is that new? You shouldn't need to worry about the pointer if key_len is
> zero.
> 
> Isn't this problem related to commit a4391f8bae85 "app/testpmd: set default
> 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 key 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
> 
> > > -----Original Message-----
> > > From: Zhao1, Wei
> > > Sent: Monday, November 12, 2018 5:25 PM
> > > To: dev at dpdk.org
> > > Cc: Zhang, Qi Z <qi.z.zhang at intel.com>; stable at dpdk.org; Peng, Yuan
> > > <yuan.peng at intel.com>; Zhao1, Wei <wei.zhao1 at intel.com>
> > > 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 <wei.zhao1 at intel.com>
> > > ---
> > >  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 = memcpy(out->key, in->key, in->key_len);
> > >  	out->conf = (struct rte_flow_action_rss){
> > >  		.func = in->func,
> > >  		.level = in->level,
> > >  		.types = in->types,
> > >  		.key_len = in->key_len,
> > >  		.queue_num = in->queue_num,
> > > -		.key = memcpy(out->key, in->key, in->key_len),
> > >  		.queue = memcpy(out->queue, in->queue,
> > >  				sizeof(*in->queue) * in->queue_num),
> > >  	};
> > > --
> > > 2.7.5
> >
> 
> --
> Adrien Mazarguil
> 6WIND


More information about the dev mailing list