From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Anton Protopopov" <a.s.protopopov@gmail.com>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
"Jiri Olsa" <jolsa@kernel.org>,
"Alan Maguire" <almagui@kernel.org>,
"John Fastabend" <john.fastabend@gmail.com>,
<bpf@vger.kernel.org>
Subject: Re: [PATCH v1 bpf-next 3/5] resolve_btfids: Exclude a set of functions by name
Date: Thu, 26 Nov 2026 00:56:39 +0000 [thread overview]
Message-ID: <DN4QFIRN445M.9M05B3SZ7T44@gmail.com> (raw)
In-Reply-To: <20261125212849.868523-4-a.s.protopopov@gmail.com>
On Wed, Nov 25, 2026 at 01:28 PM Anton Protopopov <a.s.protopopov@gmail.com> wrote:
> + "bpf_remove_dentry_xattr_locked",
> + "bpf_set_dentry_xattr_locked",
The bug from the log of patch 2 stays one call below the helper.
bpf_unlocked_sk_getsockopt() has no tag now.
It passes optval, ARG_PTR_TO_UNINIT_MEM, to __bpf_getsockopt():
if (err)
optlen = 0;
if (optlen < saved_optlen)
memset(optval + optlen, 0, saved_optlen - optlen);
return err;
__bpf_getsockopt() is in net/core/filter.c and takes no bpf type.
By the rules in fmodret.c it keeps the tag with -EINVAL.
After a skip the memset() doesn't run and the prog reads its stack.
__bpf_skb_load_bytes() has the same memset() in front of -EFAULT.
can we skip bpf_*() and __bpf_*() of vmlinux by prefix ?
Both *_locked names go away.
Modules stay as they are, bpf_testmod_retval_*() need their tags.
A few lines in fmodret.c on top of patch 5
diff --git a/tools/bpf/resolve_btfids/fmodret.c b/tools/bpf/resolve_btfids/fmodret.c
index 384efb5..18b3fbc 100644
--- a/tools/bpf/resolve_btfids/fmodret.c
+++ b/tools/bpf/resolve_btfids/fmodret.c
@@ -93,8 +93,6 @@ static bool excluded_by_name(const char *name)
static const char *const names[] = {
"copy_from_kernel_nofault",
"aarch64_insn_patch_text_nosync",
- "bpf_remove_dentry_xattr_locked",
- "bpf_set_dentry_xattr_locked",
};
unsigned int i;
@@ -166,7 +164,8 @@ static int read_bpf_code(char ***names, size_t *nr)
static bool is_bpf_code(char **names, size_t nr, const char *name)
{
- return bsearch(&name, names, nr, sizeof(*names), cmp_name);
+ return !strncmp(name + strspn(name, "_"), "bpf_", 4) ||
+ bsearch(&name, names, nr, sizeof(*names), cmp_name);
}
/* Find kfuncs and helpers */
@@ -380,8 +379,8 @@ int fmodret_tag(Elf *elf, struct btf *btf, int verbose)
continue;
if (excluded_by_name(name))
continue;
- /* Skip the code of kernel/bpf and of the JIT */
- if (is_bpf_code(bpf_code, nr_bpf_code, name))
+ /* Skip bpf_*(), __bpf_*() and the code of kernel/bpf and of the JIT */
+ if (!base && is_bpf_code(bpf_code, nr_bpf_code, name))
continue;
nr_scanned++;
err = scan_func(scan, func, &values);
next prev parent reply other threads:[~2026-11-26 0:56 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
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 [this message]
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=DN4QFIRN445M.9M05B3SZ7T44@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=a.s.protopopov@gmail.com \
--cc=almagui@kernel.org \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=memxor@gmail.com \
/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