]> git.proxmox.com Git - mirror_ubuntu-impish-kernel.git/commit
wireguard: receive: drop handshakes if queue lock is contended
authorJason A. Donenfeld <Jason@zx2c4.com>
Mon, 29 Nov 2021 15:39:27 +0000 (10:39 -0500)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Fri, 18 Feb 2022 11:29:02 +0000 (12:29 +0100)
commit746edd6521e0e5310c81f290e76a22b7f128e6e4
treececccf1f92f571cd2f37fb55049c97c7918540ba
parent55f6134939627c7901a008b4cf8203cc9fa54952
wireguard: receive: drop handshakes if queue lock is contended

BugLink: https://bugs.launchpad.net/bugs/1956791
commit fb32f4f606c17b869805d7cede8b03d78339b50a upstream.

If we're being delivered packets from multiple CPUs so quickly that the
ring lock is contended for CPU tries, then it's safe to assume that the
queue is near capacity anyway, so just drop the packet rather than
spinning. This helps deal with multicore DoS that can interfere with
data path performance. It _still_ does not completely fix the issue, but
it again chips away at it.

Reported-by: Streun Fabio <fstreun@student.ethz.ch>
Fixes: e7096c131e51 ("net: WireGuard secure network tunnel")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/wireguard/receive.c