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: <CAAFAkD-=hLQzZoPtuvc0aaV8pOd8b=z2G8bYqsqM7qdKUeSB=g@mail.gmail.com>
Date: Mon, 5 Jun 2023 10:48:18 -0400
From: Jamal Hadi Salim <hadi@...atatu.com>
To: Simon Horman <simon.horman@...igine.com>
Cc: Jamal Hadi Salim <jhs@...atatu.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 12/28] p4tc: add
 header field create, get, delete, flush and dump

On Mon, Jun 5, 2023 at 6:25 AM Simon Horman via p4tc-discussions
<p4tc-discussions@...devconf.info> wrote:
>
> On Wed, May 17, 2023 at 07:02:16AM -0400, Jamal Hadi Salim wrote:
>
> ...
>
> Hi Victor, Pedro and Jamal,
>
> some minor feedback from my side.
>
> > +static int _tcf_hdrfield_fill_nlmsg(struct sk_buff *skb,
> > +                                 struct p4tc_hdrfield *hdrfield)
> > +{
> > +     unsigned char *b = nlmsg_get_pos(skb);
> > +     struct p4tc_hdrfield_ty hdr_arg;
> > +     struct nlattr *nest;
> > +     /* Parser instance id + header field id */
> > +     u32 ids[2];
> > +
> > +     ids[0] = hdrfield->parser_inst_id;
> > +     ids[1] = hdrfield->hdrfield_id;
> > +
> > +     if (nla_put(skb, P4TC_PATH, sizeof(ids), ids))
> > +             goto out_nlmsg_trim;
> > +
> > +     nest = nla_nest_start(skb, P4TC_PARAMS);
> > +     if (!nest)
> > +             goto out_nlmsg_trim;
> > +
> > +     hdr_arg.datatype = hdrfield->datatype;
> > +     hdr_arg.startbit = hdrfield->startbit;
> > +     hdr_arg.endbit = hdrfield->endbit;
>
> There may be padding at the end of hdr_arg,
> which is passed uninitialised to nla_put below.

Yeah, same comment as the metadata case; we could add initialization
or add PADx at the end. Or maybe there's another approach you had in
mind.

cheers,
jamal
> > +
> > +     if (hdrfield->common.name[0]) {
> > +             if (nla_put_string(skb, P4TC_HDRFIELD_NAME,
> > +                                hdrfield->common.name))
> > +                     goto out_nlmsg_trim;
> > +     }
> > +
> > +     if (nla_put(skb, P4TC_HDRFIELD_DATA, sizeof(hdr_arg), &hdr_arg))
> > +             goto out_nlmsg_trim;
> > +
> > +     nla_nest_end(skb, nest);
> > +
> > +     return skb->len;
> > +
> > +out_nlmsg_trim:
> > +     nlmsg_trim(skb, b);
> > +     return -1;
> > +}
>
> ...
> _______________________________________________
> p4tc-discussions mailing list -- p4tc-discussions@...devconf.info
> To unsubscribe send an email to p4tc-discussions-leave@...devconf.info

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ