From: John Fastabend <john.fastabend@gmail.com>
To: Jakub Sitnicki <jakub@cloudflare.com>,
John Fastabend <john.fastabend@gmail.com>
Cc: rivendell7@gmail.com, kuniyu@amazon.com, bpf@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH bpf 0/5] fix sockmap + stream af_unix memleak
Date: Tue, 02 Jan 2024 15:49:16 -0800 [thread overview]
Message-ID: <6594a0fc51d1d_11e86208c3@john.notmuch> (raw)
In-Reply-To: <87v88bvk0a.fsf@cloudflare.com>
Jakub Sitnicki wrote:
> On Thu, Dec 21, 2023 at 03:23 PM -08, John Fastabend wrote:
> > 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(-)
>
> Sorry for the delay. I was out.
Thanks for the review.
>
> This LGTM with some room for improvement in tests.
> You repeat the code to create different kind of sockets in each test.
> That could be refactored to use some kind of a factory helper.
Yeah, my first attempt was uglier than the repeated setup in my
opinion. So figured I would get this out and think a bit more
about it. Lets see if BPF maintainers want me to fix the typo
on Reported-by or if it can be fixed on merged.
>
> Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
next prev parent reply other threads:[~2024-01-02 23:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-21 23:23 [PATCH bpf 0/5] fix sockmap + stream af_unix memleak John Fastabend
2023-12-21 23:23 ` [PATCH bpf 1/5] bpf: sockmap, fix proto update hook to avoid dup calls John Fastabend
2024-01-02 12:00 ` Jakub Sitnicki
2024-01-04 1:00 ` Martin KaFai Lau
2024-01-04 3:47 ` John Fastabend
2023-12-21 23:23 ` [PATCH bpf 2/5] bpf: sockmap, added comments describing update proto rules John Fastabend
2023-12-21 23:23 ` [PATCH bpf 3/5] bpf: sockmap, add tests for proto updates many to single map John Fastabend
2023-12-21 23:23 ` [PATCH bpf 4/5] bpf: sockmap, add tests for proto updates single socket to many map John Fastabend
2023-12-21 23:23 ` [PATCH bpf 5/5] bpf: sockmap, add tests for proto updates replace socket John Fastabend
2024-01-02 15:18 ` [PATCH bpf 0/5] fix sockmap + stream af_unix memleak Jakub Sitnicki
2024-01-02 23:49 ` John Fastabend [this message]
2024-01-04 1:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6594a0fc51d1d_11e86208c3@john.notmuch \
--to=john.fastabend@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=jakub@cloudflare.com \
--cc=kuniyu@amazon.com \
--cc=netdev@vger.kernel.org \
--cc=rivendell7@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).