Skip to content

fix sockmap + stream af_unix memleak

John Fastabend bpf netdev 1 version Applied

Status from this message: Applied. Thanks for the fixes and the review.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 5 repliesApplied 5/5

Patches in v1 All 5 applied

#Subject and filesSizeRepliesApplied
1/5bpf: sockmap, fix proto update hook to avoid dup callsnet/unix/unix_bpf.c+18 -33 repliesApplied
2/5bpf: sockmap, added comments describing update proto rulesinclude/linux/skmsg.h+5 -00 repliesApplied
3/5bpf: sockmap, add tests for proto updates many to single maptools/testing/selftests/bpf/prog_tests/sockmap_basic.c+65 -10 repliesApplied
4/5bpf: sockmap, add tests for proto updates single socket to many maptools/testing/selftests/bpf/prog_tests/sockmap_basic.c+69 -00 repliesApplied
5/5bpf: sockmap, add tests for proto updates replace sockettools/testing/selftests/bpf/prog_tests/sockmap_basic.c+64 -00 repliesApplied

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchXingwei LeeJakub Sitnicki
SeriesR-b
1/5Rebported-by
2/5
3/5
4/5
5/5

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

Read the v1 thread

Cover letter [PATCH bpf 0/5] fix sockmap + stream af_unix memleak

There was a memleak when streaming af_unix sockets were inserted into multiple sockmap slots and/or maps. This is because each insert would call a proto update operatino and these must be allowed to be called multiple times. The streaming af_unix implementation recently added a refcnt to handle a use after free issue, however it introduced a memleak when inserted into multiple maps.

This series fixes the memleak, adds a note in the code so we remember that proto updates need to support this. And then we add three tests for each of the slightly different iterations of adding sockets into multiple maps. I kept them as 3 independent test cases here. I have some slight preference for this they could however be a single test, but then you don't get to run them independently which was sort of useful while debugging.

John Fastabend (5):
bpf: sockmap, fix proto update hook to avoid dup calls
bpf: sockmap, added comments describing update proto rules
bpf: sockmap, add tests for proto updates many to single map
bpf: sockmap, add tests for proto updates single socket to many map
bpf: sockmap, add tests for proto updates replace socket

 include/linux/skmsg.h                         |   5 +
 net/unix/unix_bpf.c                           |  21 +-
 .../selftests/bpf/prog_tests/sockmap_basic.c  | 199 +++++++++++++++++-
 3 files changed, 221 insertions(+), 4 deletions(-)
Signature · 1 line
2.33.0