lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMDZJNXAdvn0OcaeWDmVazvNFjkGj-dPg6DE815rXHavFF-1vA@mail.gmail.com>
Date:   Tue, 29 Jan 2019 00:18:21 +0800
From:   Tonghao Zhang <xiangxia.m.yue@...il.com>
To:     Or Gerlitz <gerlitz.or@...il.com>
Cc:     Saeed Mahameed <saeedm@...lanox.com>,
        Linux Netdev List <netdev@...r.kernel.org>,
        Or Gerlitz <ogerlitz@...lanox.com>
Subject: Re: [PATCH net v4 2/2] net/mlx5e: Don't overwrite pedit action when
 multiple pedit used

On Mon, Jan 28, 2019 at 11:34 PM Or Gerlitz <gerlitz.or@...il.com> wrote:
>
> On Mon, Jan 28, 2019 at 2:10 PM Tonghao Zhang <xiangxia.m.yue@...il.com> wrote:
> > On Mon, Jan 28, 2019 at 12:40 AM Or Gerlitz <gerlitz.or@...il.com> wrote:
> > >
> > > On Sun, Jan 27, 2019 at 1:06 PM <xiangxia.m.yue@...il.com> wrote:
> > > > From: Tonghao Zhang <xiangxia.m.yue@...il.com>
> > > >
> > > > In some case, we may use multiple pedit actions to modify packets.
> > > > The command shown as below: the last pedit action is effective.
> > >
> > > > @@ -2073,7 +2076,8 @@ static int alloc_mod_hdr_actions(struct mlx5e_priv *priv,
> > > >         if (!parse_attr->mod_hdr_actions)
> > > >                 return -ENOMEM;
> > > >
> > > > -       parse_attr->num_mod_hdr_actions = max_actions;
> > > > +       parse_attr->max_mod_hdr_actions = max_actions;
> > > > +       parse_attr->num_mod_hdr_actions = 0;
> > >
> > > why would we want to do this zeroing? what purpose does it serve?
> > Because we use the num_mod_hdr_actions to store the number of actions
> > we have parsed,
> > and when we alloc it, we init it 0 as default.
> >
> > > On a probably related note, I suspect that the patch broke the caching
> > > we do for modify header contexts, see mlx5e_attach_mod_hdr where we
> > > look if a given set of modify header operations already has hw modify header
> > > context and we use it.
> > >
> > > To test that, put two tc rules with different matching but same set of
> > > modify header
> > > (pedit) actions and see that only one modify header context is used.
>
> > The patch does't break the cache, I think that different matching may
> > share the same set of pedit actions.
>
> I suspect it does break it.. at [1]  we have this code for the cache lookup:
>
> num_actions  = parse_attr->num_mod_hdr_actions;
> [..]
> key.actions = parse_attr->mod_hdr_actions;
> key.num_actions = num_actions;
>
> hash_key = hash_mod_hdr_info(&key);
>
> so we are doing the cached insertion and lookup with
> parse_attr->num_mod_hdr_actions
> which was zeroed along the way and not accounting for the full set of
> pedit actions, agree?
not really, before calling the  mlx5e_attach_mod_hdr,  we have call
the offload_pedit_fields that will
update the attr->num_mod_hdr_actions that indicate  how many pedit
action we parsed.

> [1] https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c#L179

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ