Skip to content

BPF iterator for UNIX domain socket.

Kuniyuki Iwashima bpf netdev 6 versions – Applied

Status from this message: Applied to bpf-next.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest4 patches 1 replyApplied
  2. v54 patches 9 repliesSuperseded
  3. v43 patches 8 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v32 patches8 repliesSuperseded
v22 patches0 repliesSuperseded
v12 patches10 repliesSuperseded

Changes in v6 from the cover letter

- Align the header "Inde" column
- Change int vars to __u64 not to break test_progs-no_alu32
- Move the if statement into the for loop not to depend on the fix [0]
- Drop the README change
- Modify "%c" positive test patterns

Patches in v6 Applied

#Subject and filesSizeRepliesApplied
1/4bpf: af_unix: Implement BPF iterator for UNIX domain socket.include/linux/btf_ids.h net/unix/af_unix.c+95 -10 replies
2/4bpf: Support "%c" in bpf_bprintf_prepare().kernel/bpf/helpers.c+14 -00 replies
3/4selftest/bpf: Implement sample UNIX domain socket iterator program.tools/testing/selftests/bpf/prog_tests/bpf_iter.c tools/testing/selftests/bpf/progs/bpf_iter.h tools/testing/selftests/bpf/progs/bpf_iter_unix.c +1 more+108 -01 reply
4/4selftest/bpf: Extend the bpf_snprintf() test for "%c".tools/testing/selftests/bpf/prog_tests/snprintf.c tools/testing/selftests/bpf/progs/test_snprintf.c+6 -40 replies

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchYonghong Song
1/4A-b
2/4A-b
3/4A-b
4/4

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

Read the v6 thread

Cover letter [PATCH v6 bpf-next 0/4] BPF iterator for UNIX domain socket.

This patch set adds BPF iterator support for UNIX domain socket. The first patch implements it, and the second adds "%c" support for BPF_SEQ_PRINTF().

Thanks to Yonghong Song for the fix [0] for the LLVM code gen. The fix prevents the LLVM compiler from transforming the loop exit condition '<' to '!=', where the upper bound is not a constant. The transformation leads the verifier to interpret it as an infinite loop.

And thanks to Andrii Nakryiko for its workaround [1].

[0] https://reviews.llvm.org/D107483
[1] https://lore.kernel.org/netdev/CAEf4BzZ3sVx1m1mOCcPcuVPiY6cWEAO=6VGHDiXEs9ZVD-RoLg@mail.gmail.com/

Changelog:
v6:
- Align the header "Inde" column
- Change int vars to __u64 not to break test_progs-no_alu32
- Move the if statement into the for loop not to depend on the fix [0]
- Drop the README change
- Modify "%c" positive test patterns

v5:
https://lore.kernel.org/netdev/[email protected]/
- Align header line of bpf_iter_unix.c
- Add test for "%c"

v4:
https://lore.kernel.org/netdev/[email protected]/
- Check IS_BUILTIN(CONFIG_UNIX)
- Support "%c" in BPF_SEQ_PRINTF()
- Uncomment the code to print the name of the abstract socket
- Mention the LLVM fix in README.rst
- Remove the 'aligned' attribute in bpf_iter.h
- Keep the format string on a single line

v3:
https://lore.kernel.org/netdev/[email protected]/
- Export some functions for CONFIG_UNIX=m

v2:
https://lore.kernel.org/netdev/[email protected]/
- Implement bpf_iter specific seq_ops->stop()
- Add bpf_iter__unix in bpf_iter.h
- Move common definitions in selftest to bpf_tracing_net.h
- Include the code for abstract UNIX domain socket as comment in selftest
- Use ASSERT_OK_PTR() instead of CHECK()
- Make ternary operators on single line

v1:
https://lore.kernel.org/netdev/[email protected]/

Kuniyuki Iwashima (4):
bpf: af_unix: Implement BPF iterator for UNIX domain socket.
bpf: Support "%c" in bpf_bprintf_prepare(). selftest/bpf: Implement sample UNIX domain socket iterator program. selftest/bpf: Extend the bpf_snprintf() test for "%c".

 include/linux/btf_ids.h                       |  3 +-
 kernel/bpf/helpers.c                          | 14 +++
 net/unix/af_unix.c                            | 93 +++++++++++++++++++
 .../selftests/bpf/prog_tests/bpf_iter.c       | 16 ++++
 .../selftests/bpf/prog_tests/snprintf.c       |  4 +-
 tools/testing/selftests/bpf/progs/bpf_iter.h  |  8 ++
 .../selftests/bpf/progs/bpf_iter_unix.c       | 80 ++++++++++++++++
 .../selftests/bpf/progs/bpf_tracing_net.h     |  4 +
 .../selftests/bpf/progs/test_snprintf.c       |  6 +-
 9 files changed, 223 insertions(+), 5 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/bpf_iter_unix.c
Signature · 1 line
2.30.2