[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZZgcJTdwMZHglPtr@krava>
Date: Fri, 5 Jan 2024 16:11:33 +0100
From: Jiri Olsa <olsajiri@...il.com>
To: Daniel Xu <dxu@...uu.xyz>
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, olsajiri@...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 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
jirka
> +
> hook = bpf_prog_type_to_kfunc_hook(prog_type);
> return __register_btf_kfunc_id_set(hook, kset);
> }
SNIP
Powered by blists - more mailing lists