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: <9ae2fc87-40a4-4ca8-afcd-a85392f01181@kadam.mountain>
Date: Mon, 5 Jun 2023 17:57:36 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Jamal Hadi Salim <hadi@...atatu.com>
Cc: Simon Horman <simon.horman@...igine.com>, netdev@...r.kernel.org,
	deb.chatterjee@...el.com, tom@...anda.io,
	p4tc-discussions@...devconf.info, Mahesh.Shirshyad@....com,
	Vipin.Jain@....com, tomasz.osinski@...el.com,
	xiyou.wangcong@...il.com, davem@...emloft.net, edumazet@...gle.com,
	kuba@...nel.org, pabeni@...hat.com, khalidm@...dia.com,
	toke@...hat.com
Subject: Re: [p4tc-discussions] Re: [PATCH RFC v2 net-next 04/28] net/sched:
 act_api: add init_ops to struct tc_action_op

On Mon, Jun 05, 2023 at 10:01:44AM -0400, Jamal Hadi Salim wrote:
> On Mon, Jun 5, 2023 at 7:39 AM Dan Carpenter via p4tc-discussions
> <p4tc-discussions@...devconf.info> wrote:
> >
> > On Mon, Jun 05, 2023 at 11:51:14AM +0200, Simon Horman wrote:
> > > > @@ -1494,8 +1494,13 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
> > > >                     }
> > > >             }
> > > >
> > > > -           err = a_o->init(net, tb[TCA_ACT_OPTIONS], est, &a, tp,
> > > > -                           userflags.value | flags, extack);
> > > > +           if (a_o->init)
> > > > +                   err = a_o->init(net, tb[TCA_ACT_OPTIONS], est, &a, tp,
> > > > +                                   userflags.value | flags, extack);
> > > > +           else if (a_o->init_ops)
> > > > +                   err = a_o->init_ops(net, tb[TCA_ACT_OPTIONS], est, &a,
> > > > +                                       tp, a_o, userflags.value | flags,
> > > > +                                       extack);
> > >
> > > By my reading the initialisation of a occurs here.
> > > Which is now conditional.
> > >
> >
> > Right.  Presumably the author knows that one (and only one) of the
> > ->init or ->init_ops pointers is set.
> 
> Yes, this is correct and the code above checks i.e
>  -     if (!act->act || !act->dump || !act->init)
>  +     if (!act->act || !act->dump || (!act->init && !act->init_ops))
>                return -EINVAL;
> 

Ah.  Right.

> > This kind of relationship between
> > two variables is something that Smatch tries to track inside a function
> > but outside of functions, like here, then Smatch doesn't track it.
> > I can't really think of a scalable way to track this.
> 
> Could you have used the statement i referred to above as part of the state?
> 

If the if statement were in the same function then Smatch would be able
to parse this but that relationship information doesn't carry across the
function boundary.  It's actually quite a bit more complicated than just
the function boundary even...  I don't know if this is even possible but
if it were then it would be like a 5-7 year time frame to make it work...

regards,
dan carpenter


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ