From: David Vernet <void@manifault.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: davem@davemloft.net, daniel@iogearbox.net, andrii@kernel.org,
martin.lau@kernel.org, davemarchevsky@meta.com, tj@kernel.org,
memxor@gmail.com, netdev@vger.kernel.org, bpf@vger.kernel.org,
kernel-team@fb.com
Subject: Re: [PATCH v5 bpf-next 6/6] bpf: Refactor RCU enforcement in the verifier.
Date: Fri, 3 Mar 2023 08:22:52 -0600 [thread overview]
Message-ID: <ZAICvFGmh2ykz9Bi@maniforge> (raw)
In-Reply-To: <20230303041446.3630-7-alexei.starovoitov@gmail.com>
On Thu, Mar 02, 2023 at 08:14:46PM -0800, Alexei Starovoitov wrote:
> From: Alexei Starovoitov <ast@kernel.org>
>
> bpf_rcu_read_lock/unlock() are only available in clang compiled kernels. Lack
> of such key mechanism makes it impossible for sleepable bpf programs to use RCU
> pointers.
>
> Allow bpf_rcu_read_lock/unlock() in GCC compiled kernels (though GCC doesn't
> support btf_type_tag yet) and allowlist certain field dereferences in important
> data structures like tast_struct, cgroup, socket that are used by sleepable
> programs either as RCU pointer or full trusted pointer (which is valid outside
> of RCU CS). Use BTF_TYPE_SAFE_RCU and BTF_TYPE_SAFE_TRUSTED macros for such
> tagging. They will be removed once GCC supports btf_type_tag.
>
> With that refactor check_ptr_to_btf_access(). Make it strict in enforcing
> PTR_TRUSTED and PTR_UNTRUSTED while deprecating old PTR_TO_BTF_ID without
> modifier flags. There is a chance that this strict enforcement might break
> existing programs (especially on GCC compiled kernels), but this cleanup has to
> start sooner than later. Note PTR_TO_CTX access still yields old deprecated
> PTR_TO_BTF_ID. Once it's converted to strict PTR_TRUSTED or PTR_UNTRUSTED the
> kfuncs and helpers will be able to default to KF_TRUSTED_ARGS. KF_RCU will
> remain as a weaker version of KF_TRUSTED_ARGS where obj refcnt could be 0.
>
> Adjust rcu_read_lock selftest to run on gcc and clang compiled kernels.
>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: David Vernet <void@manifault.com>
next prev parent reply other threads:[~2023-03-03 14:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-03 4:14 [PATCH v5 bpf-next 0/6] bpf: Introduce kptr RCU Alexei Starovoitov
2023-03-03 4:14 ` [PATCH v5 bpf-next 1/6] bpf: Rename __kptr_ref -> __kptr and __kptr -> __kptr_untrusted Alexei Starovoitov
2023-03-03 4:14 ` [PATCH v5 bpf-next 2/6] bpf: Mark cgroups and dfl_cgrp fields as trusted Alexei Starovoitov
2023-03-03 4:14 ` [PATCH v5 bpf-next 3/6] bpf: Introduce kptr_rcu Alexei Starovoitov
2023-03-03 4:14 ` [PATCH v5 bpf-next 4/6] selftests/bpf: Add a test case for kptr_rcu Alexei Starovoitov
2023-03-03 4:14 ` [PATCH v5 bpf-next 5/6] selftests/bpf: Tweak cgroup kfunc test Alexei Starovoitov
2023-03-03 4:14 ` [PATCH v5 bpf-next 6/6] bpf: Refactor RCU enforcement in the verifier Alexei Starovoitov
2023-03-03 14:22 ` David Vernet [this message]
2023-03-03 16:50 ` [PATCH v5 bpf-next 0/6] bpf: Introduce kptr RCU 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=ZAICvFGmh2ykz9Bi@maniforge \
--to=void@manifault.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=davemarchevsky@meta.com \
--cc=kernel-team@fb.com \
--cc=martin.lau@kernel.org \
--cc=memxor@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=tj@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.