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 v2 bpf-next 5/7] resolve_btfids: Exclude bpf_*() and __bpf_*() of vmlinux
Date: Thu, 26 Nov 2026 15:26:11 +0000	[thread overview]
Message-ID: <awhPk5btWvLDaDxT@mail.gmail.com> (raw)
In-Reply-To: <94179833c6a4aab3dd44ee9d28f3f25f9e912c027ab41e82c254322c8dea91da@mail.kernel.org>

On 26/11/26 03:01PM, bot+bpf-ci@kernel.org wrote:
> > resolve_btfids: Exclude bpf_*() and __bpf_*() of vmlinux
> 
> TL;DR: Comment and commit message only: the code also excludes _bpf_*() and
> ___bpf_*() names, broader than documented; the review asks to document this,
> citing _bpf_getsockopt().
> 
> > 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
> 
> [ ... ]
> 
> > @@ -105,6 +105,12 @@ static bool excluded_by_name(const char *name)
> >  	return false;
> >  }
> >  
> > +/* bpf_*() and __bpf_*() */
> > +static bool excluded_by_prefix(const char *name, bool vmlinux)
> > +{
> > +	return vmlinux && !strncmp(name + strspn(name, "_"), "bpf_", 4);
> > +}
> 
> This isn't a bug, but the comment and the commit message ("Do not tag
> bpf_*() and __bpf_*() of vmlinux") describe a narrower rule than the code.
> 
> strspn(name, "_") skips any number of leading underscores, so _bpf_*() and
> ___bpf_*() names are excluded as well.  In vmlinux these include
> _bpf_getsockopt(), _bpf_setsockopt(), ___bpf_prog_run() and
> ___bpf_copy_key().
> 
> The broader behaviour looks right, since _bpf_getsockopt() sits on the
> chain the commit is concerned with:
> 
>     BPF_CALL_5(bpf_sk_getsockopt, ...)
>     {
>         return _bpf_getsockopt(sk, level, optname, optval, optlen);
>     }
> 
> If the compiler keeps _bpf_getsockopt() out of line, an fmod_ret skip of it
> would bypass the memset() in __bpf_getsockopt() in the same way.  A later
> change that makes the code match the comment (for example, two strncmp()
> calls for "bpf_" and "__bpf_") would reopen that hole.
> 
> Could the comment and changelog say "bpf_*() after any leading
> underscores", and name _bpf_getsockopt() as a reason?

Yes, it could. Will update it if v3 is needed, otherwise this doesn't look important.

> [ ... ]
> 
> 
> ---
> 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/45839706175


  reply	other threads:[~2026-11-26 15:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 14:29 [PATCH v2 bpf-next 0/7] Do not tag selected functions as fmodret targets Anton Protopopov
2026-11-26 14:29 ` [PATCH v2 bpf-next 1/7] selftests/bpf: Test the tag of vmlinux with do_epoll_create() Anton Protopopov
2026-11-26 14:29 ` [PATCH v2 bpf-next 2/7] resolve_btfids: Do not tag functions which work on BPF objects Anton Protopopov
2026-11-26 14:27   ` sashiko-bot
2026-11-26 14:42     ` Anton Protopopov
2026-11-26 14:29 ` [PATCH v2 bpf-next 3/7] resolve_btfids: Do not tag kfuncs and helpers Anton Protopopov
2026-11-26 14:29 ` [PATCH v2 bpf-next 4/7] resolve_btfids: Exclude a set of functions by name Anton Protopopov
2026-11-26 14:26   ` sashiko-bot
2026-11-26 14:44     ` Anton Protopopov
2026-11-26 14:29 ` [PATCH v2 bpf-next 5/7] resolve_btfids: Exclude bpf_*() and __bpf_*() of vmlinux Anton Protopopov
2026-11-26 15:01   ` bot+bpf-ci
2026-11-26 15:26     ` Anton Protopopov [this message]
2026-11-26 14:29 ` [PATCH v2 bpf-next 6/7] resolve_btfids: Exclude the code of kernel/bpf and of the JIT Anton Protopopov
2026-11-26 14:29 ` [PATCH v2 bpf-next 7/7] selftests/bpf: Test functions which must have no fmod_ret tag Anton Protopopov
2026-11-26 14:27   ` sashiko-bot
2026-11-26 14:48     ` 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=awhPk5btWvLDaDxT@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