From: sdf@google.com
To: Jakub Sitnicki <jakub@cloudflare.com>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org,
kernel-team@cloudflare.com,
Alexei Starovoitov <alexei.starovoitov@gmail.com>
Subject: Re: [PATCH bpf v2] flow_dissector: Drop BPF flow dissector prog ref on netns cleanup
Date: Thu, 21 May 2020 08:21:11 -0700 [thread overview]
Message-ID: <20200521152111.GB49942@google.com> (raw)
In-Reply-To: <20200521083435.560256-1-jakub@cloudflare.com>
On 05/21, Jakub Sitnicki wrote:
> When attaching a flow dissector program to a network namespace with
> bpf(BPF_PROG_ATTACH, ...) we grab a reference to bpf_prog.
> If netns gets destroyed while a flow dissector is still attached, and
> there
> are no other references to the prog, we leak the reference and the program
> remains loaded.
> Leak can be reproduced by running flow dissector tests from selftests/bpf:
> # bpftool prog list
> # ./test_flow_dissector.sh
> ...
> selftests: test_flow_dissector [PASS]
> # bpftool prog list
> 4: flow_dissector name _dissect tag e314084d332a5338 gpl
> loaded_at 2020-05-20T18:50:53+0200 uid 0
> xlated 552B jited 355B memlock 4096B map_ids 3,4
> btf_id 4
> #
> Fix it by detaching the flow dissector program when netns is going away.
> Fixes: d58e468b1112 ("flow_dissector: implements flow dissector BPF hook")
> Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Reviewed-by: Stanislav Fomichev <sdf@google.com>
Thank you!
next prev parent reply other threads:[~2020-05-21 15:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-21 8:34 [PATCH bpf v2] flow_dissector: Drop BPF flow dissector prog ref on netns cleanup Jakub Sitnicki
2020-05-21 15:21 ` sdf [this message]
2020-05-21 18:14 ` Alexei Starovoitov
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=20200521152111.GB49942@google.com \
--to=sdf@google.com \
--cc=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=jakub@cloudflare.com \
--cc=kernel-team@cloudflare.com \
--cc=netdev@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.