Fix BPF probe memory helpers
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest8 patches 1 replyIn review
- v28 patches 4 repliesSuperseded
- v15 patches 11 repliesSuperseded
Changes in v3 from the cover letter
- noticed two more things that are fixed in here:
- bpf uapi helper description used 'int size' for *_str helpers, now u32
- we need TASK_SIZE_MAX + guard page on x86-64 in patch 2 otherwise we'll trigger the 00c42373d397 warn as well, so full range covered now
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | uaccess: Add non-pagefault user-space write functioninclude/ mm/ | +53 | 0 replies | |
| 2/8 | uaccess: Add strict non-pagefault kernel-space read functionarch/ arch/ include/ +1 more | +72 | 0 replies | |
| 3/8 | bpf: Make use of probe_user_write in probe write helperkernel/ | +2 | 0 replies | |
| 4/8 | bpf: Add probe_read_{user,kernel} and probe_read_{user,kernel}_str helpersinclude/ kernel/ tools/ | +299 | 0 replies | |
| 5/8 | bpf: Switch BPF probe insns to bpf_probe_read_kernelkernel/ | +5 | 0 replies | |
| 6/8 | bpf, samples: Use bpf_probe_read_user where appropriatesamples/ samples/ samples/ | +5 | 0 replies | |
| 7/8 | bpf, testing: Convert prog tests to probe_read_{user,kernel}{,_str} helpertools/ tools/ tools/ +1 more | +57 | 0 replies | |
| 8/8 | bpf, testing: Add selftest to read/write sockaddr from user spacetools/ tools/ | +104 | 0 replies |
Reviews trailers per patch
7 of 8 patches have a Reviewed-by or Acked-by.
| Patch | Andrii Nakryiko | Ilya Leoshkevich |
|---|---|---|
| 1/8 | A-b | |
| 2/8 | ||
| 3/8 | A-b | |
| 4/8 | A-b | |
| 5/8 | A-b | |
| 6/8 | A-b | |
| 7/8 | A-b | |
| 8/8 | A-b | T-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/8] Fix BPF probe memory helpers
This set adds probe_read_{user,kernel}(), probe_read_str_{user,kernel}() helpers, fixes probe_write_user() helper and selftests. For details please see individual patches.
Thanks!
v2 -> v3:
- noticed two more things that are fixed in here:
- bpf uapi helper description used 'int size' for *_str helpers, now u32
- we need TASK_SIZE_MAX + guard page on x86-64 in patch 2 otherwise we'll trigger the 00c42373d397 warn as well, so full range covered now
v1 -> v2:
- standardize unsafe_ptr terminology in uapi header comment (Andrii)
- probe_read_{user,kernel}[_str] naming scheme (Andrii)
- use global data in last test case, remove relaxed_maps (Andrii)
- add strict non-pagefault kernel read funcs to avoid warning in kernel probe read helpers (Alexei)
Daniel Borkmann (8):
uaccess: Add non-pagefault user-space write function
uaccess: Add strict non-pagefault kernel-space read function
bpf: Make use of probe_user_write in probe write helper
bpf: Add probe_read_{user,kernel} and probe_read_{user,kernel}_str helpers
bpf: Switch BPF probe insns to bpf_probe_read_kernel
bpf, samples: Use bpf_probe_read_user where appropriate
bpf, testing: Convert prog tests to probe_read_{user,kernel}{,_str} helper bpf, testing: Add selftest to read/write sockaddr from user space
arch/x86/mm/Makefile | 2 +- arch/x86/mm/maccess.c | 43 ++++ include/linux/uaccess.h | 16 ++ include/uapi/linux/bpf.h | 122 ++++++++---- kernel/bpf/core.c | 9 +- kernel/trace/bpf_trace.c | 187 +++++++++++++----- mm/maccess.c | 70 ++++++- samples/bpf/map_perf_test_kern.c | 4 +- samples/bpf/test_map_in_map_kern.c | 4 +- samples/bpf/test_probe_write_user_kern.c | 2 +- tools/include/uapi/linux/bpf.h | 122 ++++++++---- .../selftests/bpf/prog_tests/probe_user.c | 78 ++++++++ tools/testing/selftests/bpf/progs/kfree_skb.c | 4 +- tools/testing/selftests/bpf/progs/pyperf.h | 67 ++++--- .../testing/selftests/bpf/progs/strobemeta.h | 36 ++-- .../selftests/bpf/progs/test_probe_user.c | 26 +++ .../selftests/bpf/progs/test_tcp_estats.c | 2 +- 17 files changed, 597 insertions(+), 197 deletions(-) create mode 100644 arch/x86/mm/maccess.c create mode 100644 tools/testing/selftests/bpf/prog_tests/probe_user.c create mode 100644 tools/testing/selftests/bpf/progs/test_probe_user.c
Signature · 1 line
2.21.0