From: sashiko-bot@kernel.org
To: "Leon Hwang" <leon.hwang@linux.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v13 7/8] libbpf: Add syscall common attributes support for map_create
Date: Tue, 12 May 2026 23:56:29 +0000 [thread overview]
Message-ID: <20260512235629.C5CABC2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260511152817.89191-8-leon.hwang@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing OPTS_VALID() validation for the nested log_opts structure breaks forward compatibility.
--
commit 25b6e95560edf0a2b76e5b2fc840a6200407a730
Author: Leon Hwang <leon.hwang@linux.dev>
libbpf: Add syscall common attributes support for map_create
This commit introduces bpf_log_opts and extends bpf_map_create_opts to
allow users to capture detailed log messages during map creation failures.
It passes these common attributes via the extended sys_bpf_ext_fd() call.
> diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
> --- a/tools/lib/bpf/bpf.c
> +++ b/tools/lib/bpf/bpf.c
[ ... ]
> @@ -242,7 +245,18 @@ int bpf_map_create(enum bpf_map_type map_type,
> attr.excl_prog_hash = ptr_to_u64(OPTS_GET(opts, excl_prog_hash, NULL));
> attr.excl_prog_hash_size = OPTS_GET(opts, excl_prog_hash_size, 0);
>
> - fd = sys_bpf_fd(BPF_MAP_CREATE, &attr, attr_sz);
> + log_opts = OPTS_GET(opts, log_opts, NULL);
> + if (log_opts && feat_supported(NULL, FEAT_BPF_SYSCALL_COMMON_ATTRS)) {
Should there be an OPTS_VALID() check for the nested log_opts structure
before we start extracting its fields?
While the parent opts structure is correctly validated with OPTS_VALID()
at the start of bpf_map_create(), log_opts is a newly introduced option
structure with its own sz field for forward and backward compatibility.
If an application compiled against a future libbpf header passes a
bpf_log_opts struct with new, non-zero fields, wouldn't this silently
ignore those fields instead of returning -EINVAL?
> + memset(&attr_common, 0, attr_common_sz);
> + attr_common.log_buf = ptr_to_u64(OPTS_GET(log_opts, buf, NULL));
> + attr_common.log_size = OPTS_GET(log_opts, size, 0);
> + attr_common.log_level = OPTS_GET(log_opts, level, 0);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260511152817.89191-1-leon.hwang@linux.dev?part=7
next prev parent reply other threads:[~2026-05-12 23:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 15:28 [PATCH bpf-next v13 0/8] bpf: Extend BPF syscall with common attributes support Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 1/8] " Leon Hwang
2026-05-11 16:19 ` bot+bpf-ci
2026-05-11 16:53 ` Alexei Starovoitov
2026-05-12 2:41 ` Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 2/8] libbpf: Add support for extended BPF syscall Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 3/8] bpf: Refactor reporting log_true_size for prog_load Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 4/8] bpf: Add syscall common attributes support " Leon Hwang
2026-05-12 22:18 ` sashiko-bot
2026-05-13 10:44 ` Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 5/8] bpf: Add syscall common attributes support for btf_load Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 6/8] bpf: Add syscall common attributes support for map_create Leon Hwang
2026-05-11 16:19 ` bot+bpf-ci
2026-05-11 17:07 ` Alexei Starovoitov
2026-05-12 2:47 ` Leon Hwang
2026-05-12 23:36 ` sashiko-bot
2026-05-13 10:45 ` Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 7/8] libbpf: " Leon Hwang
2026-05-12 23:56 ` sashiko-bot [this message]
2026-05-13 10:46 ` Leon Hwang
2026-05-11 15:28 ` [PATCH bpf-next v13 8/8] selftests/bpf: Add tests to verify map create failure log Leon Hwang
2026-05-13 0:33 ` sashiko-bot
2026-05-13 10:47 ` Leon Hwang
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=20260512235629.C5CABC2BCB0@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=leon.hwang@linux.dev \
--cc=sashiko-reviews@lists.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