bpf_unlocked_sk_getsockopt() has no tag, but it passes optval, an ARG_PTR_TO_UNINIT_MEM buffer, to __bpf_getsockopt(). That one clears the buffer on an error. It takes no BPF type and is in net/core, so it keeps its tag. After a skip the program reads its stack. __bpf_skb_load_bytes() has the same memset() before -EFAULT. Do not tag bpf_*() and __bpf_*() of vmlinux. This also covers bpf_set_dentry_xattr_locked() and bpf_remove_dentry_xattr_locked(), kfuncs without the "bpf_kfunc" tag: specialize_kfunc() calls them instead of the kfuncs without _locked. The functions of modules keep their tags, the selftests need bpf_testmod_retval_*(). Signed-off-by: Anton Protopopov --- tools/bpf/resolve_btfids/fmodret.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/bpf/resolve_btfids/fmodret.c b/tools/bpf/resolve_btfids/fmodret.c index b425208702b4..d2d4db1ca3d5 100644 --- 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); +} + /* Find kfuncs and helpers */ static bool *find_bpf_funcs(const struct btf *btf) { @@ -310,6 +316,8 @@ int fmodret_tag(Elf *elf, struct btf *btf, int verbose) continue; if (excluded_by_name(name)) continue; + if (excluded_by_prefix(name, !base)) + continue; nr_scanned++; err = scan_func(scan, func, &values); if (err == -EINVAL) { -- 2.43.0