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: <4tsn6x45gh3vgdst3ozzmxori5gzylvpx6btxue6sbsmx7siok@6wajzdgwxfpa>
Date: Fri, 5 Jan 2024 09:55:43 -0700
From: Daniel Xu <dxu@...uu.xyz>
To: Jiri Olsa <olsajiri@...il.com>
Cc: alexandre.torgue@...s.st.com, benjamin.tissoires@...hat.com,
 	lizefan.x@...edance.com, Herbert Xu <herbert@...dor.apana.org.au>,
 dsahern@...nel.org, 	hannes@...xchg.org, rostedt@...dmis.org,
 mcoquelin.stm32@...il.com, 	pablo@...filter.org, martin.lau@...ux.dev,
 edumazet@...gle.com, daniel@...earbox.net, 	ebiggers@...nel.org,
 yonghong.song@...ux.dev, john.fastabend@...il.com, 	hawk@...nel.org,
 steffen.klassert@...unet.com, jikos@...nel.org, kuba@...nel.org,
 	fw@...len.de, ast@...nel.org, song@...nel.org, pabeni@...hat.com,
 	shuah@...nel.org, tytso@....edu, tj@...nel.org, kadlec@...filter.org,
 	davem@...emloft.net, mhiramat@...nel.org, andrii@...nel.org,
 	alexei.starovoitov@...il.com, quentin@...valent.com,
 alan.maguire@...cle.com, memxor@...il.com, 	kpsingh@...nel.org,
 sdf@...gle.com, haoluo@...gle.com, 	mathieu.desnoyers@...icios.com,
 mykolal@...com, linux-input@...r.kernel.org,
 	linux-kernel@...r.kernel.org, fsverity@...ts.linux.dev,
 bpf@...r.kernel.org, 	cgroups@...r.kernel.org,
 linux-trace-kernel@...r.kernel.org, netdev@...r.kernel.org,
 	netfilter-devel@...r.kernel.org, coreteam@...filter.org,
 linux-kselftest@...r.kernel.org,
 	linux-stm32@...md-mailman.stormreply.com,
 linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH bpf-next v2 3/3] bpf: treewide: Annotate BPF kfuncs in BTF

On Fri, Jan 05, 2024 at 04:11:33PM +0100, Jiri Olsa wrote:
> On Thu, Jan 04, 2024 at 07:45:49PM -0700, Daniel Xu wrote:
> 
> SNIP
> 
> > diff --git a/fs/verity/measure.c b/fs/verity/measure.c
> > index bf7a5f4cccaf..3969d54158d1 100644
> > --- a/fs/verity/measure.c
> > +++ b/fs/verity/measure.c
> > @@ -159,9 +159,9 @@ __bpf_kfunc int bpf_get_fsverity_digest(struct file *file, struct bpf_dynptr_ker
> >  
> >  __bpf_kfunc_end_defs();
> >  
> > -BTF_SET8_START(fsverity_set_ids)
> > +BTF_KFUNCS_START(fsverity_set_ids)
> >  BTF_ID_FLAGS(func, bpf_get_fsverity_digest, KF_TRUSTED_ARGS)
> > -BTF_SET8_END(fsverity_set_ids)
> > +BTF_KFUNCS_END(fsverity_set_ids)
> >  
> >  static int bpf_get_fsverity_digest_filter(const struct bpf_prog *prog, u32 kfunc_id)
> >  {
> > diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> > index 51e8b4bee0c8..8cc718f37a9d 100644
> > --- a/kernel/bpf/btf.c
> > +++ b/kernel/bpf/btf.c
> > @@ -7802,6 +7802,10 @@ int register_btf_kfunc_id_set(enum bpf_prog_type prog_type,
> >  {
> >  	enum btf_kfunc_hook hook;
> >  
> > +	/* All kfuncs need to be tagged as such in BTF */
> > +	if (WARN_ON(!(kset->set->flags & BTF_SET8_KFUNCS)))
> > +		return -EINVAL;
> 
> having the warning for module with wrong set8 flags seems wrong to me,
> I think we should trigger the warn only for kernel calls.. by adding
> kset->owner check in the condition above

Just checking:

The reasoning is that =m and out-of-tree modules can and should check
return code, right?

And =y modules or vmlinux-based registrations do not check return code,
so WARN() is necessary?

If so, I'd agree.

[..]

Thanks,
Daniel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ