bpf: adding get_fd_path helper
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v14 Latest2 patches 12 repliesIn review
- v132 patches 5 repliesSuperseded
- v122 patches 11 repliesSuperseded
Earlier versions · 11
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v11 | 2 patches | 2 replies | Superseded | |
| v10 | 2 patches | 7 replies | Superseded | |
| v9 | 1 patch | 1 reply | Superseded | |
| v8 | 1 patch | 0 replies | Superseded | |
| v7 posting 2/2 | 1 patch | 2 replies | Superseded | |
| v7 posting 1/2 | 1 patch | 0 replies | Superseded | |
| v6 | 1 patch | 0 replies | Superseded | |
| v5 | 1 patch | 2 replies | Superseded | |
| v4 | 1 patch | 4 replies | Superseded | |
| v3 | 1 patch | 1 reply | Superseded | |
| v1 | 1 patch | 1 reply | Superseded |
Changes in v14 from the cover letter
* Fix this helper's description to be consistent with comments in d_path
* Fix error handling logic fill zeroes not '0's
Patches in v14 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | bpf: add new helper get_fd_path for mapping a file descriptor to a pathnameinclude/ kernel/ tools/ | +125 | 11 replies | |
| 2/2 | selftests/bpf: test for bpf_get_fd_path() from tracepointtools/ tools/ | +214 | 1 reply |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by.
| Patch | Yonghong Song | Jiri Olsa |
|---|---|---|
| 1/2 | A-b | T-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 v14 0/2] bpf: adding get_fd_path helper
This patch series introduce a bpf helper that can be used to map a file descriptor to a pathname.
This requirement is mainly discussed here:
https://github.com/iovisor/bcc/issues/237
This implementation supports both local and mountable pseudo file systems, and ensure we're in user context which is safe for this helper to run.
Changes since v13:
* Fix this helper's description to be consistent with comments in d_path
* Fix error handling logic fill zeroes not '0's
Changes since v12:
* Rename to get_fd_patch
* Fix test issue on big-endian machines
Changes since v11:
* Only allow tracepoints to make sure it won't dead lock
Changes since v10:
* Fix missing fput
Changes since v9:
* Associate help patch with its selftests patch to this series
* Refactor selftests code for further simplification
Changes since v8:
* Format helper description
Changes since v7:
* Use fget_raw instead of fdget_raw, as fdget_raw is only used inside fs/
* Ensure we're in user context which is safe fot the help to run
* Filter unmountable pseudo filesystem, because they don't have real path
* Supplement the description of this helper function
Changes since v6:
* Fix missing signed-off-by line
Changes since v5:
* Refactor helper avoid unnecessary goto end by having two explicit returns
Changes since v4:
* Rename bpf_fd2path to bpf_get_file_path to be consistent with other helper's names
* When fdget_raw fails, set ret to -EBADF instead of -EINVAL
* Remove fdput from fdget_raw's error path
* Use IS_ERR instead of IS_ERR_OR_NULL as d_path ether returns a pointer into the buffer or an error code if the path was too long
* Modify the normal path's return value to return copied string length including NUL
* Update helper description's Return bits.
* Refactor selftests code for further simplification
Changes since v3:
* Remove unnecessary LOCKDOWN_BPF_READ
* Refactor error handling section for enhanced readability
* Provide a test case in tools/testing/selftests/bpf
* Refactor sefltests code to use real global variables instead of maps
Changes since v2:
* Fix backward compatibility
* Add helper description
* Refactor selftests use global data instead of perf_buffer to simplified code
* Fix signed-off name
Wenbo Zhang (2):
bpf: add new helper get_fd_path for mapping a file descriptor to a
pathname
selftests/bpf: test for bpf_get_fd_path() from tracepoint
include/uapi/linux/bpf.h | 29 ++- kernel/trace/bpf_trace.c | 69 +++++++ tools/include/uapi/linux/bpf.h | 29 ++- .../selftests/bpf/prog_tests/get_fd_path.c | 171 ++++++++++++++++++ .../selftests/bpf/progs/test_get_fd_path.c | 43 +++++ 5 files changed, 339 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/get_fd_path.c create mode 100644 tools/testing/selftests/bpf/progs/test_get_fd_path.c
Signature · 1 line
2.17.1