Skip to content

Introduce bpf ID

Martin KaFai Lau netdev 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest8 patches 1 replyIn review
  2. v28 patches 14 repliesSuperseded
  3. v18 patches 3 repliesSuperseded

Changes in v3 from the cover letter

- I suspect v2 may not have applied cleanly.
In particular, patch 1 has conflict with a recent change in struct bpf_prog_aux introduced at a similar time frame:
8726679a0fa3 ("bpf: teach verifier to track stack depth") v3 should have fixed it.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8bpf: Introduce bpf_prog IDinclude/linux/bpf.h kernel/bpf/syscall.c+40 -10 replies
2/8bpf: Introduce bpf_map IDinclude/linux/bpf.h kernel/bpf/syscall.c+34 -10 replies
3/8bpf: Add BPF_(PROG|MAP)_GET_NEXT_ID commandinclude/uapi/linux/bpf.h kernel/bpf/syscall.c+45 -00 replies
4/8bpf: Add BPF_PROG_GET_FD_BY_IDinclude/uapi/linux/bpf.h kernel/bpf/syscall.c+87 -120 replies
5/8bpf: Add BPF_MAP_GET_FD_BY_IDinclude/uapi/linux/bpf.h kernel/bpf/syscall.c+87 -100 replies
6/8bpf: Add jited_len to struct bpf_progarch/arm64/net/bpf_jit_comp.c arch/powerpc/net/bpf_jit_comp64.c arch/s390/net/bpf_jit_comp.c +3 more+6 -00 replies
7/8bpf: Add BPF_OBJ_GET_INFO_BY_FDinclude/linux/filter.h include/uapi/linux/bpf.h kernel/bpf/syscall.c+174 -190 replies
8/8bpf: Test for bpf IDtools/include/uapi/linux/bpf.h tools/lib/bpf/bpf.c tools/lib/bpf/bpf.h +3 more+341 -10 replies

Reviews trailers per patch

All 8 patches have a Reviewed-by or Acked-by.

PatchAlexei StarovoitovDaniel Borkmann
1/8A-b A-b
2/8A-b A-b
3/8A-b A-b
4/8A-b A-b
5/8A-b A-b
6/8A-b A-b
7/8A-b A-b
8/8A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 net-next 0/8] Introduce bpf ID

This patch series:
1) Introduce ID for both bpf_prog and bpf_map.
2) Add bpf commands to iterate the prog IDs and map IDs of the system.
3) Add bpf commands to get a prog/map fd from an ID
4) Add bpf command to get prog/map info from a fd. The prog/map info is a jump start in this patchset and it is not meant to be a complete list. They can be extended in the future patches.

v3:
- I suspect v2 may not have applied cleanly.
In particular, patch 1 has conflict with a recent change in struct bpf_prog_aux introduced at a similar time frame:
8726679a0fa3 ("bpf: teach verifier to track stack depth") v3 should have fixed it.

v2:
Compiler warning fixes:
- Remove lockdep_is_held() usage. Add comment
to explain the lock situation instead.
- Add static for idr related variables
- Add __user to the uattr param in bpf_prog_get_info_by_fd() and bpf_map_get_info_by_fd().

Martin KaFai Lau (8):
bpf: Introduce bpf_prog ID
bpf: Introduce bpf_map ID
bpf: Add BPF_(PROG|MAP)_GET_NEXT_ID command
bpf: Add BPF_PROG_GET_FD_BY_ID
bpf: Add BPF_MAP_GET_FD_BY_ID
bpf: Add jited_len to struct bpf_prog
bpf: Add BPF_OBJ_GET_INFO_BY_FD
bpf: Test for bpf ID

 arch/arm64/net/bpf_jit_comp.c             |   1 +
 arch/powerpc/net/bpf_jit_comp64.c         |   1 +
 arch/s390/net/bpf_jit_comp.c              |   1 +
 arch/sparc/net/bpf_jit_comp_64.c          |   1 +
 arch/x86/net/bpf_jit_comp.c               |   1 +
 include/linux/bpf.h                       |   2 +
 include/linux/filter.h                    |   3 +-
 include/uapi/linux/bpf.h                  |  41 +++
 kernel/bpf/syscall.c                      | 433 ++++++++++++++++++++++++++++--
 tools/include/uapi/linux/bpf.h            |  41 +++
 tools/lib/bpf/bpf.c                       |  68 +++++
 tools/lib/bpf/bpf.h                       |   5 +
 tools/testing/selftests/bpf/Makefile      |   2 +-
 tools/testing/selftests/bpf/test_obj_id.c |  35 +++
 tools/testing/selftests/bpf/test_progs.c  | 191 +++++++++++++
 15 files changed, 798 insertions(+), 28 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/test_obj_id.c
Signature · 1 line
2.9.3