From: sashiko-bot@kernel.org
To: "Alan Maguire" <alan.maguire@oracle.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH v2 bpf-next 3/8] libbpf: Add feature for kernel extended vlen/kind support
Date: Thu, 16 Apr 2026 20:01:47 +0000 [thread overview]
Message-ID: <20260416200147.900AAC2BCAF@smtp.kernel.org> (raw)
In-Reply-To: <20260416143904.1220662-4-alan.maguire@oracle.com>
Sashiko AI review found 1 potential issue(s):
- [High] Feature probe `probe_kern_btf_vlen_kind_extended` is malformed and always fails, breaking extended BTF support.
--
commit 45c7cfd438137b97d67612513eb9d60104376b8f
Author: Alan Maguire <alan.maguire@oracle.com>
libbpf: Add feature for kernel extended vlen/kind support
This commit adds a feature check for kernel extended vlen/kind support, and
rejects BTF that uses extended vlens/kinds if the kernel does not support it.
> diff --git a/tools/lib/bpf/features.c b/tools/lib/bpf/features.c
> index 4f19a0d79b0cf..f835931f4afe7 100644
> --- a/tools/lib/bpf/features.c
> +++ b/tools/lib/bpf/features.c
[ ... ]
> +static int probe_kern_btf_vlen_kind_extended(int token_fd)
> +{
> + static const char strs[] = "\0int\0foo\0bar";
> + __u32 types[EXTEND_TYPE_LEN] = {
> + /* int */
> + BTF_TYPE_INT_ENC(1, BTF_INT_SIGNED, 0, 32, 4),
> + /* var */
> + BTF_TYPE_ENC(5 /* "foo" */, BTF_INFO_ENC(BTF_KIND_VAR, 0, 0), 1),
Is this BTF_KIND_VAR type missing its required trailing struct btf_var
payload? Without it, the kernel's BTF parser might become misaligned
and reject the entire raw BTF payload.
> + /* datasec */
> + BTF_TYPE_ENC(9 /* "bar" */, BTF_INFO_ENC(BTF_KIND_DATASEC, EXTEND_VLEN, 0), 0),
Looking at BTF_INFO_ENC(kind, kflag, vlen), it appears EXTEND_VLEN is being
passed as the kflag argument rather than vlen. This leaves vlen as 0 and
sets the kflag bit. Could the kernel's btf_datasec_check_meta() reject this?
Additionally, the size argument to BTF_TYPE_ENC here is 0. Will the kernel
reject this DATASEC type since a zero size usually returns -EINVAL?
Finally, if vlen evaluates to 0, will the appended EXTEND_VLEN
btf_var_secinfo structures below be parsed by the kernel as independent
trailing BTF types? If the first struct evaluates to BTF_KIND_UNKN, the
entire probe might fail unconditionally.
> + };
> + struct btf_var_secinfo *s;
> + __u32 *types_data;
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260416143904.1220662-1-alan.maguire@oracle.com?part=3
next prev parent reply other threads:[~2026-04-16 20:01 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 14:38 [PATCH v2 bpf-next 0/8] bpf: Extend BTF UAPI vlen, kinds to use unused bits Alan Maguire
2026-04-16 14:38 ` [PATCH v2 bpf-next 1/8] " Alan Maguire
2026-04-16 15:54 ` Alexei Starovoitov
2026-04-16 19:05 ` sashiko-bot
2026-04-16 14:38 ` [PATCH v2 bpf-next 2/8] libbpf: Adjust btf_vlen() to return a __u32 Alan Maguire
2026-04-16 15:27 ` bot+bpf-ci
2026-04-16 19:36 ` sashiko-bot
2026-04-16 14:38 ` [PATCH v2 bpf-next 3/8] libbpf: Add feature for kernel extended vlen/kind support Alan Maguire
2026-04-16 15:27 ` bot+bpf-ci
2026-04-16 15:56 ` Alexei Starovoitov
2026-04-16 16:08 ` Alan Maguire
2026-04-16 20:01 ` sashiko-bot [this message]
2026-04-16 14:39 ` [PATCH v2 bpf-next 4/8] bpftool: Support 24-bit vlen Alan Maguire
2026-04-16 15:15 ` bot+bpf-ci
2026-04-16 14:39 ` [PATCH v2 bpf-next 5/8] selftests/bpf: Test BTF sanitization rejection for invalid vlen Alan Maguire
2026-04-16 15:27 ` bot+bpf-ci
2026-04-16 20:20 ` sashiko-bot
2026-04-16 14:39 ` [PATCH v2 bpf-next 6/8] selftests/bpf: Fix up btf/invalid test for extended kind Alan Maguire
2026-04-16 14:39 ` [PATCH v2 bpf-next 7/8] selftests/bpf: Fix up __u16 vlen assumptions Alan Maguire
2026-04-16 20:32 ` sashiko-bot
2026-04-16 14:39 ` [PATCH v2 bpf-next 8/8] Documentation/bpf: Update btf doc with updated vlen, kind sizes Alan Maguire
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=20260416200147.900AAC2BCAF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alan.maguire@oracle.com \
--cc=bpf@vger.kernel.org \
--cc=sashiko@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