Skip to content

fix misc sockmap issues

Jiayuan Chen bpf linux-kselftest lkml netdev stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest11 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11bpf, sockmap: Fix copied_seq updates with strparsernet/core/skmsg.c net/ipv4/tcp_bpf.c+20 -100 replies
2/11selftests/bpf: Add test for unread SK_PASS data with strparsertools/testing/selftests/bpf/prog_tests/sockmap_strp.c+86 -00 replies
3/11bpf, sockmap: Fix strparser reinit after the parser link is removedinclude/linux/skmsg.h net/core/skmsg.c net/core/sock_map.c+68 -10 replies
4/11bpf, sockmap: Fix empty sk_msg queued by ingress redirectnet/ipv4/tcp_bpf.c+3 -00 replies
5/11bpf, sockmap: Fix concurrent senders on one psockinclude/linux/skmsg.h net/ipv4/tcp_bpf.c+12 -00 replies
6/11bpf, sockmap: Fix reconnect with a psock by rejecting disconnectinclude/linux/skmsg.h net/core/sock_map.c net/ipv4/tcp_bpf.c+23 -00 replies
7/11bpf, sockmap: Fix psock refcnt taken in sk_psock_backlog()net/core/skmsg.c+1 -10 replies
8/11bpf, sockmap: Fix socket lock taken on a child before accept()net/core/sock_map.c net/ipv4/tcp_bpf.c+32 -50 replies
9/11bpf, sockmap: Fix apply_bytes when a redirect sends only a partnet/ipv4/tcp_bpf.c+17 -50 replies
10/11selftests/bpf: Fix errno expected by the wait send mem test of test_sockmaptools/testing/selftests/bpf/test_sockmap.c+2 -10 replies
11/11selftests/bpf: Add test for apply_bytes when a redirect sends a parttools/testing/selftests/bpf/prog_tests/sockmap_basic.c tools/testing/selftests/bpf/progs/test_sockmap_msg_apply.c+172 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH bpf 00/11] fix misc sockmap issues

This series fixes misc issues in sockmap. Most of them are old.

Patches 1-2 fix copied_seq when a strparser is attached and SK_PASS data is left unread, with a selftest. It was reported by Vega and comes from my earlier fix, commit 36b62df5683c ("bpf: Fix wrong copied_seq calculation").

Patches 3, 4 and 7 are old issues I ran into while reading the code:

03 strparser is initialized again while the old one is still alive,
after the parser link is removed and added back
04 an ingress redirect queues an empty sk_msg
07 sk_psock_backlog() takes the refcnt of the wrong psock

The rest (patches 5, 6 and 8-11) are the old issues that came up in the review of Alexei's sockmap series [1]. They are not from that series, so they were left for a follow-up.

Patch 05 returns -EBUSY to a second concurrent sender, and patch 06 rejects disconnect with -EOPNOTSUPP like TLS does. Both change what user space sees, see the commit messages for why.

[1] https://lore.kernel.org/bpf/[email protected]/

Jiayuan Chen (11):
bpf, sockmap: Fix copied_seq updates with strparser selftests/bpf: Add test for unread SK_PASS data with strparser bpf, sockmap: Fix strparser reinit after the parser link is removed bpf, sockmap: Fix empty sk_msg queued by ingress redirect bpf, sockmap: Fix concurrent senders on one psock
bpf, sockmap: Fix reconnect with a psock by rejecting disconnect bpf, sockmap: Fix psock refcnt taken in sk_psock_backlog() bpf, sockmap: Fix socket lock taken on a child before accept() bpf, sockmap: Fix apply_bytes when a redirect sends only a part selftests/bpf: Fix errno expected by the wait send mem test of
test_sockmap
selftests/bpf: Add test for apply_bytes when a redirect sends a part

 include/linux/skmsg.h                         |   8 ++
 net/core/skmsg.c                              |  44 +++++-
 net/core/sock_map.c                           |  67 +++++++++-
 net/ipv4/tcp_bpf.c                            |  79 +++++++++--
 .../selftests/bpf/prog_tests/sockmap_basic.c  | 126 ++++++++++++++++++
 .../selftests/bpf/prog_tests/sockmap_strp.c   |  86 ++++++++++++
 .../bpf/progs/test_sockmap_msg_apply.c        |  46 +++++++
 tools/testing/selftests/bpf/test_sockmap.c    |   3 +-
 8 files changed, 436 insertions(+), 23 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/test_sockmap_msg_apply.c
Signature · 1 line
2.43.0