From: Jiri Olsa <olsajiri@gmail.com>
To: Daniel Xu <dxu@dxuuu.xyz>
Cc: Jiri Olsa <olsajiri@gmail.com>,
alexandre.torgue@foss.st.com, benjamin.tissoires@redhat.com,
lizefan.x@bytedance.com, Herbert Xu <herbert@gondor.apana.org.au>,
dsahern@kernel.org, hannes@cmpxchg.org, rostedt@goodmis.org,
mcoquelin.stm32@gmail.com, pablo@netfilter.org,
martin.lau@linux.dev, edumazet@google.com, daniel@iogearbox.net,
ebiggers@kernel.org, yonghong.song@linux.dev,
john.fastabend@gmail.com, hawk@kernel.org,
steffen.klassert@secunet.com, jikos@kernel.org, kuba@kernel.org,
fw@strlen.de, ast@kernel.org, song@kernel.org, pabeni@redhat.com,
shuah@kernel.org, tytso@mit.edu, tj@kernel.org,
kadlec@netfilter.org, davem@davemloft.net, mhiramat@kernel.org,
andrii@kernel.org, alexei.starovoitov@gmail.com,
quentin@isovalent.com, alan.maguire@oracle.com, memxor@gmail.com,
kpsingh@kernel.org, sdf@google.com, haoluo@google.com,
mathieu.desnoyers@efficios.com, mykolal@fb.com,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
fsverity@lists.linux.dev, bpf@vger.kernel.org,
cgroups@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
netdev@vger.kernel.org, netfilter-devel@vger.kernel.org,
coreteam@netfilter.org, linux-kselftest@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH bpf-next v2 3/3] bpf: treewide: Annotate BPF kfuncs in BTF
Date: Sat, 6 Jan 2024 20:10:23 +0100 [thread overview]
Message-ID: <ZZmln7mwvLRjqqRo@krava> (raw)
In-Reply-To: <4tsn6x45gh3vgdst3ozzmxori5gzylvpx6btxue6sbsmx7siok@6wajzdgwxfpa>
On Fri, Jan 05, 2024 at 09:55:43AM -0700, Daniel Xu wrote:
> 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.
right, I was also concerned we could flood console with loading module
that just uses wrong set8.. perhaps we could just use WARN_ON_ONCE with
no additional checks
jirka
next prev parent reply other threads:[~2024-01-06 19:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-05 2:45 [PATCH bpf-next v2 0/3] Annotate kfuncs in .BTF_ids section Daniel Xu
2024-01-05 2:45 ` [PATCH bpf-next v2 3/3] bpf: treewide: Annotate BPF kfuncs in BTF Daniel Xu
2024-01-05 15:11 ` Jiri Olsa
2024-01-05 16:55 ` Daniel Xu
2024-01-06 19:10 ` Jiri Olsa [this message]
2024-01-05 15:19 ` [PATCH bpf-next v2 0/3] Annotate kfuncs in .BTF_ids section Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZZmln7mwvLRjqqRo@krava \
--to=olsajiri@gmail.com \
--cc=alan.maguire@oracle.com \
--cc=alexandre.torgue@foss.st.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=benjamin.tissoires@redhat.com \
--cc=bpf@vger.kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=coreteam@netfilter.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=dxu@dxuuu.xyz \
--cc=ebiggers@kernel.org \
--cc=edumazet@google.com \
--cc=fsverity@lists.linux.dev \
--cc=fw@strlen.de \
--cc=hannes@cmpxchg.org \
--cc=haoluo@google.com \
--cc=hawk@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=jikos@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kadlec@netfilter.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=martin.lau@linux.dev \
--cc=mathieu.desnoyers@efficios.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=memxor@gmail.com \
--cc=mhiramat@kernel.org \
--cc=mykolal@fb.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=quentin@isovalent.com \
--cc=rostedt@goodmis.org \
--cc=sdf@google.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=steffen.klassert@secunet.com \
--cc=tj@kernel.org \
--cc=tytso@mit.edu \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).