netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	netdev@vger.kernel.org, davem@davemloft.net
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	Hangbin Liu <liuhangbin@gmail.com>, Xiumei Mu <xmu@redhat.com>,
	Paolo Abeni <pabeni@redhat.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH net 06/10] wireguard: device: reset peer src endpoint when netns exits
Date: Tue, 30 Nov 2021 17:00:45 +0100	[thread overview]
Message-ID: <874k7t8wgi.fsf@toke.dk> (raw)
In-Reply-To: <20211129153929.3457-7-Jason@zx2c4.com>

"Jason A. Donenfeld" <Jason@zx2c4.com> writes:

> Each peer's endpoint contains a dst_cache entry that takes a reference
> to another netdev. When the containing namespace exits, we take down the
> socket and prevent future sockets from being created (by setting
> creating_net to NULL), which removes that potential reference on the
> netns. However, it doesn't release references to the netns that a netdev
> cached in dst_cache might be taking, so the netns still might fail to
> exit. Since the socket is gimped anyway, we can simply clear all the
> dst_caches (by way of clearing the endpoint src), which will release all
> references.
>
> However, the current dst_cache_reset function only releases those
> references lazily. But it turns out that all of our usages of
> wg_socket_clear_peer_endpoint_src are called from contexts that are not
> exactly high-speed or bottle-necked. For example, when there's
> connection difficulty, or when userspace is reconfiguring the interface.
> And in particular for this patch, when the netns is exiting. So for
> those cases, it makes more sense to call dst_release immediately. For
> that, we add a small helper function to dst_cache.
>
> This patch also adds a test to netns.sh from Hangbin Liu to ensure this
> doesn't regress.
>
> Test-by: Hangbin Liu <liuhangbin@gmail.com>
> Reported-by: Xiumei Mu <xmu@redhat.com>
> Cc: Hangbin Liu <liuhangbin@gmail.com>
> Cc: Toke Høiland-Jørgensen <toke@redhat.com>
> Cc: Paolo Abeni <pabeni@redhat.com>
> Fixes: 900575aa33a3 ("wireguard: device: avoid circular netns references")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>


  reply	other threads:[~2021-11-30 16:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 15:39 [PATCH net 00/10] wireguard/siphash patches for 5.16-rc6 Jason A. Donenfeld
2021-11-29 15:39 ` [PATCH net 01/10] wireguard: allowedips: add missing __rcu annotation to satisfy sparse Jason A. Donenfeld
2021-11-29 15:39 ` [PATCH net 02/10] wireguard: selftests: increase default dmesg log size Jason A. Donenfeld
2021-11-29 15:39 ` [PATCH net 03/10] wireguard: selftests: actually test for routing loops Jason A. Donenfeld
2021-11-29 15:39 ` [PATCH net 04/10] wireguard: main: rename 'mod_init' & 'mod_exit' functions to be module-specific Jason A. Donenfeld
2021-11-29 15:39 ` [PATCH net 05/10] wireguard: selftests: rename DEBUG_PI_LIST to DEBUG_PLIST Jason A. Donenfeld
2021-11-29 15:39 ` [PATCH net 06/10] wireguard: device: reset peer src endpoint when netns exits Jason A. Donenfeld
2021-11-30 16:00   ` Toke Høiland-Jørgensen [this message]
2021-11-29 15:39 ` [PATCH net 07/10] wireguard: receive: use ring buffer for incoming handshakes Jason A. Donenfeld
2021-11-29 15:39 ` [PATCH net 08/10] wireguard: receive: drop handshakes if queue lock is contended Jason A. Donenfeld
2021-11-29 15:39 ` [PATCH net 09/10] wireguard: ratelimiter: use kvcalloc() instead of kvzalloc() Jason A. Donenfeld
2021-11-29 15:39 ` [PATCH net 10/10] siphash: use _unaligned version by default Jason A. Donenfeld
2021-11-29 18:17 ` [PATCH net 00/10] wireguard/siphash patches for 5.16-rc6 Jakub Kicinski
2021-11-29 18:18   ` Jason A. Donenfeld

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=874k7t8wgi.fsf@toke.dk \
    --to=toke@redhat.com \
    --cc=Jason@zx2c4.com \
    --cc=davem@davemloft.net \
    --cc=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=xmu@redhat.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).