All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jay Wang <wanjay@amazon.com>
To: <bot+bpf-ci@kernel.org>, <bpf@vger.kernel.org>, <ast@kernel.org>,
	<daniel@iogearbox.net>, <andrii@kernel.org>, <eddyz87@gmail.com>,
	<memxor@gmail.com>
Cc: <alan.maguire@oracle.com>, <martin.lau@linux.dev>,
	<yonghong.song@linux.dev>, <nathan@kernel.org>, <nsc@kernel.org>,
	<linux-kbuild@vger.kernel.org>, <mcgrof@kernel.org>,
	<petr.pavlu@suse.com>, <linux-modules@vger.kernel.org>,
	<arnd@arndb.de>, <linux-kernel@vger.kernel.org>,
	<abuehaze@amazon.com>, <doebel@amazon.de>,
	<jay.wang.upstream@gmail.com>, <martin.lau@kernel.org>,
	<mason@kernel.org>, <ihor.solodrai@linux.dev>
Subject: Re: [PATCH bpf-next 3/6] bpf: fetch the vmlinux BTF where kernel types enter a program
Date: Fri, 25 Sep 2026 23:02:46 +0000	[thread overview]
Message-ID: <20260925230246.33537-1-wanjay@amazon.com> (raw)
In-Reply-To: <39f6151d364d966f70b7802cfd4bbca15734a7945478265ecc681f1779e50abb@mail.kernel.org>

Addressed since v2; the current version is v3 (patch 3/9):
https://lore.kernel.org/bpf/20260925224229.1850-1-wanjay@amazon.com/

Two of these are real gaps in the set of fetch sites and are
fixed:

- bpf_ctx_convert.t: the program context types are kernel types too, and
  btf_prepare_func_args() (global subprogs taking the context) and
  btf_translate_to_vmlinux() (ctx access of tracing/EXT programs) read
  the table without anything having fetched the BTF.  It is now fetched
  in the table's readers.  Tested with a socket filter whose global
  subprogram takes struct __sk_buff * as the first user on a fresh boot.

- bpf_snprintf_btf()/bpf_seq_printf_btf(): the type id travels inside
  struct btf_ptr, so the arg/ret type check does not see it.  The two
  helpers are now named explicitly.  Tested with a raw_tp program
  calling bpf_snprintf_btf() as the first user.

Also addressed:

- The IS_ERR(btf_vmlinux) check in bpf_check() now reads through
  bpf_peek_btf_vmlinux().  With =m a failed parse is not stored (below),
  so it only fires for =y, where the BTF is parsed at boot as before;
  with =m each fetch site reports the failure itself.
- btf_prepare_func_args() and btf_check_kfunc_name() check the result
  of bpf_get_btf_vmlinux() (pre-existing, but cheap).
- A failed parse is no longer cached with =m; the payload was verified
  against the kernel when the module loaded, so a failure there is a
  resource problem and the next caller retries.  =y keeps caching, as
  before: a parse failure there means the build is broken.

Not a bug:

- bpf_verifier_lock vs request_module(): the lock is only taken for
  unprivileged programs, and none of the fetch sites is reachable from
  one: kfuncs, ksyms, map pointer access and the BTF helpers all need
  privileged program types, and the context-type path needs a global
  subprogram, i.e. program BTF, which BPF_BTF_LOAD only accepts with
  CAP_BPF.  modprobe does not load BPF programs.

Jay

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

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23  5:39 [PATCH bpf-next 0/6] 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-23  5:39 ` [PATCH bpf-next 1/6] bpf: pass the vmlinux BTF to btf_parse_module() and let it adopt the data Jay Wang
2026-09-23  5:39 ` [PATCH bpf-next 2/6] bpf: split the kfunc, dtor kfunc and struct_ops registration bodies Jay Wang
2026-09-23  6:16   ` bot+bpf-ci
2026-09-25 23:02     ` Jay Wang
2026-09-23  5:39 ` [PATCH bpf-next 3/6] bpf: fetch the vmlinux BTF where kernel types enter a program Jay Wang
2026-09-23  6:04   ` sashiko-bot
2026-09-25 23:02     ` Jay Wang
2026-09-23  6:28   ` bot+bpf-ci
2026-09-24 11:26     ` Jiri Olsa
2026-09-25 23:02       ` Jay Wang
2026-09-25 23:02     ` Jay Wang [this message]
2026-09-23  5:39 ` [PATCH bpf-next 4/6] bpf: take the vmlinux BTF from the btf_vmlinux module Jay Wang
2026-09-23  5:39 ` [PATCH bpf-next 5/6] bpf: defer registrations until the vmlinux BTF is available Jay Wang
2026-09-23  5:56   ` sashiko-bot
2026-09-25 23:02     ` Jay Wang
2026-09-23  6:41   ` bot+bpf-ci
2026-09-25 23:02     ` Jay Wang
2026-09-23  5:39 ` [PATCH bpf-next 6/6] kbuild, bpf: allow building the vmlinux BTF as a module Jay Wang
2026-09-23  5:59   ` sashiko-bot
2026-09-25 23:02     ` Jay Wang
2026-09-23  8:27 ` [PATCH bpf-next 0/6] bpf: make the vmlinux BTF an on-demand loadable module (CONFIG_DEBUG_INFO_BTF=m) to save ~5.4 MB memory Alan Maguire
2026-09-25 21:23   ` 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=20260925230246.33537-1-wanjay@amazon.com \
    --to=wanjay@amazon.com \
    --cc=abuehaze@amazon.com \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=arnd@arndb.de \
    --cc=ast@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=doebel@amazon.de \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=jay.wang.upstream@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mason@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=memxor@gmail.com \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=petr.pavlu@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.