[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230215065812.7551-1-alexei.starovoitov@gmail.com>
Date: Tue, 14 Feb 2023 22:58:08 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: davem@...emloft.net
Cc: daniel@...earbox.net, andrii@...nel.org, martin.lau@...nel.org,
void@...ifault.com, davemarchevsky@...a.com, tj@...nel.org,
memxor@...il.com, netdev@...r.kernel.org, bpf@...r.kernel.org,
kernel-team@...com
Subject: [PATCH bpf-next 0/4] bpf: Introduce kptr_rcu.
From: Alexei Starovoitov <ast@...nel.org>
The __kptr_ref turned out to be too limited, since any "trusted" pointer access
requires bpf_kptr_xchg() which is impractical when the same pointer needs
to be dereferenced by multiple cpus.
The __kptr "untrusted" only access isn't very useful in practice.
Rename __kptr to __kptr_untrusted with eventual goal to deprecate it,
and rename __kptr_ref to __kptr, since that looks to be more common use of kptrs.
Introduce __kptr_rcu that can be directly dereferenced and used similar
to native kernel C code.
Once bpf_cpumask and task_struct kfuncs are converted to observe RCU GP
when refcnt goes to zero, both __kptr and __kptr_untrusted can be deprecated
and __kptr_rcu can become the only __kptr tag.
Alexei Starovoitov (4):
bpf: Rename __kptr_ref -> __kptr and __kptr -> __kptr_untrusted.
bpf: Introduce kptr_rcu.
selftests/bpf: Add a test case for kptr_rcu.
selftests/bpf: Tweak cgroup kfunc test.
Documentation/bpf/bpf_design_QA.rst | 4 +--
Documentation/bpf/cpumasks.rst | 4 +--
Documentation/bpf/kfuncs.rst | 2 +-
include/linux/bpf.h | 15 ++++++---
include/linux/bpf_verifier.h | 2 +-
kernel/bpf/btf.c | 26 +++++++++++++--
kernel/bpf/syscall.c | 4 +++
kernel/bpf/verifier.c | 33 ++++++++++++-------
tools/lib/bpf/bpf_helpers.h | 3 +-
tools/testing/selftests/bpf/progs/cb_refs.c | 2 +-
.../selftests/bpf/progs/cgrp_kfunc_common.h | 2 +-
.../selftests/bpf/progs/cgrp_kfunc_failure.c | 2 +-
.../selftests/bpf/progs/cgrp_kfunc_success.c | 9 ++++-
.../selftests/bpf/progs/cpumask_common.h | 2 +-
.../selftests/bpf/progs/jit_probe_mem.c | 2 +-
tools/testing/selftests/bpf/progs/lru_bug.c | 2 +-
tools/testing/selftests/bpf/progs/map_kptr.c | 15 +++++++--
.../selftests/bpf/progs/map_kptr_fail.c | 6 ++--
.../selftests/bpf/progs/task_kfunc_common.h | 2 +-
tools/testing/selftests/bpf/test_verifier.c | 22 ++++++-------
20 files changed, 109 insertions(+), 50 deletions(-)
--
2.30.2
Powered by blists - more mailing lists