BPF List
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: bot+bpf-ci@kernel.org, bpf@vger.kernel.org
Cc: ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net,
	eddyz87@gmail.com, kernel-team@fb.com, martin.lau@kernel.org,
	clm@meta.com, ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v2 04/10] bpf: Let the by-value struct walk take the kinds of member it accepts
Date: Wed, 26 Aug 2026 10:39:47 -0700	[thread overview]
Message-ID: <e6a62d02-2584-474b-9e07-8755a2ebf19d@linux.dev> (raw)
In-Reply-To: <bc4461d9d023911ce4c56de3c9cc73e93f1a4091511aa7bb77dc279a4b855239@mail.kernel.org>



On 8/25/26 2:59 PM, bot+bpf-ci@kernel.org wrote:
>> bpf: Let the by-value struct walk take the kinds of member it accepts
>>
>>      Use btf_struct_is_composed_of() instead of btf_type_is_scalar_struct() in
>>      btf.c so in the future, non scalar member (e.g. arena pointer) can be
>>      supported as well. There is no functional change.
>>
>>      Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
> This isn't a bug, but the changelog only describes the one-line call swap
> in btf.c, while two other parts of the diff are what the "no functional
> change" claim rests on.
>
> The first is a new enumeration in a global header:
>
>> diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
>> +/* Kinds of member a by-value struct or union may be composed of. */
>> +enum btf_member_kind {
>> +	BTF_MEMBER_SCALAR	= BIT(0), /* an int or an enum, or an array of them */
>> +	BTF_MEMBER_ARENA_PTR	= BIT(1), /* a pointer carrying the "arena" type tag */
>> +};
> The second is the array-member branch of the walk losing its trailing
> continue and falling through into the shared kind check:
>
>> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
>>   			member_type = btf_type_skip_modifiers(btf, array->type, NULL);
>> -			if (!btf_type_is_scalar(member_type))
>> -				return false;
>> -			continue;
>>   		}
>> -		if (!btf_type_is_scalar(member_type))
>> +		if (!btf_member_kind_allowed(btf, member_type, member_kinds))
>>   			return false;
> Equivalence here holds because btf_member_kind_allowed() collapses to
> btf_type_is_scalar() when the mask is BTF_MEMBER_SCALAR alone, and because
> the shared check is the last statement of the for_each_member() body, so no
> member is skipped or checked twice.
>
> Would it help to mention the new enum btf_member_kind in bpf_verifier.h and
> this array-branch fall-through in the changelog, since those are what the
> "no functional change" claim rests on?

New enum btf_member_kind is self explanable in the code.
In the commit message, I will explain array-branch fall-through thing.

>
>
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
>
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/32899532405


  reply	other threads:[~2026-08-26 17:39 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25 20:54 [PATCH bpf-next v2 00/10] bpf: Allow arena pointers in by-value returns Yonghong Song
2026-08-25 20:54 ` [PATCH bpf-next v2 01/10] bpf: Record each half of a paired return value in verifier diagnostics Yonghong Song
2026-08-25 21:59   ` bot+bpf-ci
2026-08-26 17:08     ` Yonghong Song
2026-08-25 20:54 ` [PATCH bpf-next v2 02/10] bpf: Drop the recursion depth argument of btf_type_is_scalar_struct() Yonghong Song
2026-08-25 20:54 ` [PATCH bpf-next v2 03/10] bpf: Add btf_type_is_arena_ptr() Yonghong Song
2026-08-25 21:59   ` bot+bpf-ci
2026-08-26 17:28     ` Yonghong Song
2026-08-25 20:54 ` [PATCH bpf-next v2 04/10] bpf: Let the by-value struct walk take the kinds of member it accepts Yonghong Song
2026-08-25 21:59   ` bot+bpf-ci
2026-08-26 17:39     ` Yonghong Song [this message]
2026-08-25 20:54 ` [PATCH bpf-next v2 05/10] bpf: Report which member makes a kfunc return type unsupported Yonghong Song
2026-08-25 21:59   ` bot+bpf-ci
2026-08-26 17:59     ` Yonghong Song
2026-08-25 20:54 ` [PATCH bpf-next v2 06/10] bpf: Allow a global function to return arena pointers by value Yonghong Song
2026-08-25 21:12   ` sashiko-bot
2026-08-26 18:40     ` Yonghong Song
2026-08-25 20:54 ` [PATCH bpf-next v2 07/10] bpf: Allow arena pointers in a by-value kfunc return Yonghong Song
2026-08-25 22:13   ` bot+bpf-ci
2026-08-26 18:57     ` Yonghong Song
2026-08-25 20:54 ` [PATCH bpf-next v2 08/10] selftests/bpf: Check the member named for an unsupported kfunc return type Yonghong Song
2026-08-25 20:54 ` [PATCH bpf-next v2 09/10] selftests/bpf: Test global functions returning arena pointers by value Yonghong Song
2026-08-25 21:59   ` bot+bpf-ci
2026-08-27  3:46     ` Yonghong Song
2026-08-25 20:55 ` [PATCH bpf-next v2 10/10] selftests/bpf: Test kfuncs " Yonghong Song
2026-08-25 21:59   ` bot+bpf-ci
2026-08-27  3:58     ` Yonghong Song

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=e6a62d02-2584-474b-9e07-8755a2ebf19d@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=clm@meta.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@kernel.org \
    /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