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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180519224549.GH5488@localhost.localdomain>
Date:   Sat, 19 May 2018 19:45:49 -0300
From:   Marcelo Ricardo Leitner <marcelo.leitner@...il.com>
To:     Vlad Buslov <vladbu@...lanox.com>
Cc:     Jiri Pirko <jiri@...nulli.us>, netdev@...r.kernel.org,
        davem@...emloft.net, jhs@...atatu.com, xiyou.wangcong@...il.com,
        pablo@...filter.org, kadlec@...ckhole.kfki.hu, fw@...len.de,
        ast@...nel.org, daniel@...earbox.net, edumazet@...gle.com,
        keescook@...omium.org, linux-kernel@...r.kernel.org,
        netfilter-devel@...r.kernel.org, coreteam@...filter.org,
        kliteyn@...lanox.com
Subject: Re: [PATCH 14/14] net: sched: implement delete for all actions

On Wed, May 16, 2018 at 12:58:38PM +0300, Vlad Buslov wrote:
>
> On Wed 16 May 2018 at 09:48, Jiri Pirko <jiri@...nulli.us> wrote:
> > Mon, May 14, 2018 at 04:27:15PM CEST, vladbu@...lanox.com wrote:
> >>Implement delete function that is required to delete actions without
> >>holding rtnl lock. Use action API function that atomically deletes action
> >>only if it is still in action idr. This implementation prevents concurrent
> >>threads from deleting same action twice.
> >>
> >>Signed-off-by: Vlad Buslov <vladbu@...lanox.com>
> >>---
> >> net/sched/act_bpf.c        |  8 ++++++++
> >> net/sched/act_connmark.c   |  8 ++++++++
> >> net/sched/act_csum.c       |  8 ++++++++
> >> net/sched/act_gact.c       |  8 ++++++++
> >> net/sched/act_ife.c        |  8 ++++++++
> >> net/sched/act_ipt.c        | 16 ++++++++++++++++
> >> net/sched/act_mirred.c     |  8 ++++++++
> >> net/sched/act_nat.c        |  8 ++++++++
> >> net/sched/act_pedit.c      |  8 ++++++++
> >> net/sched/act_police.c     |  8 ++++++++
> >> net/sched/act_sample.c     |  8 ++++++++
> >> net/sched/act_simple.c     |  8 ++++++++
> >> net/sched/act_skbedit.c    |  8 ++++++++
> >> net/sched/act_skbmod.c     |  8 ++++++++
> >> net/sched/act_tunnel_key.c |  8 ++++++++
> >> net/sched/act_vlan.c       |  8 ++++++++
> >> 16 files changed, 136 insertions(+)
> >>
> >>diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c
> >>index 0bf4ecf..36f7f66 100644
> >>--- a/net/sched/act_bpf.c
> >>+++ b/net/sched/act_bpf.c
> >>@@ -394,6 +394,13 @@ static int tcf_bpf_search(struct net *net, struct tc_action **a, u32 index,
> >> 	return tcf_idr_search(tn, a, index);
> >> }
> >>
> >>+static int tcf_bpf_delete(struct net *net, u32 index)
> >>+{
> >>+	struct tc_action_net *tn = net_generic(net, bpf_net_id);
> >>+
> >>+	return tcf_idr_find_delete(tn, index);
> >>+}
> >>+
> >> static struct tc_action_ops act_bpf_ops __read_mostly = {
> >> 	.kind		=	"bpf",
> >> 	.type		=	TCA_ACT_BPF,
> >>@@ -404,6 +411,7 @@ static struct tc_action_ops act_bpf_ops __read_mostly = {
> >> 	.init		=	tcf_bpf_init,
> >> 	.walk		=	tcf_bpf_walker,
> >> 	.lookup		=	tcf_bpf_search,
> >>+	.delete		=	tcf_bpf_delete,
> >
> > I wonder, right before this patch, how the idr index got removed?
> > delete op is NULL and I didn't find anyone else to do it.

AFAICT this also means it is leaking idr's till this patch is applied.
Maybe I missed something.

> >
> > Also, after this patch, does it make sense to have following check in
> > tcf_action_del_1()?
> >
> >        if (ops->delete)
> > 	       err = ops->delete(net, index);
> >
> > Looks like ops->delete is non-null for all.
> >
> > Seems to me that you need to introduce this patch filling up the delete
> > op in all acts and only after that introduce a code that actually calls
> > it.
>
> Already moved this for V2 patchset to:
>   - Add delete callback to ops and implement it for all actions in single
>   patch.
>   - Move this patch before delete first use.
>
> Will now remove the conditional as well.
>
> >
> > [...]
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ