Add bpf_copy_from_user_task helper and sleepable bpf iterator programs
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
- v7 Latest4 patches 3 repliesApplied 4/4
- v63 patches 9 repliesSuperseded
- v53 patches 7 repliesSuperseded
Earlier versions · 4
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v4 | 3 patches | 2 replies | Superseded | |
| v3 | 3 patches | 2 replies | Superseded | |
| v2 | 4 patches | 8 replies | Superseded | |
| v1 | 3 patches | 0 replies | Superseded |
Changes in v7 from the cover letter
* Split first patch into two patches: first patch to add support for bpf iterators to use sleepable helpers, and the second to add the new bpf helper.
* Simplify implementation of bpf_copy_from_user_task based on feedback.
* Add to docs that the destination buffer will be zero-ed on error.
Patches in v7 All 4 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | bpf: Add support for bpf iterator programs to use sleepable helperskernel/ | +15 | 1 reply | Applied |
| 2/4 | bpf: Add bpf_copy_from_user_task() helperinclude/ include/ kernel/ +2 more | +59 | 2 replies | Applied |
| 3/4 | libbpf: Add "iter.s" section for sleepable bpf iterator programstools/ | +1 | 0 replies | Applied |
| 4/4 | selftests/bpf: Add test for sleepable bpf iterator programstools/ tools/ | +74 | 0 replies | Applied |
Reviews trailers per patch
All 4 patches have a Reviewed-by or Acked-by.
| Patch | Andrii Nakryiko |
|---|---|
| 1/4 | A-b |
| 2/4 | A-b |
| 3/4 | A-b |
| 4/4 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v7 bpf-next 0/4] Add bpf_copy_from_user_task helper and sleepable bpf iterator programs
This patch series makes the following changes:
* Adds a new bpf helper bpf_copy_from_user_task to read user space memory from a different task.
* Adds the ability to create sleepable bpf iterator programs.
As an example of how this will be used, at Meta we are using bpf task iterator programs and this new bpf helper to read C++ async stack traces of a running process for debugging C++ binaries in production.
Changes since v6:
* Split first patch into two patches: first patch to add support for bpf iterators to use sleepable helpers, and the second to add the new bpf helper.
* Simplify implementation of bpf_copy_from_user_task based on feedback.
* Add to docs that the destination buffer will be zero-ed on error.
Changes since v5:
* Rename bpf_access_process_vm to bpf_copy_from_user_task.
* Change return value to be all-or-nothing. If we get a partial read, memset all bytes to 0 and return -EFAULT.
* Add to docs that the helper can only be used by sleepable BPF programs.
* Fix nits in selftests.
Changes since v4:
* Make flags into u64.
* Use user_ptr arg name to be consistent with bpf_copy_from_user.
* Add an extra check in selftests to verify access_process_vm calls succeeded.
Changes since v3:
* Check if flags is 0 and return -EINVAL if not.
* Rebase on latest bpf-next branch and fix merge conflicts.
Changes since v2:
* Reorder arguments in bpf_access_process_vm to match existing related bpf helpers (e.g. bpf_probe_read_kernel, bpf_probe_read_user, bpf_copy_from_user).
* flags argument is provided for future extensibility and is not currently used, and we always invoke access_process_vm with no flags.
* Merge bpf helper patch and bpf_iter_run_prog patch together for better bisectability in case of failures.
* Clean up formatting and comments in selftests.
Changes since v1:
* Fixed "Invalid wait context" issue in bpf_iter_run_prog by using rcu_read_lock_trace() for sleepable bpf iterator programs.
Kenny Yu (4):
bpf: Add support for bpf iterator programs to use sleepable helpers
bpf: Add bpf_copy_from_user_task() helper
libbpf: Add "iter.s" section for sleepable bpf iterator programs selftests/bpf: Add test for sleepable bpf iterator programs
include/linux/bpf.h | 1 + include/uapi/linux/bpf.h | 11 ++++ kernel/bpf/bpf_iter.c | 20 +++++-- kernel/bpf/helpers.c | 34 ++++++++++++ kernel/trace/bpf_trace.c | 2 + tools/include/uapi/linux/bpf.h | 11 ++++ tools/lib/bpf/libbpf.c | 1 + .../selftests/bpf/prog_tests/bpf_iter.c | 20 +++++++ .../selftests/bpf/progs/bpf_iter_task.c | 54 +++++++++++++++++++ 9 files changed, 149 insertions(+), 5 deletions(-)
Signature · 1 line
2.30.2