From: Jiri Olsa <jolsa@kernel.org>
To: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>
Cc: bpf@vger.kernel.org, Martin KaFai Lau <kafai@fb.com>,
Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@chromium.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>
Subject: [PATCH bpf-next 1/3] bpf: Split btf_id/size union in struct bpf_func_proto
Date: Tue, 8 Nov 2022 23:20:25 +0100 [thread overview]
Message-ID: <20221108222027.3409437-2-jolsa@kernel.org> (raw)
In-Reply-To: <20221108222027.3409437-1-jolsa@kernel.org>
When having helper that defines both arg*_btf_id and arg*_size fields,
one of those fields will end up with zero value.
With helper definition like:
.arg1_type = ARG_PTR_TO_BTF_ID,
.arg1_btf_id = &btf_tracing_ids[BTF_TRACING_TYPE_VMA],
.arg2_type = ARG_PTR_TO_FIXED_SIZE_MEM,
.arg2_size = BUILD_ID_SIZE_MAX,
The arg2_size field initializer zeros out the rest of the arg*_size
fields of its parent annon struct, so it effectively zeros also
arg1_btf_id field.
Moving arg*_btf_id and arg*_size fields into separate unions.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
include/linux/bpf.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 798aec816970..21a1d42b5d4c 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -640,6 +640,8 @@ struct bpf_func_proto {
u32 *arg5_btf_id;
};
u32 *arg_btf_id[5];
+ };
+ union {
struct {
size_t arg1_size;
size_t arg2_size;
--
2.38.1
next prev parent reply other threads:[~2022-11-08 22:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 22:20 [PATCH bpf-next 0/3] bpf: Add bpf_vma_build_id_parse helper Jiri Olsa
2022-11-08 22:20 ` Jiri Olsa [this message]
2022-11-08 22:20 ` [PATCH bpf-next 2/3] " Jiri Olsa
2022-11-09 0:42 ` Alexei Starovoitov
2022-11-09 13:35 ` Jiri Olsa
2022-11-08 22:20 ` [PATCH bpf-next 3/3] selftests/bpf: Add build_id_parse kfunc test 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=20221108222027.3409437-2-jolsa@kernel.org \
--to=jolsa@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=sdf@google.com \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/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