bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v9 bpf-next 00/14] bpf: Add d_path helper
@ 2020-08-01 17:03 Jiri Olsa
  2020-08-01 17:03 ` [PATCH v9 bpf-next 01/14] tools resolve_btfids: Add size check to get_id function Jiri Olsa
                   ` (13 more replies)
  0 siblings, 14 replies; 38+ messages in thread
From: Jiri Olsa @ 2020-08-01 17:03 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: netdev, bpf, Song Liu, Yonghong Song, Martin KaFai Lau,
	David Miller, John Fastabend, Wenbo Zhang, KP Singh,
	Brendan Gregg, Florent Revest, Al Viro

hi,
adding d_path helper function that returns full path for
given 'struct path' object, which needs to be the kernel
BTF 'path' object. The path is returned in buffer provided
'buf' of size 'sz' and is zero terminated.

  int bpf_d_path(struct path *path, char *buf, u32 sz);

The helper calls directly d_path function, so there's only
limited set of function it can be called from.

The patchset also adds support to add set of BTF IDs for
a helper to define functions that the helper is allowed
to be called from.

Also available at:
  https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
  bpf/d_path

v9 changes:
  - added few acks
  - added symbol length check to add_set/get_id functions in resolve_btfids [Andrii]
  - used CHECK instead of CHECK_FAIL [Andrii]
  - zero-initialized variables in progs/test_d_path.c [Andrii]
  - simplify d_path test, removed unneeded code [Andrii]
  - added BTF_SET_START_GLOBAL [Andrii]
  - removed "autoconf.h" include in resolve_btfids test [Andrii]
  - simplified resolve_btfids test exit conditions [Andrii]
  - flow changes in btf_struct_ids_match/btf_struct_access
    plus extra check to btf_struct_ids_match [Andrii]
  - changed bpf_d_path code [Al Viro]
  - changed whitelist to allowlist [Andrii]
  - used ARG_CONST_SIZE_OR_ZERO for d_path helper [Andrii]

thanks,
jirka


---
Jiri Olsa (14):
      tools resolve_btfids: Add size check to get_id function
      tools resolve_btfids: Add support for set symbols
      bpf: Move btf_resolve_size into __btf_resolve_size
      bpf: Add elem_id pointer as argument to __btf_resolve_size
      bpf: Add type_id pointer as argument to __btf_resolve_size
      bpf: Remove recursion call in btf_struct_access
      bpf: Factor btf_struct_access function
      bpf: Add btf_struct_ids_match function
      bpf: Add BTF_SET_START/END macros
      bpf: Add d_path helper
      bpf: Update .BTF_ids section in btf.rst with sets info
      selftests/bpf: Add verifier test for d_path helper
      selftests/bpf: Add test for d_path helper
      selftests/bpf: Add set test to resolve_btfids

 Documentation/bpf/btf.rst                               |  25 +++++++++++++++
 include/linux/bpf.h                                     |   6 ++++
 include/linux/btf.h                                     |   3 +-
 include/linux/btf_ids.h                                 |  51 +++++++++++++++++++++++++++++-
 include/uapi/linux/bpf.h                                |  13 ++++++++
 kernel/bpf/bpf_struct_ops.c                             |   6 ++--
 kernel/bpf/btf.c                                        | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------
 kernel/bpf/verifier.c                                   |  25 ++++++++++-----
 kernel/trace/bpf_trace.c                                |  48 ++++++++++++++++++++++++++++
 scripts/bpf_helpers_doc.py                              |   2 ++
 tools/bpf/resolve_btfids/main.c                         |  29 +++++++++++++++--
 tools/include/linux/btf_ids.h                           |  51 +++++++++++++++++++++++++++++-
 tools/include/uapi/linux/bpf.h                          |  13 ++++++++
 tools/testing/selftests/bpf/prog_tests/d_path.c         | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/testing/selftests/bpf/prog_tests/resolve_btfids.c |  39 ++++++++++++++++++++++-
 tools/testing/selftests/bpf/progs/test_d_path.c         |  64 +++++++++++++++++++++++++++++++++++++
 tools/testing/selftests/bpf/test_verifier.c             |  19 ++++++++++-
 tools/testing/selftests/bpf/verifier/d_path.c           |  37 ++++++++++++++++++++++
 18 files changed, 698 insertions(+), 43 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/d_path.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_d_path.c
 create mode 100644 tools/testing/selftests/bpf/verifier/d_path.c


^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2020-08-07  9:42 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-01 17:03 [PATCH v9 bpf-next 00/14] bpf: Add d_path helper Jiri Olsa
2020-08-01 17:03 ` [PATCH v9 bpf-next 01/14] tools resolve_btfids: Add size check to get_id function Jiri Olsa
2020-08-05  6:00   ` Andrii Nakryiko
2020-08-01 17:03 ` [PATCH v9 bpf-next 02/14] tools resolve_btfids: Add support for set symbols Jiri Olsa
2020-08-05  6:04   ` Andrii Nakryiko
2020-08-01 17:03 ` [PATCH v9 bpf-next 03/14] bpf: Move btf_resolve_size into __btf_resolve_size Jiri Olsa
2020-08-01 17:03 ` [PATCH v9 bpf-next 04/14] bpf: Add elem_id pointer as argument to __btf_resolve_size Jiri Olsa
2020-08-01 17:03 ` [PATCH v9 bpf-next 05/14] bpf: Add type_id " Jiri Olsa
2020-08-05  6:05   ` Andrii Nakryiko
2020-08-01 17:03 ` [PATCH v9 bpf-next 06/14] bpf: Remove recursion call in btf_struct_access Jiri Olsa
2020-08-05  6:12   ` Andrii Nakryiko
2020-08-05 17:36     ` Jiri Olsa
2020-08-01 17:03 ` [PATCH v9 bpf-next 07/14] bpf: Factor btf_struct_access function Jiri Olsa
2020-08-05  6:18   ` Andrii Nakryiko
2020-08-01 17:03 ` [PATCH v9 bpf-next 08/14] bpf: Add btf_struct_ids_match function Jiri Olsa
2020-08-05  6:27   ` Andrii Nakryiko
2020-08-05 17:56     ` Jiri Olsa
2020-08-05 21:31       ` Jiri Olsa
2020-08-05 21:57         ` Andrii Nakryiko
2020-08-01 17:03 ` [PATCH v9 bpf-next 09/14] bpf: Add BTF_SET_START/END macros Jiri Olsa
2020-08-05  6:29   ` Andrii Nakryiko
2020-08-01 17:03 ` [PATCH v9 bpf-next 10/14] bpf: Add d_path helper Jiri Olsa
2020-08-02  3:13   ` Alexei Starovoitov
2020-08-02 18:26     ` Jiri Olsa
2020-08-05  6:35   ` Andrii Nakryiko
2020-08-05 17:58     ` Jiri Olsa
2020-08-05 21:01       ` Jiri Olsa
2020-08-05 21:09         ` Andrii Nakryiko
2020-08-07  0:31   ` KP Singh
2020-08-07  8:35     ` Jiri Olsa
2020-08-07  9:42       ` KP Singh
2020-08-01 17:03 ` [PATCH v9 bpf-next 11/14] bpf: Update .BTF_ids section in btf.rst with sets info Jiri Olsa
2020-08-01 17:03 ` [PATCH v9 bpf-next 12/14] selftests/bpf: Add verifier test for d_path helper Jiri Olsa
2020-08-01 17:03 ` [PATCH v9 bpf-next 13/14] selftests/bpf: Add " Jiri Olsa
2020-08-05  6:40   ` Andrii Nakryiko
2020-08-05 18:00     ` Jiri Olsa
2020-08-01 17:03 ` [PATCH v9 bpf-next 14/14] selftests/bpf: Add set test to resolve_btfids Jiri Olsa
2020-08-05  6:41   ` Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).