kernel-5.4: backport latest patches for wireguard
[openwrt/openwrt.git] / target / linux / generic / backport-5.4 / 080-wireguard-0129-wireguard-do-not-use-O3.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: "Jason A. Donenfeld" <Jason@zx2c4.com>
3 Date: Fri, 4 Jun 2021 17:17:32 +0200
4 Subject: [PATCH] wireguard: do not use -O3
5
6 commit cc5060ca0285efe2728bced399a1955a7ce808b2 upstream.
7
8 Apparently, various versions of gcc have O3-related miscompiles. Looking
9 at the difference between -O2 and -O3 for gcc 11 doesn't indicate
10 miscompiles, but the difference also doesn't seem so significant for
11 performance that it's worth risking.
12
13 Link: https://lore.kernel.org/lkml/CAHk-=wjuoGyxDhAF8SsrTkN0-YfCx7E6jUN3ikC_tn2AKWTTsA@mail.gmail.com/
14 Link: https://lore.kernel.org/lkml/CAHmME9otB5Wwxp7H8bR_i2uH2esEMvoBMC8uEXBMH9p0q1s6Bw@mail.gmail.com/
15 Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
16 Fixes: e7096c131e51 ("net: WireGuard secure network tunnel")
17 Cc: stable@vger.kernel.org
18 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
19 Signed-off-by: David S. Miller <davem@davemloft.net>
20 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
21 ---
22 drivers/net/wireguard/Makefile | 3 +--
23 1 file changed, 1 insertion(+), 2 deletions(-)
24
25 --- a/drivers/net/wireguard/Makefile
26 +++ b/drivers/net/wireguard/Makefile
27 @@ -1,5 +1,4 @@
28 -ccflags-y := -O3
29 -ccflags-y += -D'pr_fmt(fmt)=KBUILD_MODNAME ": " fmt'
30 +ccflags-y := -D'pr_fmt(fmt)=KBUILD_MODNAME ": " fmt'
31 ccflags-$(CONFIG_WIREGUARD_DEBUG) += -DDEBUG
32 wireguard-y := main.o
33 wireguard-y += noise.o