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: <Y87Zg1SEOwDmpwmx@maniforge.lan>
Date:   Mon, 23 Jan 2023 13:01:23 -0600
From:   David Vernet <void@...ifault.com>
To:     Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc:     bpf@...r.kernel.org, ast@...nel.org, daniel@...earbox.net,
        andrii@...nel.org, martin.lau@...ux.dev, song@...nel.org,
        yhs@...a.com, john.fastabend@...il.com, kpsingh@...nel.org,
        sdf@...gle.com, haoluo@...gle.com, jolsa@...nel.org,
        linux-kernel@...r.kernel.org, kernel-team@...a.com,
        memxor@...il.com
Subject: Re: [PATCH bpf-next v2 3/3] bpf: Use BPF_KFUNC macro at all kfunc
 definitions

On Mon, Jan 23, 2023 at 10:54:34AM -0800, Alexei Starovoitov wrote:
> On Mon, Jan 23, 2023 at 12:48:27PM -0600, David Vernet wrote:
> > On Mon, Jan 23, 2023 at 10:33:05AM -0800, Alexei Starovoitov wrote:
> > > On Mon, Jan 23, 2023 at 11:15:06AM -0600, David Vernet wrote:
> > > > -void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign)
> > > > +BPF_KFUNC(void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign))
> > > >  {
> > > >  	struct btf_struct_meta *meta = meta__ign;
> > > >  	u64 size = local_type_id__k;
> > > > @@ -1790,7 +1786,7 @@ void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign)
> > > >  	return p;
> > > >  }
> > > >  
> > > > -void bpf_obj_drop_impl(void *p__alloc, void *meta__ign)
> > > > +BPF_KFUNC(void bpf_obj_drop_impl(void *p__alloc, void *meta__ign))
> > > >  {
> > > 
> > > The following also works:
> > > -BPF_KFUNC(void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign))
> > > +BPF_KFUNC(
> > > +void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign)
> > > +)
> > > 
> > > and it looks little bit cleaner to me.
> > > 
> > > git grep -A1 BPF_KFUNC
> > > can still find all instances of kfuncs.
> > > 
> > > wdyt?
> > 
> > I'm fine with putting it on its own line if that's your preference.
> > Agreed that it might be a bit cleaner, especially for functions with the
> > return type on its own line, so we'd have e.g.:
> > 
> > BPF_KFUNC(
> > struct nf_conn *
> > bpf_skb_ct_lookup(struct __sk_buff *skb_ctx, struct bpf_sock_tuple *bpf_tuple,
> > 		  u32 tuple__sz, struct bpf_ct_opts *opts, u32 opts__sz)
> 
> Yeah. Especially for those.
> 
> > ) {
> > 
> > // ...
> > 
> > }
> > 
> > Note the presence of the { on the closing paren. Are you ok with that?
> > Otherwise I think it will look a bit odd:
> 
> Yep. Good idea. Either ){ or ) { look good to me.

Ack, will send v3 with that change later today, along with anything else
if someone else reviews.

> 
> > BPF_KFUNC(
> > struct nf_conn *
> > bpf_skb_ct_lookup(struct __sk_buff *skb_ctx, struct bpf_sock_tuple *bpf_tuple,
> > 		  u32 tuple__sz, struct bpf_ct_opts *opts, u32 opts__sz)
> > )
> > {
> > 
> > }
> > 
> > Thanks,
> > David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ