From: Eduard Zingerman <eddyz87@gmail.com>
To: Andrii Nakryiko <andrii@kernel.org>,
bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
martin.lau@kernel.org
Cc: kernel-team@meta.com
Subject: Re: [PATCH v2 bpf 3/5] bpf: enforce types for __arg_ctx-tagged arguments in global subprogs
Date: Thu, 18 Jan 2024 21:50:28 +0200 [thread overview]
Message-ID: <a49d5548efd5766a3b66ef3e6f18bbbc4b1bf677.camel@gmail.com> (raw)
In-Reply-To: <20240117223340.1733595-4-andrii@kernel.org>
On Wed, 2024-01-17 at 14:33 -0800, Andrii Nakryiko wrote:
[...]
> - for kprobes, we always accept `struct pt_regs *`, as that's what
> actually is passed as a context to any kprobe program;
> - for perf_event, we resolve typedefs down to actual struct type and
> accept `struct {pt_regs,user_pt_regs,user_regs_struct} *` if kernel
> architecture actually defines `bpf_user_pt_regs_t` as an alias for
> the corresponding struct;
> otherwise, canonical `struct bpf_perf_event_data *` is expected;
> - for raw_tp/raw_tp.w programs, `u64/long *` are accepted, as that's
> what's expected with BPF_PROG() usage; otherwise, canonical
> `struct bpf_raw_tracepoint_args *` is expected;
> - tp_btf supports both `struct bpf_raw_tracepoint_args *` and `u64 *`
> formats, both are coded as expections as tp_btf is actually a TRACING
> program type, which has no canonical context type;
> - iterator programs accept `struct bpf_iter__xxx *` structs, currently
> with no further iterator-type specific enforcement;
> - fentry/fexit/fmod_ret/lsm/struct_ops all accept `u64 *`;
> - classic tracepoint programs, as well as syscall and freplace
> programs allow any user-provided type.
The "arg:..." rules become quite complex, do you plan to document
these either in kernel rst's or as doc-strings for relevant macros?
[...]
next prev parent reply other threads:[~2024-01-18 19:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 22:33 [PATCH v2 bpf 0/5] Tighten up arg:ctx type enforcement Andrii Nakryiko
2024-01-17 22:33 ` [PATCH v2 bpf 1/5] libbpf: feature-detect arg:ctx tag support in kernel Andrii Nakryiko
2024-01-18 19:50 ` Eduard Zingerman
2024-01-19 0:43 ` Andrii Nakryiko
2024-01-19 0:46 ` Eduard Zingerman
2024-01-17 22:33 ` [PATCH v2 bpf 2/5] bpf: extract bpf_ctx_convert_map logic and make it more reusable Andrii Nakryiko
2024-01-17 22:33 ` [PATCH v2 bpf 3/5] bpf: enforce types for __arg_ctx-tagged arguments in global subprogs Andrii Nakryiko
2024-01-18 19:50 ` Eduard Zingerman [this message]
2024-01-19 0:50 ` Andrii Nakryiko
2024-01-17 22:33 ` [PATCH v2 bpf 4/5] selftests/bpf: add tests confirming type logic in kernel for __arg_ctx Andrii Nakryiko
2024-01-17 22:33 ` [PATCH v2 bpf 5/5] libbpf: warn on unexpected __arg_ctx type when rewriting BTF Andrii Nakryiko
2024-01-18 19:50 ` Eduard Zingerman
2024-01-19 0:53 ` Andrii Nakryiko
2024-01-19 1:00 ` Eduard Zingerman
2024-01-18 19:49 ` [PATCH v2 bpf 0/5] Tighten up arg:ctx type enforcement Eduard Zingerman
2024-01-18 19:53 ` Eduard Zingerman
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=a49d5548efd5766a3b66ef3e6f18bbbc4b1bf677.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@meta.com \
--cc=martin.lau@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