Update KF_RCU_PROTECTED
Status from this message: This series was applied to bpf/bpf-next.git (master)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest2 patches 8 repliesApplied 2/2
- v22 patches 0 repliesSuperseded
- v13 patches 6 repliesSuperseded
Changes in v3 from the cover letter
v2: https://lore.kernel.org/bpf/[email protected]
* Add back lost hunk reworking documentation for KF_RCU_PROTECTED.
Patches in v3 All 2 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | bpf: Enforce RCU protection for KF_RCU_PROTECTEDDocumentation/ kernel/ tools/ +1 more | +31 | 5 replies | Applied |
| 2/2 | selftests/bpf: Add tests for KF_RCU_PROTECTEDtools/ tools/ tools/ | +60 | 1 reply | Applied |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Andrea Righi | Eduard Zingerman |
|---|---|---|
| Series | R-b | |
| 1/2 | T-b | A-b |
| 2/2 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH bpf-next v3 0/2] Update KF_RCU_PROTECTED
Currently, KF_RCU_PROTECTED only applies to iterator APIs and that too in a convoluted fashion: the presence of this flag on the kfunc is used to set MEM_RCU in iterator type, and the lack of RCU protection results in an error only later, once next() or destroy() methods are invoked on the iterator. While there is no bug, this is certainly a bit unintuitive, and makes the enforcement of the flag iterator specific.
In the interest of making this flag useful for other upcoming kfuncs, e.g. scx_bpf_cpu_curr() [0][1], add enforcement for invoking the kfunc in an RCU critical section in general.
In addition to this, the aforementioned kfunc also needs to return an RCU protected pointer, which currently has no generic kfunc flag or annotation. Add such a flag as well while we are at it.
[0]: https://lore.kernel.org/all/[email protected]
[1]: https://lore.kernel.org/all/[email protected]
Changelog:
----------
v2 -> v3
v2: https://lore.kernel.org/bpf/[email protected]
* Add back lost hunk reworking documentation for KF_RCU_PROTECTED.
v1 -> v2
v1: https://lore.kernel.org/bpf/[email protected]
* Drop KF_RET_RCU and fold change into KF_RCU_PROTECTED. (Andrea, Alexei)
* Update tests for non-struct pointer return values with KF_RCU_PROTECTED.
Kumar Kartikeya Dwivedi (2):
bpf: Enforce RCU protection for KF_RCU_PROTECTED selftests/bpf: Add tests for KF_RCU_PROTECTED
Documentation/bpf/kfuncs.rst | 19 +++++++- kernel/bpf/verifier.c | 10 ++++ .../selftests/bpf/progs/cgroup_read_xattr.c | 2 +- .../selftests/bpf/progs/iters_task_failure.c | 4 +- .../selftests/bpf/progs/iters_testmod.c | 46 +++++++++++++++++++ .../selftests/bpf/test_kmods/bpf_testmod.c | 12 +++++ .../bpf/test_kmods/bpf_testmod_kfunc.h | 2 + 7 files changed, 91 insertions(+), 4 deletions(-)
base-commit: b13448dd64e27752fad252cec7da1a50ab9f0b6f
Signature · 1 line
2.51.0