netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <ast@plumgrid.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel <netfilter-devel@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Network Development <netdev@vger.kernel.org>,
	Daniel Borkmann <dborkman@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH net-next 2/2] net: filter: don't release unattached filter through call_rcu()
Date: Tue, 29 Jul 2014 09:09:46 -0700	[thread overview]
Message-ID: <CAMEtUuxGN_v5SP6HJ74p6fEuop6qXhe0Q-6tkpcCkrnsAtQUvw@mail.gmail.com> (raw)
In-Reply-To: <1406648188-3681-2-git-send-email-pablo@netfilter.org>

On Tue, Jul 29, 2014 at 8:36 AM, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> sk_unattached_filter_destroy() does not always need to release the
> filter object via rcu. Since this filter is never attached to the
> socket, the caller should be responsible for releasing the filter
> in a safe way, which may not necessarily imply rcu.
>
> This is a short summary of clients of this function:
>
> 1) xt_bpf.c and cls_bpf.c use the bpf matchers from rules, these rules
>    are removed from the packet path before the filter is released. Thus,
>    the framework makes sure the filter is safely removed.
>
> 2) In the ppp driver, the ppp_lock ensures serialization between the
>    xmit and filter attachment/detachment path. This doesn't use rcu
>    so deferred release via rcu makes no sense.
>
> 3) In the isdn/ppp driver, it is called from isdn_ppp_release()
>    the isdn_ppp_ioctl(). This driver uses mutex and spinlocks, no rcu.
>    Thus, deferred rcu makes no sense to me either, the deferred releases
>    may be just masking the effects of wrong locking strategy, which
>    should be fixed in the driver itself.
>
> 4) In the team driver, this is the only place where the rcu
>    synchronization with unattached filter is used. Therefore, this
>    patch introduces synchronize_rcu() which is called from the
>    genetlink path to make sure the filter doesn't go away while packets
>    are still walking over it. I think we can revisit this once struct
>    bpf_prog (that only wraps specific bpf code bits) is in place, then
>    add some specific struct rcu_head in the scope of the team driver if
>    Jiri thinks this is needed.

Correct.
There are also:
5) ptp_classifer - which is ok as well, since there is no filter_destroy.

6) seccomp - there I think it's also ok, since filter is called from syscall
and filter freeing is done on task exit

  reply	other threads:[~2014-07-29 16:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-29 15:36 [PATCH net-next 1/2] netfilter: xt_bpf: don't include linux/filter.h from uapi header Pablo Neira Ayuso
2014-07-29 15:36 ` [PATCH net-next 2/2] net: filter: don't release unattached filter through call_rcu() Pablo Neira Ayuso
2014-07-29 16:09   ` Alexei Starovoitov [this message]
2014-07-31  2:57   ` David Miller
2014-07-29 15:43 ` [PATCH net-next 1/2] netfilter: xt_bpf: don't include linux/filter.h from uapi header Willem de Bruijn
2014-07-29 16:05   ` Pablo Neira Ayuso
2014-07-29 16:35     ` Willem de Bruijn
2014-07-29 17:03       ` Pablo Neira Ayuso

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=CAMEtUuxGN_v5SP6HJ74p6fEuop6qXhe0Q-6tkpcCkrnsAtQUvw@mail.gmail.com \
    --to=ast@plumgrid.com \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=keescook@chromium.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=willemb@google.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).