Skip to content

sockmap: Fix reading with splice(2)

Vincent Whitchurch b4-sent bpf netdev 3 versions – In review

Get series with b4
b4 am [email protected] change-id 20240606-sockmap-splice-d371ac07d7b4

Versions newest first

  1. v3 Latest5 patches 6 repliesIn review
  2. v25 patches 3 repliesSuperseded
  3. v15 patches 1 replySuperseded

Changes in v3 from the cover letter

- Rebase on latest bpf-next/master
- Link to v2: https://lore.kernel.org/r/[email protected]

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5net: Add splice_read to protinclude/net/inet_common.h include/net/sock.h net/ipv4/af_inet.c +3 more+21 -23 replies
2/5tcp_bpf: Fix reading with splice(2)net/ipv4/tcp_bpf.c+9 -00 replies
3/5selftests/bpf: sockmap: Exit with error on failuretools/testing/selftests/bpf/test_sockmap.c+3 -10 replies
4/5selftests/bpf: sockmap: Allow SK_PASS in verdicttools/testing/selftests/bpf/test_sockmap.c+12 -10 replies
5/5selftests/bpf: sockmap: Add splice + SK_PASS regression testtools/testing/selftests/bpf/test_sockmap.c+73 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH bpf-next v3 0/5] sockmap: Fix reading with splice(2)

I noticed that if the verdict callback returns SK_PASS, using splice(2) to read from a socket in a sockmap does not work since it never sees the data queued on to it. As far as I can see, this is not a regression but just something that has never worked, but it does make sockmap unusable if you can't guarantee that the programs using the socket will not use splice(2).

This series attempts to fix it and add a test for it.

---
Changes in v3:
- Rebase on latest bpf-next/master
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Rebase on latest bpf-next/master
- Remove unnecessary change in inet_dgram_ops
- Remove ->splice_read NULL check in inet_splice_read()
- Use INDIRECT_CALL_1() in inet_splice_read()
- Include test case in default test suite in test_sockmap
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Vincent Whitchurch (5):
net: Add splice_read to prot
tcp_bpf: Fix reading with splice(2) selftests/bpf: sockmap: Exit with error on failure selftests/bpf: sockmap: Allow SK_PASS in verdict selftests/bpf: sockmap: Add splice + SK_PASS regression test

 include/net/inet_common.h                  |  3 +
 include/net/sock.h                         |  3 +
 net/ipv4/af_inet.c                         | 13 ++++-
 net/ipv4/tcp_bpf.c                         |  9 +++
 net/ipv4/tcp_ipv4.c                        |  1 +
 net/ipv6/af_inet6.c                        |  2 +-
 net/ipv6/tcp_ipv6.c                        |  1 +
 tools/testing/selftests/bpf/test_sockmap.c | 90 +++++++++++++++++++++++++++++-
 8 files changed, 118 insertions(+), 4 deletions(-)

---
base-commit: ad97cb2ed06a6ba9025fd8bd14fa24369550cbb5
change-id: 20240606-sockmap-splice-d371ac07d7b4

Best regards,

Signature · 1 line
Vincent Whitchurch <[email protected]>