Linux Modules
 help / color / mirror / Atom feed
From: Jay Wang <wanjay@amazon.com>
To: <sashiko-bot@kernel.org>
Cc: <bpf@vger.kernel.org>, <linux-modules@vger.kernel.org>
Subject: Re: [PATCH bpf-next v2 3/9] bpf: fetch the vmlinux BTF where kernel types enter a program
Date: Fri, 25 Sep 2026 23:02:50 +0000	[thread overview]
Message-ID: <20260925230250.34259-1-wanjay@amazon.com> (raw)
In-Reply-To: <20260925214242.367201F000FF@smtp.kernel.org>

No change for this in v3:
https://lore.kernel.org/bpf/20260925224229.1850-1-wanjay@amazon.com/

This cannot be reached with btf_vmlinux NULL.  In check_reg_type(), for
ARG_PTR_TO_BTF_ID and ARG_PTR_TO_BTF_ID_SOCK_COMMON without meta->btf,
arg_btf is only used when the register is PTR_TO_BTF_ID; a PTR_TO_SOCKET,
PTR_TO_SOCK_COMMON or PTR_TO_TCP_SOCK argument breaks out before it.  A
PTR_TO_BTF_ID register only comes from a place that has loaded the
vmlinux BTF: attach_btf, kfunc returns, BTF-typed helper returns, map
pointer access, the program context types, kptrs (bpf_find_btf_id()
fetches it), or a ksym.

The ldimm64 case in the report needs a module BTF fd, and with =m a
module BTF only gets an id once the vmlinux BTF is published:
bpf_get_btf_vmlinux() does smp_store_release(&btf_vmlinux) before
btf_parse_deferred_modules() parses and registers the modules kept
until then, and a module loaded afterwards is parsed against the
published vmlinux BTF.  So a program holding a module BTF implies a
non-NULL btf_vmlinux.

Matching ARG_PTR_TO_BTF_ID_SOCK_COMMON in helper_uses_vmlinux_btf()
would load the vmlinux BTF for every tc, XDP and sk_lookup program that
calls bpf_sk_release() on a socket from bpf_sk_lookup_*(), which never
touches kernel BTF, so the series leaves it out.

Jay

  reply	other threads:[~2026-09-25 23:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 21:13 [PATCH bpf-next v2 0/9] bpf: make the vmlinux BTF an on-demand loadable module (CONFIG_DEBUG_INFO_BTF=m) to save ~5.4 MB memory Jay Wang
2026-09-25 21:13 ` [PATCH bpf-next v2 1/9] bpf: pass the vmlinux BTF to btf_parse_module() and let it adopt the data Jay Wang
2026-09-25 21:13 ` [PATCH bpf-next v2 2/9] bpf: split the kfunc, dtor kfunc and struct_ops registration bodies Jay Wang
2026-09-25 21:13 ` [PATCH bpf-next v2 3/9] bpf: fetch the vmlinux BTF where kernel types enter a program Jay Wang
2026-09-25 21:42   ` sashiko-bot
2026-09-25 23:02     ` Jay Wang [this message]
2026-09-25 21:13 ` [PATCH bpf-next v2 4/9] bpf: take the vmlinux BTF from the btf_vmlinux module Jay Wang
2026-09-25 21:13 ` [PATCH bpf-next v2 5/9] bpf: defer vmlinux kfunc and struct_ops registrations Jay Wang
2026-09-25 21:13 ` [PATCH bpf-next v2 6/9] bpf: keep module BTF until the vmlinux BTF is available Jay Wang
2026-09-25 21:29   ` sashiko-bot
2026-09-25 23:02     ` Jay Wang
2026-09-25 21:13 ` [PATCH bpf-next v2 7/9] bpf: expose deferred .BTF.base module BTF in sysfs from module load Jay Wang
2026-09-25 21:13 ` [PATCH bpf-next v2 8/9] bpf, trace, net: prepare CONFIG_DEBUG_INFO_BTF checks for a tristate Jay Wang
2026-09-25 21:13 ` [PATCH bpf-next v2 9/9] kbuild, bpf: allow building the vmlinux BTF as a module Jay Wang
2026-09-25 21:33   ` sashiko-bot
2026-09-25 23:02     ` Jay Wang

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=20260925230250.34259-1-wanjay@amazon.com \
    --to=wanjay@amazon.com \
    --cc=bpf@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=sashiko-bot@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