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, Dave Marchevsky <davemarchevsky@meta.com>
Subject: Re: [PATCH bpf-next 0/8] PTR_TO_BTF_ID arguments in global subprogs
Date: Mon, 08 Jan 2024 00:22:04 +0200 [thread overview]
Message-ID: <cb2d2a2e5f05e9aad0dfef1109fca9022b351e11.camel@gmail.com> (raw)
In-Reply-To: <20240105000909.2818934-1-andrii@kernel.org>
On Thu, 2024-01-04 at 16:09 -0800, Andrii Nakryiko wrote:
> This patch set follows recent changes that added btf_decl_tag-based argument
> annotation support for global subprogs. This time we add ability to pass
> PTR_TO_BTF_ID (BTF-aware kernel pointers) arguments into global subprograms.
> We support explicitly trusted and untrusted arguments. Legacy semi-trusted
> variant is not supported.
>
> Patches #2 through #4 do preparatory refactorings to add support for multiple
> tags per argument. This is important for being able to use modifiers like
> __arg_nonnull together with trusted/untrusted arguments.
>
> Patch #5 is adding the actual __arg_trusted and __arg_untrusted support.
>
> It also raises a question about default nullable vs non-nullable semantics for
> PTR_TO_BTF_ID arguments. It feels like having both __arg_nonnull and
> __arg_nullable would provide the best kind of experience and flexibility, but
> for now we implement nullable by default semantics, as a more conservative
> behavior.
>
> Patch #7 adds bpf_core_cast() helper macro which is a wrapper around
> bpf_rdonly_cast() kfunc, but hides BTF ID manipulations behind more
> user-friendly type argument instead. We utilize this macro in selftests added
> in patch #8.
>
> Patch #8 adds a bunch of positive and negative tests to validate expected
> semantics for various trusted/untrusted + nullable/non-null variants. We also
> make sure that global subprog cannot destroy PTR_TO_BTF_ID, as that would
> wreak havoc in caller program that is not aware of this possibility.
>
> There were proposals to do kernel-side type enforcement for __arg_ctx, let's
> decide whether we should do that and for which program types, and I can
> accommodate the logic in future revisions.
>
> Cc: Dave Marchevsky <davemarchevsky@meta.com>
Full patch-set looks good to me.
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
next prev parent reply other threads:[~2024-01-07 22:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-05 0:09 [PATCH bpf-next 0/8] PTR_TO_BTF_ID arguments in global subprogs Andrii Nakryiko
2024-01-05 0:09 ` [PATCH bpf-next 1/8] selftests/bpf: fix test_loader check message Andrii Nakryiko
2024-01-05 0:09 ` [PATCH bpf-next 2/8] bpf: make sure scalar args don't accept __arg_nonnull tag Andrii Nakryiko
2024-01-05 0:09 ` [PATCH bpf-next 3/8] bpf: prepare btf_prepare_func_args() for multiple tags per argument Andrii Nakryiko
2024-01-05 0:09 ` [PATCH bpf-next 4/8] bpf: support " Andrii Nakryiko
2024-01-05 0:09 ` [PATCH bpf-next 5/8] bpf: add __arg_trusted and __arg_untrusted global func tags Andrii Nakryiko
2024-01-12 2:05 ` Alexei Starovoitov
2024-01-12 18:43 ` Andrii Nakryiko
2024-01-05 0:09 ` [PATCH bpf-next 6/8] libbpf: add __arg_trusted and __arg_untrusted annotation macros Andrii Nakryiko
2024-01-05 0:09 ` [PATCH bpf-next 7/8] libbpf: add bpf_core_cast() macro Andrii Nakryiko
2024-01-05 0:09 ` [PATCH bpf-next 8/8] selftests/bpf: add trusted/untrusted global subprog arg tests Andrii Nakryiko
2024-01-07 22:22 ` Eduard Zingerman [this message]
2024-01-12 2:40 ` [PATCH bpf-next 0/8] PTR_TO_BTF_ID arguments in global subprogs patchwork-bot+netdevbpf
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=cb2d2a2e5f05e9aad0dfef1109fca9022b351e11.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=davemarchevsky@meta.com \
--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 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.