BPF List
 help / color / mirror / Atom feed
From: Anton Protopopov <a.s.protopopov@gmail.com>
To: bot+bpf-ci@kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	eddyz87@gmail.com, memxor@gmail.com, jolsa@kernel.org,
	almagui@kernel.org, john.fastabend@gmail.com,
	bpf@vger.kernel.org, martin.lau@kernel.org,
	yonghong.song@linux.dev, mason@kernel.org,
	ihor.solodrai@linux.dev
Subject: Re: [PATCH v1 bpf-next 1/5] resolve_btfids: Do not tag functions which work on BPF objects
Date: Thu, 26 Nov 2026 10:49:31 +0000	[thread overview]
Message-ID: <awgOu2UooYkkRoUN@mail.gmail.com> (raw)
In-Reply-To: <60e66815fcf2117a391927fc894fca80573a652ac302d35b2d680ee6f401dfae@mail.kernel.org>

On 26/11/25 10:14PM, bot+bpf-ci@kernel.org wrote:
> > resolve_btfids: Do not tag functions which work on BPF objects
> 
> TL;DR: Test issue: skipping bpf_* parameter types likely leaves vmlinux
> bpf_dummy_reg() untagged, so the tag_of_vmlinux selftest may no longer test
> anything and its comment is stale.
> 
> > diff --git a/tools/bpf/resolve_btfids/fmodret.c b/tools/bpf/resolve_btfids/fmodret.c
> > --- a/tools/bpf/resolve_btfids/fmodret.c
> > +++ b/tools/bpf/resolve_btfids/fmodret.c
> 
> [ ... ]
> 
> > @@ -220,6 +251,9 @@ int fmodret_tag(Elf *elf, struct btf *btf, int verbose)
> >  		size = int_return_size(btf, t);
> >  		if ((size != 4 && size != 8) || !fits_trampoline(btf, t))
> >  			continue;
> > +		/* Skip functions which take or return BPF objects */
> > +		if (has_bpf_types(btf, t))
> > +			continue;
> >  		/* Init code is gone before a program can attach */
> >  		name = btf__name_by_offset(btf, t->name_off);
> >  		func = image_func(&img, name);
> 
> This isn't a bug, but does this change leave the tag_of_vmlinux subtest
> without anything to test?
> 
> In tools/testing/selftests/bpf/progs/fmodret_retval.c:
> 
>     /*
>      * vmlinux has a bpf_dummy_reg() of the same type, so the two share the
>      * FUNC of vmlinux. That one returns an error and has a tag. This one
>      * returns only 0.
>      */
>     SEC("fmod_ret/bpf_testmod:bpf_dummy_reg")
>     __failure __msg("bpf_dummy_reg() is not modifiable")
>     int BPF_PROG(tag_of_vmlinux, void *kdata, struct bpf_link *link, int ret)
> 
> The vmlinux function is:
> 
>     static int bpf_dummy_reg(void *kdata, struct bpf_link *link)
>     {
>             return -EOPNOTSUPP;
>     }
> 
> Its second parameter is a pointer to struct bpf_link, so is_bpf_type()
> follows the pointer, matches the "bpf_" prefix, and has_bpf_types() returns
> true.  fmodret_tag() then no longer emits "bpf_fmodret_retval:-95" for the
> vmlinux bpf_dummy_reg().
> 
> The subtest exists to show that the verifier does not use the vmlinux tag
> for the module function.  With no vmlinux tag left, the program is rejected
> with "bpf_dummy_reg() is not modifiable" regardless of which BTF the lookup
> searches, so a later change that made btf_find_func_tag_value() also search
> base BTF would leave this test passing.  The comment "That one returns an
> error and has a tag" is also no longer true.
> 
> None of the later patches in the series touch progs/fmodret_retval.c, and
> prog_tests/fmodret_untagged.c does not cover this case.
> 
> Would a pair of same-named vmlinux and module functions with the same
> prototype, where the vmlinux one is still tagged, restore the coverage?
> Otherwise should the subtest and its comment be updated or removed?

Thanks robot. I will change the selftest to use another function.

> 
> ---
> 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/45706808075


  reply	other threads:[~2026-11-26 10:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 21:28 [PATCH v1 bpf-next 0/5] Do not tag selected functions as fmodret targets Anton Protopopov
2026-11-25 21:28 ` [PATCH v1 bpf-next 1/5] resolve_btfids: Do not tag functions which work on BPF objects Anton Protopopov
2026-11-25 21:25   ` sashiko-bot
2026-11-26 10:50     ` Anton Protopopov
2026-11-25 22:14   ` bot+bpf-ci
2026-11-26 10:49     ` Anton Protopopov [this message]
2026-11-25 21:28 ` [PATCH v1 bpf-next 2/5] resolve_btfids: Do not tag kfuncs and helpers Anton Protopopov
2026-11-25 21:28 ` [PATCH v1 bpf-next 3/5] resolve_btfids: Exclude a set of functions by name Anton Protopopov
2026-11-25 21:57   ` bot+bpf-ci
2026-11-26  0:55   ` Alexei Starovoitov
2026-11-26  0:56   ` Alexei Starovoitov
2026-11-26 11:29     ` Anton Protopopov
2026-11-25 21:28 ` [PATCH v1 bpf-next 4/5] resolve_btfids: Exclude the code of kernel/bpf and of the JIT Anton Protopopov
2026-11-25 22:15   ` bot+bpf-ci
2026-11-26  0:53   ` Alexei Starovoitov
2026-11-26 13:18     ` Anton Protopopov
2026-11-25 21:28 ` [PATCH v1 bpf-next 5/5] selftests/bpf: Test functions which must have no fmod_ret tag Anton Protopopov

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=awgOu2UooYkkRoUN@mail.gmail.com \
    --to=a.s.protopopov@gmail.com \
    --cc=almagui@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=mason@kernel.org \
    --cc=memxor@gmail.com \
    --cc=yonghong.song@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