Skip to content

sockhash/sockmap fixes

John Fastabend netdev 2 versions Applied

Status from this message: Applied, Thanks

Get series with b4
b4 am 20180705154828.17483.44366.stgit@john-Precision-Tower-5810

Versions newest first · linked by author and title

  1. v2 Latest4 patches 1 replyApplied
  2. v14 patches 1 replySuperseded

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/4bpf: fix sk_skb programs without skb->dev assignednet/core/filter.c+2 -10 replies
2/4bpf: sockhash, disallow bpf_tcp_close and update in parallelkernel/bpf/sockmap.c kernel/bpf/syscall.c+18 -10 replies
3/4bpf: sockmap, consume_skb in close pathkernel/bpf/sockmap.c+4 -10 replies
4/4bpf: sockmap, convert bpf_compute_data_pointers to bpf_*_sk_skbinclude/net/tcp.h kernel/bpf/sockmap.c net/core/filter.c+97 -90 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [bpf PATCH v2 0/4] sockhash/sockmap fixes

First three patches resolve issues found while testing sockhash and reviewing code. Syzbot also found them about the same time as I was working on fixes. The main issue is in the sockhash path we reduced the scope of sk_callback lock but this meant we could get update and close running in parallel so fix that here.

Then testing sk_msg and sk_skb programs together found that skb->dev is not always assigned and some of the helpers were depending on this to lookup max mtu. Fix this by using SKB_MAX_ALLOC when no MTU is available.

Finally, Martin spotted that the sockmap code was still using the qdisc skb cb structure. But I was sure we had fixed this long ago. Looks like we missed it in a merge conflict resolution and then by chance data_end offset was the same in both structures so everything sort of continued to work even though it could break at any moment if the structs ever change. So redo the conversion and this time also convert the helpers.

v2: fix '0 files changed' issue in patches

---

John Fastabend (4):
bpf: fix sk_skb programs without skb->dev assigned
bpf: sockhash, disallow bpf_tcp_close and update in parallel
bpf: sockmap, consume_skb in close path
bpf: sockmap, convert bpf_compute_data_pointers to bpf_*_sk_skb

 include/net/tcp.h    |    4 ++
 kernel/bpf/sockmap.c |   24 ++++++++++--
 kernel/bpf/syscall.c |    4 +-
 net/core/filter.c    |  101 ++++++++++++++++++++++++++++++++++++++++++++++----
 4 files changed, 121 insertions(+), 12 deletions(-)