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$(echo .)com \
--cc=alan.maguire@oracle$(echo .)com \
--cc=alexandre.torgue@foss$(echo .)st.com \
--cc=alexei.starovoitov@gmail$(echo .)com \
--cc=andrii@kernel$(echo .)org \
--cc=ast@kernel$(echo .)org \
--cc=benjamin.tissoires@redhat$(echo .)com \
--cc=bpf@vger$(echo .)kernel.org \
--cc=cgroups@vger$(echo .)kernel.org \
--cc=coreteam@netfilter$(echo .)org \
--cc=daniel@iogearbox$(echo .)net \
--cc=davem@davemloft$(echo .)net \
--cc=dsahern@kernel$(echo .)org \
--cc=dxu@dxuuu$(echo .)xyz \
--cc=ebiggers@kernel$(echo .)org \
--cc=edumazet@google$(echo .)com \
--cc=fsverity@lists$(echo .)linux.dev \
--cc=fw@strlen$(echo .)de \
--cc=hannes@cmpxchg$(echo .)org \
--cc=haoluo@google$(echo .)com \
--cc=hawk@kernel$(echo .)org \
--cc=herbert@gondor$(echo .)apana.org.au \
--cc=jikos@kernel$(echo .)org \
--cc=john.fastabend@gmail$(echo .)com \
--cc=kadlec@netfilter$(echo .)org \
--cc=kpsingh@kernel$(echo .)org \
--cc=kuba@kernel$(echo .)org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-input@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-kselftest@vger$(echo .)kernel.org \
--cc=linux-stm32@st-md-mailman$(echo .)stormreply.com \
--cc=linux-trace-kernel@vger$(echo .)kernel.org \
--cc=lizefan.x@bytedance$(echo .)com \
--cc=martin.lau@linux$(echo .)dev \
--cc=mathieu.desnoyers@efficios$(echo .)com \
--cc=mcoquelin.stm32@gmail$(echo .)com \
--cc=memxor@gmail$(echo .)com \
--cc=mhiramat@kernel$(echo .)org \
--cc=mykolal@fb$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=netfilter-devel@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
--cc=pablo@netfilter$(echo .)org \
--cc=quentin@isovalent$(echo .)com \
--cc=rostedt@goodmis$(echo .)org \
--cc=sdf@google$(echo .)com \
--cc=shuah@kernel$(echo .)org \
--cc=song@kernel$(echo .)org \
--cc=steffen.klassert@secunet$(echo .)com \
--cc=tj@kernel$(echo .)org \
--cc=tytso@mit$(echo .)edu \
--cc=yonghong.song@linux$(echo .)dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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