From: Jiri Olsa <olsajiri@gmail.com>
To: Yingke Xiao <inkxiao12@gmail.com>
Cc: bpf@vger.kernel.org, Trond Myklebust <trondmy@kernel.org>,
anna@kernel.org, linux-nfs@vger.kernel.org,
steffen.klassert@secunet.com, herbert@gondor.apana.org.au,
ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH bpf v2 1/3] bpf: Replace DECLARE_EVENT_CLASS names in raw_tp_null_args[]
Date: Thu, 19 Nov 2026 21:05:47 +0100 [thread overview]
Message-ID: <av9Wm6HQ-DIgFhfw@krava> (raw)
In-Reply-To: <CAMcAce-ytH2Xt_0+1fKXzxy+a8fi0Md-4SSoLZ1RQxKQoLq-tw@mail.gmail.com>
On Thu, Nov 19, 2026 at 02:18:29AM -0500, Yingke Xiao wrote:
> btf_ctx_access() strips the "btf_trace_" prefix from attach_btf_id
> and matches tname with strcmp(tname, raw_tp_null_args[i].func). Because
> each attachable tracepoint typedef corresponds to a DEFINE_EVENT() name
> rather than its DECLARE_EVENT_CLASS() template, three existing entries
> in raw_tp_null_args[] never match any program:
>
> 1. "nfs4_inode_callback_event" and "nfs4_inode_stateid_callback_event"
> are DECLARE_EVENT_CLASS templates in fs/nfs/nfs4trace.h whose
> DEFINE_EVENT instances are nfs4_cb_getattr (:1455) and
> nfs4_cb_recall (:1518). fs/nfs/callback_proc.c:50,106 pass literal
> NULL for arg 2 (const struct inode *inode), and TP_fast_assign
> (:1424, :1481) checks !IS_ERR_OR_NULL(inode). Keeping 0x200
> (0x2ULL << (2 * 4)) sets ptr_err_raw_tp = true so btf_ctx_access()
> assigns SCALAR_VALUE to ctx[2], rejecting any pointer dereference
> even under if (inode) and matching existing raw_tp_null_args[]
> 0x2-nibble convention (0x300 yields the identical SCALAR_VALUE).
>
> 2. "iptfs_ingress_postq_event" is the DECLARE_EVENT_CLASS template in
> net/xfrm/trace_iptfs.h:108 whose DEFINE_EVENT instances (:130-148)
> are iptfs_first_dequeue, iptfs_first_fragmenting,
> iptfs_first_final_fragment, and iptfs_first_toobig.
> net/xfrm/xfrm_iptfs.c:2025 and :2051 pass literal NULL for arg 3
> (struct iphdr *iph), requiring mask 0x1000 (PTR_MAYBE_NULL).
>
> Replace these dead template names with their DEFINE_EVENT tracepoints.
> Verified in QEMU on x86_64 7.4.0-rc3 (iptfs_first_{fragmenting,
> final_fragment} and nfs4_cb_{getattr,recall} flip from LOADED to
> REJECTED) and 6.12.118 (nfs4_cb_{getattr,recall} flip from LOADED to
> REJECTED; iptfs_first_* absent in 6.12).
>
> Fixes: c83e2d970bae ("bpf: Add tracepoints with null-able arguments")
> Cc: stable@vger.kernel.org # 6.12+ (nfs4_cb_*)
> Signed-off-by: Yingke Xiao <inkxiao12@gmail.com>
> ---
> v1 -> v2:
> - Correct sender identity and Signed-off-by with real legal name per DCO.
> - Remove drafting notes.
> - No functional code changes.
>
> kernel/bpf/btf.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
patch is mangled/broken, can't apply it (check Documentation/process/email-clients.rst)
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index a123456..b234567 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -6605,10 +6605,13 @@ static const struct bpf_raw_tp_null_args
> raw_tp_null_args[] = {
> { "bcache_journal_entry_close", 0x20 },
> { "bch2_journal_entry_close", 0x20 },
> { "fsnotify_bump_event_seq", 0x20 },
> - { "nfs4_inode_callback_event", 0x200 },
> - { "nfs4_inode_stateid_callback_event", 0x200 },
> + { "nfs4_cb_getattr", 0x200 },
> + { "nfs4_cb_recall", 0x200 },
seems correct
> { "nilfs2_transaction_entry", 0x4 },
> - { "iptfs_ingress_postq_event", 0x1000 },
> + { "iptfs_first_dequeue", 0x1000 },
> + { "iptfs_first_fragmenting", 0x1000 },
> + { "iptfs_first_final_fragment", 0x1000 },
> + { "iptfs_first_toobig", 0x1000 },
llm says:
▎ Only iptfs_first_fragmenting and iptfs_first_final_fragment pass NULL
▎ for iph (net/xfrm/xfrm_iptfs.c:2024, :2050). iptfs_first_dequeue and
▎ iptfs_first_toobig always pass ip_hdr(skb). Since the old class entry
▎ never matched, adding those two would start rejecting existing
▎ programs that use iph without a NULL check, even though it can't be
▎ NULL there. Should we add only the two NULL-passing events?
jirka
> };
>
> static bool is_raw_tp_null_arg(const struct bpf_raw_tp_null_args *entry,
> --
> 2.43.0
>
prev parent reply other threads:[~2026-11-19 20:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 7:18 [PATCH bpf v2 1/3] bpf: Replace DECLARE_EVENT_CLASS names in raw_tp_null_args[] Yingke Xiao
2026-11-19 20:05 ` Jiri Olsa [this message]
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=av9Wm6HQ-DIgFhfw@krava \
--to=olsajiri@gmail.com \
--cc=andrii@kernel.org \
--cc=anna@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=herbert@gondor.apana.org.au \
--cc=inkxiao12@gmail.com \
--cc=linux-nfs@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
--cc=trondmy@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