diff --git a/.kernel.metadata b/.kernel.metadata index 0d744dd..cc4d48d 100644 --- a/.kernel.metadata +++ b/.kernel.metadata @@ -1,2 +1,2 @@ 98ae49ad49397d5a4dcb3ff9a082223edf7c5bbd SOURCES/linux-5.4.tar.xz -cefa9114a1401235edd870c17bb441802bfeeea0 SOURCES/patch-5.4.158.xz +bfb092322a79bc4d327dd4c44c355c4df17e2a56 SOURCES/patch-5.4.179.xz diff --git a/SOURCES/ACPI-scan-Fix-regression-related-to-X-Gene-UARTs.patch b/SOURCES/ACPI-scan-Fix-regression-related-to-X-Gene-UARTs.patch index 697d76e..2deedd2 100644 --- a/SOURCES/ACPI-scan-Fix-regression-related-to-X-Gene-UARTs.patch +++ b/SOURCES/ACPI-scan-Fix-regression-related-to-X-Gene-UARTs.patch @@ -19,8 +19,8 @@ diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index e1b6231cfa1c..542dafac4306 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c -@@ -1567,6 +1567,14 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) - if (!acpi_match_device_ids(device, i2c_multi_instantiate_ids)) +@@ -1614,6 +1614,14 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) + if (!acpi_match_device_ids(device, ignore_serial_bus_ids)) return false; + /* diff --git a/SOURCES/efi-secureboot.patch b/SOURCES/efi-secureboot.patch index ee53820..0332f8c 100644 --- a/SOURCES/efi-secureboot.patch +++ b/SOURCES/efi-secureboot.patch @@ -30,7 +30,7 @@ index a3763247547c..8d76d1f153ed 100644 + * @level: The lock-down level (can only increase) */ union security_list_options { - int (*binder_set_context_mgr)(struct task_struct *mgr); + int (*binder_set_context_mgr)(const struct cred *mgr); @@ -1818,6 +1824,7 @@ union security_list_options { void (*bpf_prog_free_security)(struct bpf_prog_aux *aux); #endif /* CONFIG_BPF_SYSCALL */ @@ -51,7 +51,7 @@ diff --git a/include/linux/security.h b/include/linux/security.h index a8d59d612d27..467b9ccdf993 100644 --- a/include/linux/security.h +++ b/include/linux/security.h -@@ -442,6 +442,7 @@ int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen); +@@ -445,6 +445,7 @@ int security_inode_notifysecctx(struct inode *inode, void *ctx, u32 ctxlen); int security_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen); int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen); int security_locked_down(enum lockdown_reason what); @@ -59,7 +59,7 @@ index a8d59d612d27..467b9ccdf993 100644 #else /* CONFIG_SECURITY */ static inline int call_blocking_lsm_notifier(enum lsm_event event, void *data) -@@ -1269,6 +1270,10 @@ static inline int security_locked_down(enum lockdown_reason what) +@@ -1277,6 +1278,10 @@ static inline int security_locked_down(enum lockdown_reason what) { return 0; } @@ -74,7 +74,7 @@ diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c index 8a10b43daf74..72a623075749 100644 --- a/security/lockdown/lockdown.c +++ b/security/lockdown/lockdown.c -@@ -97,6 +97,7 @@ static int lockdown_is_locked_down(enum lockdown_reason what) +@@ -100,6 +100,7 @@ static int lockdown_is_locked_down(enum lockdown_reason what) static struct security_hook_list lockdown_hooks[] __lsm_ro_after_init = { LSM_HOOK_INIT(locked_down, lockdown_is_locked_down), diff --git a/SOURCES/wireguard.patch b/SOURCES/wireguard.patch index 51d1285..6499cd5 100644 --- a/SOURCES/wireguard.patch +++ b/SOURCES/wireguard.patch @@ -1,7 +1,7 @@ -From f837c5a87b4c001536ae910db0e47660834aa702 Mon Sep 17 00:00:00 2001 +From 271dee10f7205d807f6362f7626043152d9e4737 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:07 +0100 -Subject: [PATCH 001/124] crypto: lib - tidy up lib/crypto Kconfig and Makefile +Subject: [PATCH 001/146] crypto: lib - tidy up lib/crypto Kconfig and Makefile commit 746b2e024c67aa605ac12d135cd7085a49cf9dc4 upstream. @@ -19,7 +19,7 @@ Signed-off-by: Jason A. Donenfeld create mode 100644 lib/crypto/Kconfig diff --git a/crypto/Kconfig b/crypto/Kconfig -index b2cc0ad3792ad..7d19b46a7ef72 100644 +index ce60ec30e78d..8de1ec5cc6d3 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -878,9 +878,6 @@ config CRYPTO_SHA1_PPC_SPE @@ -72,7 +72,7 @@ index b2cc0ad3792ad..7d19b46a7ef72 100644 source "certs/Kconfig" diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig new file mode 100644 -index 0000000000000..2614300515952 +index 000000000000..261430051595 --- /dev/null +++ b/lib/crypto/Kconfig @@ -0,0 +1,15 @@ @@ -92,7 +92,7 @@ index 0000000000000..2614300515952 +config CRYPTO_LIB_SHA256 + tristate diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile -index cbe0b6a6450d7..63de4cb3fcf82 100644 +index cbe0b6a6450d..63de4cb3fcf8 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -1,13 +1,13 @@ @@ -121,10 +121,10 @@ index cbe0b6a6450d7..63de4cb3fcf82 100644 2.18.4 -From 486db26fac0ce2d62b933679bdfaea488725cf00 Mon Sep 17 00:00:00 2001 +From 2da959b425a132ab7a5a68918413e46ddad0c8b6 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:08 +0100 -Subject: [PATCH 002/124] crypto: chacha - move existing library code into +Subject: [PATCH 002/146] crypto: chacha - move existing library code into lib/crypto commit 5fb8ef25803ef33e2eb60b626435828b937bed75 upstream. @@ -166,7 +166,7 @@ Signed-off-by: Jason A. Donenfeld create mode 100644 lib/crypto/libchacha.c diff --git a/arch/arm/crypto/chacha-neon-glue.c b/arch/arm/crypto/chacha-neon-glue.c -index a8e9b534c8da5..26576772f18bb 100644 +index a8e9b534c8da..26576772f18b 100644 --- a/arch/arm/crypto/chacha-neon-glue.c +++ b/arch/arm/crypto/chacha-neon-glue.c @@ -20,7 +20,7 @@ @@ -179,7 +179,7 @@ index a8e9b534c8da5..26576772f18bb 100644 #include #include diff --git a/arch/arm64/crypto/chacha-neon-glue.c b/arch/arm64/crypto/chacha-neon-glue.c -index 1495d2b18518d..d4cc61bfe79df 100644 +index 1495d2b18518..d4cc61bfe79d 100644 --- a/arch/arm64/crypto/chacha-neon-glue.c +++ b/arch/arm64/crypto/chacha-neon-glue.c @@ -20,7 +20,7 @@ @@ -192,7 +192,7 @@ index 1495d2b18518d..d4cc61bfe79df 100644 #include #include diff --git a/arch/x86/crypto/chacha_glue.c b/arch/x86/crypto/chacha_glue.c -index 388f95a4ec240..bc62daa8dafd3 100644 +index 388f95a4ec24..bc62daa8dafd 100644 --- a/arch/x86/crypto/chacha_glue.c +++ b/arch/x86/crypto/chacha_glue.c @@ -7,7 +7,7 @@ @@ -205,7 +205,7 @@ index 388f95a4ec240..bc62daa8dafd3 100644 #include #include diff --git a/crypto/Kconfig b/crypto/Kconfig -index 7d19b46a7ef72..f29bf10c04627 100644 +index 8de1ec5cc6d3..34a74bdc2d65 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -1393,6 +1393,7 @@ config CRYPTO_SALSA20 @@ -217,7 +217,7 @@ index 7d19b46a7ef72..f29bf10c04627 100644 help The ChaCha20, XChaCha20, and XChaCha12 stream cipher algorithms. diff --git a/crypto/chacha_generic.c b/crypto/chacha_generic.c -index 085d8d219987a..ebae6d9d9b320 100644 +index 085d8d219987..ebae6d9d9b32 100644 --- a/crypto/chacha_generic.c +++ b/crypto/chacha_generic.c @@ -8,29 +8,10 @@ @@ -315,7 +315,7 @@ index 085d8d219987a..ebae6d9d9b320 100644 /* Build the real IV */ diff --git a/include/crypto/chacha.h b/include/crypto/chacha.h -index d1e723c6a37dd..5c662f8fecac0 100644 +index d1e723c6a37d..5c662f8fecac 100644 --- a/include/crypto/chacha.h +++ b/include/crypto/chacha.h @@ -15,9 +15,8 @@ @@ -417,7 +417,7 @@ index d1e723c6a37dd..5c662f8fecac0 100644 #endif /* _CRYPTO_CHACHA_H */ diff --git a/include/crypto/internal/chacha.h b/include/crypto/internal/chacha.h new file mode 100644 -index 0000000000000..c0e40b2454311 +index 000000000000..c0e40b245431 --- /dev/null +++ b/include/crypto/internal/chacha.h @@ -0,0 +1,53 @@ @@ -475,7 +475,7 @@ index 0000000000000..c0e40b2454311 + +#endif /* _CRYPTO_CHACHA_H */ diff --git a/lib/Makefile b/lib/Makefile -index c5892807e06fa..5af38fd5cc603 100644 +index 3b8977aed1b4..d80ce6f0651f 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -26,8 +26,7 @@ endif @@ -489,7 +489,7 @@ index c5892807e06fa..5af38fd5cc603 100644 is_single_threaded.o plist.o decompress.o kobject_uevent.o \ earlycpio.o seq_buf.o siphash.o dec_and_lock.o \ diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig -index 2614300515952..6a11931ae1052 100644 +index 261430051595..6a11931ae105 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -8,6 +8,32 @@ config CRYPTO_LIB_AES @@ -526,7 +526,7 @@ index 2614300515952..6a11931ae1052 100644 tristate diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile -index 63de4cb3fcf82..0ce40604e104c 100644 +index 63de4cb3fcf8..0ce40604e104 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -1,5 +1,9 @@ @@ -543,7 +543,7 @@ diff --git a/lib/chacha.c b/lib/crypto/chacha.c similarity index 88% rename from lib/chacha.c rename to lib/crypto/chacha.c -index c7c9826564d31..65ead6b0c7e00 100644 +index c7c9826564d3..65ead6b0c7e0 100644 --- a/lib/chacha.c +++ b/lib/crypto/chacha.c @@ -5,9 +5,11 @@ @@ -605,7 +605,7 @@ index c7c9826564d31..65ead6b0c7e00 100644 +EXPORT_SYMBOL(hchacha_block_generic); diff --git a/lib/crypto/libchacha.c b/lib/crypto/libchacha.c new file mode 100644 -index 0000000000000..dabc3accae051 +index 000000000000..dabc3accae05 --- /dev/null +++ b/lib/crypto/libchacha.c @@ -0,0 +1,35 @@ @@ -648,10 +648,10 @@ index 0000000000000..dabc3accae051 2.18.4 -From 4d1398dc616f6c321d8f5fd80ee520b948685f58 Mon Sep 17 00:00:00 2001 +From 2d8a18e5bed95140a53519553bb77d752fef15d1 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:09 +0100 -Subject: [PATCH 003/124] crypto: x86/chacha - depend on generic chacha library +Subject: [PATCH 003/146] crypto: x86/chacha - depend on generic chacha library instead of crypto driver commit 28e8d89b1ce8d2e7badfb5f69971dd635acb8863 upstream. @@ -676,7 +676,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 36 insertions(+), 56 deletions(-) diff --git a/arch/x86/crypto/chacha_glue.c b/arch/x86/crypto/chacha_glue.c -index bc62daa8dafd3..0aabb382edce0 100644 +index bc62daa8dafd..0aabb382edce 100644 --- a/arch/x86/crypto/chacha_glue.c +++ b/arch/x86/crypto/chacha_glue.c @@ -123,37 +123,38 @@ static void chacha_dosimd(u32 *state, u8 *dst, const u8 *src, @@ -833,7 +833,7 @@ index bc62daa8dafd3..0aabb382edce0 100644 .decrypt = xchacha_simd, }, diff --git a/crypto/Kconfig b/crypto/Kconfig -index f29bf10c04627..564a3f7b40b85 100644 +index 34a74bdc2d65..ef7b0110ee75 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -1417,7 +1417,7 @@ config CRYPTO_CHACHA20_X86_64 @@ -849,10 +849,10 @@ index f29bf10c04627..564a3f7b40b85 100644 2.18.4 -From 2986afd33faf5ab5b79f158a050afd8afcafc252 Mon Sep 17 00:00:00 2001 +From 3612f658c8f86c5d866244d183a8d2d2d14df391 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:10 +0100 -Subject: [PATCH 004/124] crypto: x86/chacha - expose SIMD ChaCha routine as +Subject: [PATCH 004/146] crypto: x86/chacha - expose SIMD ChaCha routine as library function commit 84e03fa39fbe95a5567d43bff458c6d3b3a23ad1 upstream. @@ -877,7 +877,7 @@ Signed-off-by: Jason A. Donenfeld 3 files changed, 73 insertions(+), 25 deletions(-) diff --git a/arch/x86/crypto/chacha_glue.c b/arch/x86/crypto/chacha_glue.c -index 0aabb382edce0..b391e13a9e415 100644 +index 0aabb382edce..b391e13a9e41 100644 --- a/arch/x86/crypto/chacha_glue.c +++ b/arch/x86/crypto/chacha_glue.c @@ -21,24 +21,24 @@ asmlinkage void chacha_block_xor_ssse3(u32 *state, u8 *dst, const u8 *src, @@ -1033,7 +1033,7 @@ index 0aabb382edce0..b391e13a9e415 100644 } diff --git a/crypto/Kconfig b/crypto/Kconfig -index 564a3f7b40b85..649dc564f242b 100644 +index ef7b0110ee75..1c470ea34e47 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -1418,6 +1418,7 @@ config CRYPTO_CHACHA20_X86_64 @@ -1045,7 +1045,7 @@ index 564a3f7b40b85..649dc564f242b 100644 SSSE3, AVX2, and AVX-512VL optimized implementations of the ChaCha20, XChaCha20, and XChaCha12 stream ciphers. diff --git a/include/crypto/chacha.h b/include/crypto/chacha.h -index 5c662f8fecac0..2676f4fbd4c16 100644 +index 5c662f8fecac..2676f4fbd4c1 100644 --- a/include/crypto/chacha.h +++ b/include/crypto/chacha.h @@ -25,6 +25,12 @@ @@ -1065,10 +1065,10 @@ index 5c662f8fecac0..2676f4fbd4c16 100644 2.18.4 -From d5db614975ab83de25ecf2d37b53c621e3687db6 Mon Sep 17 00:00:00 2001 +From db199e89a3aac3ce4d5390a535d771db5ccc6e8b Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:11 +0100 -Subject: [PATCH 005/124] crypto: arm64/chacha - depend on generic chacha +Subject: [PATCH 005/146] crypto: arm64/chacha - depend on generic chacha library instead of crypto driver commit c77da4867cbb7841177275dbb250f5c09679fae4 upstream. @@ -1092,7 +1092,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/arch/arm64/crypto/Kconfig b/arch/arm64/crypto/Kconfig -index 4922c4451e7c3..fdf52d5f18f98 100644 +index 4922c4451e7c..fdf52d5f18f9 100644 --- a/arch/arm64/crypto/Kconfig +++ b/arch/arm64/crypto/Kconfig @@ -103,7 +103,7 @@ config CRYPTO_CHACHA20_NEON @@ -1105,7 +1105,7 @@ index 4922c4451e7c3..fdf52d5f18f98 100644 config CRYPTO_NHPOLY1305_NEON tristate "NHPoly1305 hash function using NEON instructions (for Adiantum)" diff --git a/arch/arm64/crypto/chacha-neon-glue.c b/arch/arm64/crypto/chacha-neon-glue.c -index d4cc61bfe79df..cae2cb92eca86 100644 +index d4cc61bfe79d..cae2cb92eca8 100644 --- a/arch/arm64/crypto/chacha-neon-glue.c +++ b/arch/arm64/crypto/chacha-neon-glue.c @@ -68,7 +68,7 @@ static int chacha_neon_stream_xor(struct skcipher_request *req, @@ -1202,10 +1202,10 @@ index d4cc61bfe79df..cae2cb92eca86 100644 2.18.4 -From 3733d4076464737c8262cf695486b6e5ff8ea926 Mon Sep 17 00:00:00 2001 +From 016777142db751598beb49f92d82aa3735ea7e20 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:12 +0100 -Subject: [PATCH 006/124] crypto: arm64/chacha - expose arm64 ChaCha routine as +Subject: [PATCH 006/146] crypto: arm64/chacha - expose arm64 ChaCha routine as library function commit b3aad5bad26a01a4bd8c49a5c5f52aec665f3b7c upstream. @@ -1228,7 +1228,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/arch/arm64/crypto/Kconfig b/arch/arm64/crypto/Kconfig -index fdf52d5f18f98..17bada4b9dd24 100644 +index fdf52d5f18f9..17bada4b9dd2 100644 --- a/arch/arm64/crypto/Kconfig +++ b/arch/arm64/crypto/Kconfig @@ -104,6 +104,7 @@ config CRYPTO_CHACHA20_NEON @@ -1240,7 +1240,7 @@ index fdf52d5f18f98..17bada4b9dd24 100644 config CRYPTO_NHPOLY1305_NEON tristate "NHPoly1305 hash function using NEON instructions (for Adiantum)" diff --git a/arch/arm64/crypto/chacha-neon-glue.c b/arch/arm64/crypto/chacha-neon-glue.c -index cae2cb92eca86..46cd4297761c1 100644 +index cae2cb92eca8..46cd4297761c 100644 --- a/arch/arm64/crypto/chacha-neon-glue.c +++ b/arch/arm64/crypto/chacha-neon-glue.c @@ -23,6 +23,7 @@ @@ -1348,10 +1348,10 @@ index cae2cb92eca86..46cd4297761c1 100644 2.18.4 -From 66bc54650635d91f3fa14e5046004253ee274d21 Mon Sep 17 00:00:00 2001 +From 378345389d8a237a8ed0a442b365dc9bec045137 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:13 +0100 -Subject: [PATCH 007/124] crypto: arm/chacha - import Eric Biggers's scalar +Subject: [PATCH 007/146] crypto: arm/chacha - import Eric Biggers's scalar accelerated ChaCha code commit 29621d099f9c642b22a69dc8e7e20c108473a392 upstream. @@ -1366,7 +1366,7 @@ Signed-off-by: Jason A. Donenfeld diff --git a/arch/arm/crypto/chacha-scalar-core.S b/arch/arm/crypto/chacha-scalar-core.S new file mode 100644 -index 0000000000000..2140319b64a05 +index 000000000000..2140319b64a0 --- /dev/null +++ b/arch/arm/crypto/chacha-scalar-core.S @@ -0,0 +1,461 @@ @@ -1835,10 +1835,10 @@ index 0000000000000..2140319b64a05 2.18.4 -From 3dc93d21cdf1ae9d93ed11e4ffd891b0d466a42d Mon Sep 17 00:00:00 2001 +From ebe29d1099ecce67b29520f1b6346a46cd11f92e Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:14 +0100 -Subject: [PATCH 008/124] crypto: arm/chacha - remove dependency on generic +Subject: [PATCH 008/146] crypto: arm/chacha - remove dependency on generic ChaCha driver commit b36d8c09e710c71f6a9690b6586fea2d1c9e1e27 upstream. @@ -1864,7 +1864,7 @@ Signed-off-by: Jason A. Donenfeld delete mode 100644 arch/arm/crypto/chacha-neon-glue.c diff --git a/arch/arm/crypto/Kconfig b/arch/arm/crypto/Kconfig -index 043b0b18bf7e0..cee414afeabc9 100644 +index 043b0b18bf7e..cee414afeabc 100644 --- a/arch/arm/crypto/Kconfig +++ b/arch/arm/crypto/Kconfig @@ -127,10 +127,8 @@ config CRYPTO_CRC32_ARM_CE @@ -1880,7 +1880,7 @@ index 043b0b18bf7e0..cee414afeabc9 100644 config CRYPTO_NHPOLY1305_NEON tristate "NEON accelerated NHPoly1305 hash function (for Adiantum)" diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile -index 4180f3a13512c..6b97dffcf90fa 100644 +index 4180f3a13512..6b97dffcf90f 100644 --- a/arch/arm/crypto/Makefile +++ b/arch/arm/crypto/Makefile @@ -53,7 +53,8 @@ aes-arm-ce-y := aes-ce-core.o aes-ce-glue.o @@ -1895,7 +1895,7 @@ index 4180f3a13512c..6b97dffcf90fa 100644 ifdef REGENERATE_ARM_CRYPTO diff --git a/arch/arm/crypto/chacha-glue.c b/arch/arm/crypto/chacha-glue.c new file mode 100644 -index 0000000000000..eb40efb3eb342 +index 000000000000..eb40efb3eb34 --- /dev/null +++ b/arch/arm/crypto/chacha-glue.c @@ -0,0 +1,304 @@ @@ -2205,7 +2205,7 @@ index 0000000000000..eb40efb3eb342 +#endif diff --git a/arch/arm/crypto/chacha-neon-glue.c b/arch/arm/crypto/chacha-neon-glue.c deleted file mode 100644 -index 26576772f18bb..0000000000000 +index 26576772f18b..000000000000 --- a/arch/arm/crypto/chacha-neon-glue.c +++ /dev/null @@ -1,202 +0,0 @@ @@ -2412,7 +2412,7 @@ index 26576772f18bb..0000000000000 -MODULE_ALIAS_CRYPTO("xchacha12"); -MODULE_ALIAS_CRYPTO("xchacha12-neon"); diff --git a/arch/arm/crypto/chacha-scalar-core.S b/arch/arm/crypto/chacha-scalar-core.S -index 2140319b64a05..2985b80a45b57 100644 +index 2140319b64a0..2985b80a45b5 100644 --- a/arch/arm/crypto/chacha-scalar-core.S +++ b/arch/arm/crypto/chacha-scalar-core.S @@ -41,14 +41,6 @@ @@ -2530,7 +2530,7 @@ index 2140319b64a05..2985b80a45b57 100644 + b 0b +ENDPROC(hchacha_block_arm) diff --git a/arch/arm64/crypto/chacha-neon-glue.c b/arch/arm64/crypto/chacha-neon-glue.c -index 46cd4297761c1..b08029d7bde62 100644 +index 46cd4297761c..b08029d7bde6 100644 --- a/arch/arm64/crypto/chacha-neon-glue.c +++ b/arch/arm64/crypto/chacha-neon-glue.c @@ -1,5 +1,5 @@ @@ -2544,10 +2544,10 @@ index 46cd4297761c1..b08029d7bde62 100644 2.18.4 -From 869e52c525ba428ecef3322eb2f76011f0bf9429 Mon Sep 17 00:00:00 2001 +From de5ec5e37bcd089bb1b93dfed9305fd78dd64571 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:15 +0100 -Subject: [PATCH 009/124] crypto: arm/chacha - expose ARM ChaCha routine as +Subject: [PATCH 009/146] crypto: arm/chacha - expose ARM ChaCha routine as library function commit a44a3430d71bad4ee56788a59fff099b291ea54c upstream. @@ -2570,7 +2570,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/arch/arm/crypto/Kconfig b/arch/arm/crypto/Kconfig -index cee414afeabc9..b25ffec044175 100644 +index cee414afeabc..b25ffec04417 100644 --- a/arch/arm/crypto/Kconfig +++ b/arch/arm/crypto/Kconfig @@ -129,6 +129,7 @@ config CRYPTO_CRC32_ARM_CE @@ -2582,7 +2582,7 @@ index cee414afeabc9..b25ffec044175 100644 config CRYPTO_NHPOLY1305_NEON tristate "NEON accelerated NHPoly1305 hash function (for Adiantum)" diff --git a/arch/arm/crypto/chacha-glue.c b/arch/arm/crypto/chacha-glue.c -index eb40efb3eb342..3f0c057aa0502 100644 +index eb40efb3eb34..3f0c057aa050 100644 --- a/arch/arm/crypto/chacha-glue.c +++ b/arch/arm/crypto/chacha-glue.c @@ -11,6 +11,7 @@ @@ -2660,10 +2660,10 @@ index eb40efb3eb342..3f0c057aa0502 100644 2.18.4 -From c8827e8fc886dcba8e1bef86d33e8230e143f23c Mon Sep 17 00:00:00 2001 +From f685eb625f286c4695dea150de5a1a863a54f2ce Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 8 Nov 2019 13:22:16 +0100 -Subject: [PATCH 010/124] crypto: mips/chacha - import 32r2 ChaCha code from +Subject: [PATCH 010/146] crypto: mips/chacha - import 32r2 ChaCha code from Zinc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -2687,7 +2687,7 @@ Signed-off-by: Jason A. Donenfeld diff --git a/arch/mips/crypto/chacha-core.S b/arch/mips/crypto/chacha-core.S new file mode 100644 -index 0000000000000..a81e02db95e73 +index 000000000000..a81e02db95e7 --- /dev/null +++ b/arch/mips/crypto/chacha-core.S @@ -0,0 +1,424 @@ @@ -3119,10 +3119,10 @@ index 0000000000000..a81e02db95e73 2.18.4 -From c4b698186d10ae6fa8665f330380734b3ab0959d Mon Sep 17 00:00:00 2001 +From b9f3108290c761a9004a0312d18334af5305c806 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:17 +0100 -Subject: [PATCH 011/124] crypto: mips/chacha - wire up accelerated 32r2 code +Subject: [PATCH 011/146] crypto: mips/chacha - wire up accelerated 32r2 code from Zinc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -3157,7 +3157,7 @@ Signed-off-by: Jason A. Donenfeld create mode 100644 arch/mips/crypto/chacha-glue.c diff --git a/arch/mips/Makefile b/arch/mips/Makefile -index 5403a91ce098d..573409c85c81b 100644 +index 9ff2c70763a0..a0726f972dbe 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile @@ -334,7 +334,7 @@ libs-$(CONFIG_MIPS_FP_SUPPORT) += arch/mips/math-emu/ @@ -3170,7 +3170,7 @@ index 5403a91ce098d..573409c85c81b 100644 # suspend and hibernation support diff --git a/arch/mips/crypto/Makefile b/arch/mips/crypto/Makefile -index e07aca572c2e1..b528b9d300f14 100644 +index e07aca572c2e..b528b9d300f1 100644 --- a/arch/mips/crypto/Makefile +++ b/arch/mips/crypto/Makefile @@ -4,3 +4,7 @@ @@ -3182,7 +3182,7 @@ index e07aca572c2e1..b528b9d300f14 100644 +chacha-mips-y := chacha-core.o chacha-glue.o +AFLAGS_chacha-core.o += -O2 # needed to fill branch delay slots diff --git a/arch/mips/crypto/chacha-core.S b/arch/mips/crypto/chacha-core.S -index a81e02db95e73..5755f69cfe007 100644 +index a81e02db95e7..5755f69cfe00 100644 --- a/arch/mips/crypto/chacha-core.S +++ b/arch/mips/crypto/chacha-core.S @@ -125,7 +125,7 @@ @@ -3519,7 +3519,7 @@ index a81e02db95e73..5755f69cfe007 100644 .set at diff --git a/arch/mips/crypto/chacha-glue.c b/arch/mips/crypto/chacha-glue.c new file mode 100644 -index 0000000000000..779e399c9befd +index 000000000000..779e399c9bef --- /dev/null +++ b/arch/mips/crypto/chacha-glue.c @@ -0,0 +1,150 @@ @@ -3674,7 +3674,7 @@ index 0000000000000..779e399c9befd +MODULE_ALIAS_CRYPTO("xchacha12"); +MODULE_ALIAS_CRYPTO("xchacha12-mips"); diff --git a/crypto/Kconfig b/crypto/Kconfig -index 649dc564f242b..6b5e14cee4753 100644 +index 1c470ea34e47..9650afc2107c 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -1423,6 +1423,12 @@ config CRYPTO_CHACHA20_X86_64 @@ -3694,10 +3694,10 @@ index 649dc564f242b..6b5e14cee4753 100644 2.18.4 -From 42ae586cf61580fe22fc4fc56593d9643698eb37 Mon Sep 17 00:00:00 2001 +From a79bdd09b996b65af19c189182a93145b93c26f0 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:18 +0100 -Subject: [PATCH 012/124] crypto: chacha - unexport chacha_generic routines +Subject: [PATCH 012/146] crypto: chacha - unexport chacha_generic routines commit 22cf705360707ced15f9fe5423938f313c7df536 upstream. @@ -3715,7 +3715,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/crypto/chacha_generic.c b/crypto/chacha_generic.c -index ebae6d9d9b320..c1b1473183938 100644 +index ebae6d9d9b32..c1b147318393 100644 --- a/crypto/chacha_generic.c +++ b/crypto/chacha_generic.c @@ -21,7 +21,7 @@ static int chacha_stream_xor(struct skcipher_request *req, @@ -3788,7 +3788,7 @@ index ebae6d9d9b320..c1b1473183938 100644 static struct skcipher_alg algs[] = { { diff --git a/include/crypto/internal/chacha.h b/include/crypto/internal/chacha.h -index c0e40b2454311..aa5d4a16aac5d 100644 +index c0e40b245431..aa5d4a16aac5 100644 --- a/include/crypto/internal/chacha.h +++ b/include/crypto/internal/chacha.h @@ -12,8 +12,6 @@ struct chacha_ctx { @@ -3817,10 +3817,10 @@ index c0e40b2454311..aa5d4a16aac5d 100644 2.18.4 -From 99f8d161e589d95cefb4abb791933f2737b24752 Mon Sep 17 00:00:00 2001 +From 4fd7287d2206d479f961ecbef70eaf33a70465ad Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:19 +0100 -Subject: [PATCH 013/124] crypto: poly1305 - move core routines into a separate +Subject: [PATCH 013/146] crypto: poly1305 - move core routines into a separate library commit 48ea8c6ebc96bc0990e12ee1c43d0832c23576bb upstream. @@ -3853,7 +3853,7 @@ Signed-off-by: Jason A. Donenfeld create mode 100644 lib/crypto/poly1305.c diff --git a/arch/x86/crypto/poly1305_glue.c b/arch/x86/crypto/poly1305_glue.c -index 4a1c05dce950f..6ccf8eb263243 100644 +index 4a1c05dce950..6ccf8eb26324 100644 --- a/arch/x86/crypto/poly1305_glue.c +++ b/arch/x86/crypto/poly1305_glue.c @@ -7,8 +7,8 @@ @@ -3867,7 +3867,7 @@ index 4a1c05dce950f..6ccf8eb263243 100644 #include #include diff --git a/crypto/Kconfig b/crypto/Kconfig -index 6b5e14cee4753..b70b9d7c6e2f6 100644 +index 9650afc2107c..8f37ec568d28 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -446,7 +446,7 @@ config CRYPTO_KEYWRAP @@ -3897,7 +3897,7 @@ index 6b5e14cee4753..b70b9d7c6e2f6 100644 Poly1305 authenticator algorithm, RFC7539. diff --git a/crypto/adiantum.c b/crypto/adiantum.c -index 395a3ddd37074..aded260922684 100644 +index 395a3ddd3707..aded26092268 100644 --- a/crypto/adiantum.c +++ b/crypto/adiantum.c @@ -33,6 +33,7 @@ @@ -3923,7 +3923,7 @@ index 395a3ddd37074..aded260922684 100644 poly1305_core_emit(&state, &rctx->header_hash); } diff --git a/crypto/nhpoly1305.c b/crypto/nhpoly1305.c -index 9ab4e07cde4dc..f6b6a52092b49 100644 +index 9ab4e07cde4d..f6b6a52092b4 100644 --- a/crypto/nhpoly1305.c +++ b/crypto/nhpoly1305.c @@ -33,6 +33,7 @@ @@ -3944,7 +3944,7 @@ index 9ab4e07cde4dc..f6b6a52092b49 100644 /* diff --git a/crypto/poly1305_generic.c b/crypto/poly1305_generic.c -index adc40298c7492..067f493c25043 100644 +index adc40298c749..067f493c2504 100644 --- a/crypto/poly1305_generic.c +++ b/crypto/poly1305_generic.c @@ -13,27 +13,12 @@ @@ -4196,7 +4196,7 @@ index adc40298c7492..067f493c25043 100644 poly1305_core_emit(&dctx->h, digest); diff --git a/include/crypto/internal/poly1305.h b/include/crypto/internal/poly1305.h new file mode 100644 -index 0000000000000..cb58e61f73a77 +index 000000000000..cb58e61f73a7 --- /dev/null +++ b/include/crypto/internal/poly1305.h @@ -0,0 +1,67 @@ @@ -4268,7 +4268,7 @@ index 0000000000000..cb58e61f73a77 + +#endif diff --git a/include/crypto/poly1305.h b/include/crypto/poly1305.h -index 34317ed2071e6..f5a4319c2a1f3 100644 +index 34317ed2071e..f5a4319c2a1f 100644 --- a/include/crypto/poly1305.h +++ b/include/crypto/poly1305.h @@ -38,27 +38,4 @@ struct poly1305_desc_ctx { @@ -4300,7 +4300,7 @@ index 34317ed2071e6..f5a4319c2a1f3 100644 - #endif diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig -index 6a11931ae1052..c4882d29879e8 100644 +index 6a11931ae105..c4882d29879e 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -37,5 +37,8 @@ config CRYPTO_LIB_CHACHA @@ -4313,7 +4313,7 @@ index 6a11931ae1052..c4882d29879e8 100644 config CRYPTO_LIB_SHA256 tristate diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile -index 0ce40604e104c..b58ab6843a9dc 100644 +index 0ce40604e104..b58ab6843a9d 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -13,5 +13,8 @@ libarc4-y := arc4.o @@ -4327,7 +4327,7 @@ index 0ce40604e104c..b58ab6843a9dc 100644 libsha256-y := sha256.o diff --git a/lib/crypto/poly1305.c b/lib/crypto/poly1305.c new file mode 100644 -index 0000000000000..f019a57dbc1b9 +index 000000000000..f019a57dbc1b --- /dev/null +++ b/lib/crypto/poly1305.c @@ -0,0 +1,158 @@ @@ -4493,10 +4493,10 @@ index 0000000000000..f019a57dbc1b9 2.18.4 -From 47470cabcc6502b9c0c85667149ec005d0c02727 Mon Sep 17 00:00:00 2001 +From ffaeede0cdc54f0270938d0b26789baca425e6bc Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:20 +0100 -Subject: [PATCH 014/124] crypto: x86/poly1305 - unify Poly1305 state struct +Subject: [PATCH 014/146] crypto: x86/poly1305 - unify Poly1305 state struct with generic code commit ad8f5b88383ea685f2b8df2a12ee3e08089a1287 upstream. @@ -4517,7 +4517,7 @@ Signed-off-by: Jason A. Donenfeld 4 files changed, 43 insertions(+), 73 deletions(-) diff --git a/arch/x86/crypto/poly1305_glue.c b/arch/x86/crypto/poly1305_glue.c -index 6ccf8eb263243..b43b93c95e798 100644 +index 6ccf8eb26324..b43b93c95e79 100644 --- a/arch/x86/crypto/poly1305_glue.c +++ b/arch/x86/crypto/poly1305_glue.c @@ -14,40 +14,14 @@ @@ -4671,7 +4671,7 @@ index 6ccf8eb263243..b43b93c95e798 100644 } diff --git a/crypto/poly1305_generic.c b/crypto/poly1305_generic.c -index 067f493c25043..f3fcd9578a47f 100644 +index 067f493c2504..f3fcd9578a47 100644 --- a/crypto/poly1305_generic.c +++ b/crypto/poly1305_generic.c @@ -25,7 +25,7 @@ int crypto_poly1305_init(struct shash_desc *desc) @@ -4702,7 +4702,7 @@ index 067f493c25043..f3fcd9578a47f 100644 poly1305_core_emit(&dctx->h, digest); diff --git a/include/crypto/internal/poly1305.h b/include/crypto/internal/poly1305.h -index cb58e61f73a77..04fa269e5534b 100644 +index cb58e61f73a7..04fa269e5534 100644 --- a/include/crypto/internal/poly1305.h +++ b/include/crypto/internal/poly1305.h @@ -46,10 +46,10 @@ unsigned int crypto_poly1305_setdesckey(struct poly1305_desc_ctx *dctx, @@ -4719,7 +4719,7 @@ index cb58e61f73a77..04fa269e5534b 100644 if (srclen >= POLY1305_BLOCK_SIZE) { dctx->s[0] = get_unaligned_le32(src + 0); diff --git a/include/crypto/poly1305.h b/include/crypto/poly1305.h -index f5a4319c2a1f3..36b5886cb50ca 100644 +index f5a4319c2a1f..36b5886cb50c 100644 --- a/include/crypto/poly1305.h +++ b/include/crypto/poly1305.h @@ -22,20 +22,20 @@ struct poly1305_state { @@ -4756,10 +4756,10 @@ index f5a4319c2a1f3..36b5886cb50ca 100644 2.18.4 -From 8291efef993737beb5330cf8d422d9a96e48f90f Mon Sep 17 00:00:00 2001 +From 1aeed083225545807d3a06ff9f75c5c76fab4b99 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:21 +0100 -Subject: [PATCH 015/124] crypto: poly1305 - expose init/update/final library +Subject: [PATCH 015/146] crypto: poly1305 - expose init/update/final library interface commit a1d93064094cc5e24d64e35cf093e7191d0c9344 upstream. @@ -4781,7 +4781,7 @@ Signed-off-by: Jason A. Donenfeld 4 files changed, 138 insertions(+), 22 deletions(-) diff --git a/crypto/poly1305_generic.c b/crypto/poly1305_generic.c -index f3fcd9578a47f..afe9a9e576dda 100644 +index f3fcd9578a47..afe9a9e576dd 100644 --- a/crypto/poly1305_generic.c +++ b/crypto/poly1305_generic.c @@ -85,31 +85,11 @@ EXPORT_SYMBOL_GPL(crypto_poly1305_update); @@ -4818,7 +4818,7 @@ index f3fcd9578a47f..afe9a9e576dda 100644 } EXPORT_SYMBOL_GPL(crypto_poly1305_final); diff --git a/include/crypto/poly1305.h b/include/crypto/poly1305.h -index 36b5886cb50ca..74c6e1cd73eee 100644 +index 36b5886cb50c..74c6e1cd73ee 100644 --- a/include/crypto/poly1305.h +++ b/include/crypto/poly1305.h @@ -35,7 +35,43 @@ struct poly1305_desc_ctx { @@ -4867,7 +4867,7 @@ index 36b5886cb50ca..74c6e1cd73eee 100644 + #endif diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig -index c4882d29879e8..a731ea36bd5c7 100644 +index c4882d29879e..a731ea36bd5c 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -37,8 +37,34 @@ config CRYPTO_LIB_CHACHA @@ -4906,7 +4906,7 @@ index c4882d29879e8..a731ea36bd5c7 100644 config CRYPTO_LIB_SHA256 tristate diff --git a/lib/crypto/poly1305.c b/lib/crypto/poly1305.c -index f019a57dbc1b9..32ec293c65ae7 100644 +index f019a57dbc1b..32ec293c65ae 100644 --- a/lib/crypto/poly1305.c +++ b/lib/crypto/poly1305.c @@ -154,5 +154,79 @@ void poly1305_core_emit(const struct poly1305_state *state, void *dst) @@ -4993,10 +4993,10 @@ index f019a57dbc1b9..32ec293c65ae7 100644 2.18.4 -From 5cfe536772b118c3d0b0b641ade09f7c28702cf0 Mon Sep 17 00:00:00 2001 +From 24833e4c6dd085c2aa95fec23e599166de131f1e Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:22 +0100 -Subject: [PATCH 016/124] crypto: x86/poly1305 - depend on generic library not +Subject: [PATCH 016/146] crypto: x86/poly1305 - depend on generic library not generic shash commit 1b2c6a5120489d41c8ea3b8dacd0b4586289b158 upstream. @@ -5023,7 +5023,7 @@ Signed-off-by: Jason A. Donenfeld 4 files changed, 60 insertions(+), 28 deletions(-) diff --git a/arch/x86/crypto/poly1305_glue.c b/arch/x86/crypto/poly1305_glue.c -index b43b93c95e798..a5b3a054604cf 100644 +index b43b93c95e79..a5b3a054604c 100644 --- a/arch/x86/crypto/poly1305_glue.c +++ b/arch/x86/crypto/poly1305_glue.c @@ -34,6 +34,24 @@ static void poly1305_simd_mult(u32 *a, const u32 *b) @@ -5128,7 +5128,7 @@ index b43b93c95e798..a5b3a054604cf 100644 } diff --git a/crypto/Kconfig b/crypto/Kconfig -index b70b9d7c6e2f6..6178aa6271412 100644 +index 8f37ec568d28..96bba4227de9 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -697,7 +697,7 @@ config CRYPTO_POLY1305 @@ -5141,7 +5141,7 @@ index b70b9d7c6e2f6..6178aa6271412 100644 Poly1305 authenticator algorithm, RFC7539. diff --git a/crypto/poly1305_generic.c b/crypto/poly1305_generic.c -index afe9a9e576dda..21edbd8c99fbc 100644 +index afe9a9e576dd..21edbd8c99fb 100644 --- a/crypto/poly1305_generic.c +++ b/crypto/poly1305_generic.c @@ -19,7 +19,7 @@ @@ -5192,7 +5192,7 @@ index afe9a9e576dda..21edbd8c99fbc 100644 static struct shash_alg poly1305_alg = { .digestsize = POLY1305_DIGEST_SIZE, diff --git a/include/crypto/internal/poly1305.h b/include/crypto/internal/poly1305.h -index 04fa269e5534b..479b0cab2a1ad 100644 +index 04fa269e5534..479b0cab2a1a 100644 --- a/include/crypto/internal/poly1305.h +++ b/include/crypto/internal/poly1305.h @@ -10,8 +10,6 @@ @@ -5222,10 +5222,10 @@ index 04fa269e5534b..479b0cab2a1ad 100644 2.18.4 -From 2f8ebf1715067c70601ec62750dff68888c8c9bf Mon Sep 17 00:00:00 2001 +From eef09a0ac7d1288ccc29a1322a78f0f70f225e70 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:23 +0100 -Subject: [PATCH 017/124] crypto: x86/poly1305 - expose existing driver as +Subject: [PATCH 017/146] crypto: x86/poly1305 - expose existing driver as poly1305 library commit f0e89bcfbb894e5844cd1bbf6b3cf7c63cb0f5ac upstream. @@ -5244,7 +5244,7 @@ Signed-off-by: Jason A. Donenfeld 3 files changed, 43 insertions(+), 16 deletions(-) diff --git a/arch/x86/crypto/poly1305_glue.c b/arch/x86/crypto/poly1305_glue.c -index a5b3a054604cf..370cd88068ec1 100644 +index a5b3a054604c..370cd88068ec 100644 --- a/arch/x86/crypto/poly1305_glue.c +++ b/arch/x86/crypto/poly1305_glue.c @@ -10,6 +10,7 @@ @@ -5369,7 +5369,7 @@ index a5b3a054604cf..370cd88068ec1 100644 return crypto_register_shash(&alg); } diff --git a/crypto/Kconfig b/crypto/Kconfig -index 6178aa6271412..15cfb02c3e49c 100644 +index 96bba4227de9..aa1d3478275e 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -698,6 +698,7 @@ config CRYPTO_POLY1305_X86_64 @@ -5381,7 +5381,7 @@ index 6178aa6271412..15cfb02c3e49c 100644 Poly1305 authenticator algorithm, RFC7539. diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig -index a731ea36bd5c7..181754615f734 100644 +index a731ea36bd5c..181754615f73 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -39,6 +39,7 @@ config CRYPTO_LIB_DES @@ -5396,10 +5396,10 @@ index a731ea36bd5c7..181754615f734 100644 2.18.4 -From 0092ab396571a017764b48f1a6712ff3d4b8e807 Mon Sep 17 00:00:00 2001 +From a15ff1794e9868659f640d67b9928b765a97b839 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:24 +0100 -Subject: [PATCH 018/124] crypto: arm64/poly1305 - incorporate +Subject: [PATCH 018/146] crypto: arm64/poly1305 - incorporate OpenSSL/CRYPTOGAMS NEON implementation commit f569ca16475155013525686d0f73bc379c67e635 upstream. @@ -5431,7 +5431,7 @@ Signed-off-by: Jason A. Donenfeld create mode 100644 arch/arm64/crypto/poly1305-glue.c diff --git a/arch/arm64/crypto/Kconfig b/arch/arm64/crypto/Kconfig -index 17bada4b9dd24..30d9b24ee86e3 100644 +index 17bada4b9dd2..30d9b24ee86e 100644 --- a/arch/arm64/crypto/Kconfig +++ b/arch/arm64/crypto/Kconfig @@ -106,6 +106,12 @@ config CRYPTO_CHACHA20_NEON @@ -5448,7 +5448,7 @@ index 17bada4b9dd24..30d9b24ee86e3 100644 tristate "NHPoly1305 hash function using NEON instructions (for Adiantum)" depends on KERNEL_MODE_NEON diff --git a/arch/arm64/crypto/Makefile b/arch/arm64/crypto/Makefile -index 0435f2a0610ed..d0901e610df3b 100644 +index 0435f2a0610e..d0901e610df3 100644 --- a/arch/arm64/crypto/Makefile +++ b/arch/arm64/crypto/Makefile @@ -50,6 +50,10 @@ sha512-arm64-y := sha512-glue.o sha512-core.o @@ -5481,7 +5481,7 @@ index 0435f2a0610ed..d0901e610df3b 100644 +clean-files += poly1305-core.S sha256-core.S sha512-core.S diff --git a/arch/arm64/crypto/poly1305-armv8.pl b/arch/arm64/crypto/poly1305-armv8.pl new file mode 100644 -index 0000000000000..6e5576d19af8f +index 000000000000..6e5576d19af8 --- /dev/null +++ b/arch/arm64/crypto/poly1305-armv8.pl @@ -0,0 +1,913 @@ @@ -6400,7 +6400,7 @@ index 0000000000000..6e5576d19af8f +close STDOUT; diff --git a/arch/arm64/crypto/poly1305-core.S_shipped b/arch/arm64/crypto/poly1305-core.S_shipped new file mode 100644 -index 0000000000000..8d1c4e420ccdc +index 000000000000..8d1c4e420ccd --- /dev/null +++ b/arch/arm64/crypto/poly1305-core.S_shipped @@ -0,0 +1,835 @@ @@ -7241,7 +7241,7 @@ index 0000000000000..8d1c4e420ccdc +#endif diff --git a/arch/arm64/crypto/poly1305-glue.c b/arch/arm64/crypto/poly1305-glue.c new file mode 100644 -index 0000000000000..dd843d0ee83ab +index 000000000000..dd843d0ee83a --- /dev/null +++ b/arch/arm64/crypto/poly1305-glue.c @@ -0,0 +1,237 @@ @@ -7483,7 +7483,7 @@ index 0000000000000..dd843d0ee83ab +MODULE_ALIAS_CRYPTO("poly1305"); +MODULE_ALIAS_CRYPTO("poly1305-neon"); diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig -index 181754615f734..9923445e82251 100644 +index 181754615f73..9923445e8225 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -40,6 +40,7 @@ config CRYPTO_LIB_DES @@ -7498,10 +7498,10 @@ index 181754615f734..9923445e82251 100644 2.18.4 -From 345b8fd17611a5ff6766173aedee074d4cdd39c0 Mon Sep 17 00:00:00 2001 +From 5df9cc7dc50cfcf9176628c999be54e1abbc325d Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:25 +0100 -Subject: [PATCH 019/124] crypto: arm/poly1305 - incorporate OpenSSL/CRYPTOGAMS +Subject: [PATCH 019/146] crypto: arm/poly1305 - incorporate OpenSSL/CRYPTOGAMS NEON implementation commit a6b803b3ddc793d6db0c16f12fc12d30d20fa9cc upstream. @@ -7533,7 +7533,7 @@ Signed-off-by: Jason A. Donenfeld create mode 100644 arch/arm/crypto/poly1305-glue.c diff --git a/arch/arm/crypto/Kconfig b/arch/arm/crypto/Kconfig -index b25ffec044175..2e8a9289bded3 100644 +index b25ffec04417..2e8a9289bded 100644 --- a/arch/arm/crypto/Kconfig +++ b/arch/arm/crypto/Kconfig @@ -131,6 +131,11 @@ config CRYPTO_CHACHA20_NEON @@ -7549,7 +7549,7 @@ index b25ffec044175..2e8a9289bded3 100644 tristate "NEON accelerated NHPoly1305 hash function (for Adiantum)" depends on KERNEL_MODE_NEON diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile -index 6b97dffcf90fa..4f6a8a81dabc1 100644 +index 6b97dffcf90f..4f6a8a81dabc 100644 --- a/arch/arm/crypto/Makefile +++ b/arch/arm/crypto/Makefile @@ -10,6 +10,7 @@ obj-$(CONFIG_CRYPTO_SHA1_ARM_NEON) += sha1-arm-neon.o @@ -7590,7 +7590,7 @@ index 6b97dffcf90fa..4f6a8a81dabc1 100644 +AFLAGS_poly1305-core.o += $(poly1305-aflags-y) diff --git a/arch/arm/crypto/poly1305-armv4.pl b/arch/arm/crypto/poly1305-armv4.pl new file mode 100644 -index 0000000000000..6d79498d3115f +index 000000000000..6d79498d3115 --- /dev/null +++ b/arch/arm/crypto/poly1305-armv4.pl @@ -0,0 +1,1236 @@ @@ -8832,7 +8832,7 @@ index 0000000000000..6d79498d3115f +close STDOUT; # enforce flush diff --git a/arch/arm/crypto/poly1305-core.S_shipped b/arch/arm/crypto/poly1305-core.S_shipped new file mode 100644 -index 0000000000000..37b71d9902932 +index 000000000000..37b71d990293 --- /dev/null +++ b/arch/arm/crypto/poly1305-core.S_shipped @@ -0,0 +1,1158 @@ @@ -9996,7 +9996,7 @@ index 0000000000000..37b71d9902932 +.align 2 diff --git a/arch/arm/crypto/poly1305-glue.c b/arch/arm/crypto/poly1305-glue.c new file mode 100644 -index 0000000000000..74a725ac89c9f +index 000000000000..74a725ac89c9 --- /dev/null +++ b/arch/arm/crypto/poly1305-glue.c @@ -0,0 +1,276 @@ @@ -10277,7 +10277,7 @@ index 0000000000000..74a725ac89c9f +MODULE_ALIAS_CRYPTO("poly1305-arm"); +MODULE_ALIAS_CRYPTO("poly1305-neon"); diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig -index 9923445e82251..9bd15b227e78e 100644 +index 9923445e8225..9bd15b227e78 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -40,7 +40,7 @@ config CRYPTO_LIB_DES @@ -10293,10 +10293,10 @@ index 9923445e82251..9bd15b227e78e 100644 2.18.4 -From 2348b97a26987fbf36690d4d7ca3058e38379811 Mon Sep 17 00:00:00 2001 +From dc6c731b838b0a32764f1fa4a1203bb712f3da1a Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:26 +0100 -Subject: [PATCH 020/124] crypto: mips/poly1305 - incorporate +Subject: [PATCH 020/146] crypto: mips/poly1305 - incorporate OpenSSL/CRYPTOGAMS optimized implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -10331,7 +10331,7 @@ Signed-off-by: Jason A. Donenfeld create mode 100644 arch/mips/crypto/poly1305-mips.pl diff --git a/arch/mips/crypto/Makefile b/arch/mips/crypto/Makefile -index b528b9d300f14..8e1deaf00e0c0 100644 +index b528b9d300f1..8e1deaf00e0c 100644 --- a/arch/mips/crypto/Makefile +++ b/arch/mips/crypto/Makefile @@ -8,3 +8,17 @@ obj-$(CONFIG_CRYPTO_CRC32_MIPS) += crc32-mips.o @@ -10354,7 +10354,7 @@ index b528b9d300f14..8e1deaf00e0c0 100644 +targets += poly1305-core.S diff --git a/arch/mips/crypto/poly1305-glue.c b/arch/mips/crypto/poly1305-glue.c new file mode 100644 -index 0000000000000..b759b6ccc361c +index 000000000000..b759b6ccc361 --- /dev/null +++ b/arch/mips/crypto/poly1305-glue.c @@ -0,0 +1,203 @@ @@ -10563,7 +10563,7 @@ index 0000000000000..b759b6ccc361c +MODULE_ALIAS_CRYPTO("poly1305-mips"); diff --git a/arch/mips/crypto/poly1305-mips.pl b/arch/mips/crypto/poly1305-mips.pl new file mode 100644 -index 0000000000000..b05bab884ed26 +index 000000000000..b05bab884ed2 --- /dev/null +++ b/arch/mips/crypto/poly1305-mips.pl @@ -0,0 +1,1273 @@ @@ -11841,7 +11841,7 @@ index 0000000000000..b05bab884ed26 +print $code; +close STDOUT; diff --git a/crypto/Kconfig b/crypto/Kconfig -index 15cfb02c3e49c..0be5b4092f189 100644 +index aa1d3478275e..cd1497e64d9d 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -707,6 +707,11 @@ config CRYPTO_POLY1305_X86_64 @@ -11857,7 +11857,7 @@ index 15cfb02c3e49c..0be5b4092f189 100644 tristate "MD4 digest algorithm" select CRYPTO_HASH diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig -index 9bd15b227e78e..d15ec53829861 100644 +index 9bd15b227e78..d15ec5382986 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -39,6 +39,7 @@ config CRYPTO_LIB_DES @@ -11872,10 +11872,10 @@ index 9bd15b227e78e..d15ec53829861 100644 2.18.4 -From 10a9cc350b21ce53ebf1947174df3e3e874fdf6f Mon Sep 17 00:00:00 2001 +From b2ab6e55c7da449a21e2265dfbab6c5014928b35 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 8 Nov 2019 13:22:28 +0100 -Subject: [PATCH 021/124] crypto: blake2s - generic C library implementation +Subject: [PATCH 021/146] crypto: blake2s - generic C library implementation and selftest commit 66d7fb94e4ffe5acc589e0b2b4710aecc1f07a28 upstream. @@ -11915,7 +11915,7 @@ Signed-off-by: Jason A. Donenfeld diff --git a/include/crypto/blake2s.h b/include/crypto/blake2s.h new file mode 100644 -index 0000000000000..b471deac28ff8 +index 000000000000..b471deac28ff --- /dev/null +++ b/include/crypto/blake2s.h @@ -0,0 +1,106 @@ @@ -12027,7 +12027,7 @@ index 0000000000000..b471deac28ff8 +#endif /* BLAKE2S_H */ diff --git a/include/crypto/internal/blake2s.h b/include/crypto/internal/blake2s.h new file mode 100644 -index 0000000000000..941693effc7d2 +index 000000000000..941693effc7d --- /dev/null +++ b/include/crypto/internal/blake2s.h @@ -0,0 +1,19 @@ @@ -12051,7 +12051,7 @@ index 0000000000000..941693effc7d2 + +#endif /* BLAKE2S_INTERNAL_H */ diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig -index d15ec53829861..7ad98b624e554 100644 +index d15ec5382986..7ad98b624e55 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -8,6 +8,31 @@ config CRYPTO_LIB_AES @@ -12087,7 +12087,7 @@ index d15ec53829861..7ad98b624e554 100644 tristate help diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile -index b58ab6843a9dc..8ca66b5f9807b 100644 +index b58ab6843a9d..8ca66b5f9807 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -10,6 +10,12 @@ libaes-y := aes.o @@ -12113,7 +12113,7 @@ index b58ab6843a9dc..8ca66b5f9807b 100644 +endif diff --git a/lib/crypto/blake2s-generic.c b/lib/crypto/blake2s-generic.c new file mode 100644 -index 0000000000000..04ff8df245136 +index 000000000000..04ff8df24513 --- /dev/null +++ b/lib/crypto/blake2s-generic.c @@ -0,0 +1,111 @@ @@ -12230,7 +12230,7 @@ index 0000000000000..04ff8df245136 +MODULE_AUTHOR("Jason A. Donenfeld "); diff --git a/lib/crypto/blake2s-selftest.c b/lib/crypto/blake2s-selftest.c new file mode 100644 -index 0000000000000..79ef404a990d2 +index 000000000000..79ef404a990d --- /dev/null +++ b/lib/crypto/blake2s-selftest.c @@ -0,0 +1,622 @@ @@ -12858,7 +12858,7 @@ index 0000000000000..79ef404a990d2 +} diff --git a/lib/crypto/blake2s.c b/lib/crypto/blake2s.c new file mode 100644 -index 0000000000000..41025a30c524c +index 000000000000..41025a30c524 --- /dev/null +++ b/lib/crypto/blake2s.c @@ -0,0 +1,126 @@ @@ -12992,10 +12992,10 @@ index 0000000000000..41025a30c524c 2.18.4 -From 2c9be16c41086f9711514bba2b168afeb9b9ca32 Mon Sep 17 00:00:00 2001 +From 56954e6ccb5c67035be1c9279dcf4f3d2767f50a Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:29 +0100 -Subject: [PATCH 022/124] crypto: testmgr - add test cases for Blake2s +Subject: [PATCH 022/146] crypto: testmgr - add test cases for Blake2s commit 17e1df67023a5c9ccaeb5de8bf5b88f63127ecf7 upstream. @@ -13024,7 +13024,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 275 insertions(+) diff --git a/crypto/testmgr.c b/crypto/testmgr.c -index 7473c5bc06b1a..711390861f716 100644 +index 7473c5bc06b1..711390861f71 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -4034,6 +4034,30 @@ static const struct alg_test_desc alg_test_descs[] = { @@ -13059,7 +13059,7 @@ index 7473c5bc06b1a..711390861f716 100644 .alg = "cbc(aes)", .test = alg_test_skcipher, diff --git a/crypto/testmgr.h b/crypto/testmgr.h -index ef7d21f39d4a9..102fcad549665 100644 +index ef7d21f39d4a..102fcad54966 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h @@ -31567,4 +31567,255 @@ static const struct aead_testvec essiv_hmac_sha256_aes_cbc_tv_temp[] = { @@ -13322,10 +13322,10 @@ index ef7d21f39d4a9..102fcad549665 100644 2.18.4 -From 743713032edbf3bf915e94d5ed9bdd6200315082 Mon Sep 17 00:00:00 2001 +From 0befa584fc73951270f52b5d4814ed97ea73b2a2 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:30 +0100 -Subject: [PATCH 023/124] crypto: blake2s - implement generic shash driver +Subject: [PATCH 023/146] crypto: blake2s - implement generic shash driver commit 7f9b0880925f1f9d7d59504ea0892d2ae9cfc233 upstream. @@ -13343,7 +13343,7 @@ Signed-off-by: Jason A. Donenfeld create mode 100644 crypto/blake2s_generic.c diff --git a/crypto/Kconfig b/crypto/Kconfig -index 0be5b4092f189..81c8a4059afcf 100644 +index cd1497e64d9d..e60c08264820 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -639,6 +639,24 @@ config CRYPTO_XXHASH @@ -13372,7 +13372,7 @@ index 0be5b4092f189..81c8a4059afcf 100644 tristate "CRCT10DIF algorithm" select CRYPTO_HASH diff --git a/crypto/Makefile b/crypto/Makefile -index aa740c8492b9d..fd27edea7c8ec 100644 +index aa740c8492b9..fd27edea7c8e 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -74,6 +74,7 @@ obj-$(CONFIG_CRYPTO_STREEBOG) += streebog_generic.o @@ -13385,7 +13385,7 @@ index aa740c8492b9d..fd27edea7c8ec 100644 obj-$(CONFIG_CRYPTO_CBC) += cbc.o diff --git a/crypto/blake2s_generic.c b/crypto/blake2s_generic.c new file mode 100644 -index 0000000000000..ed0c746404703 +index 000000000000..ed0c74640470 --- /dev/null +++ b/crypto/blake2s_generic.c @@ -0,0 +1,171 @@ @@ -13561,7 +13561,7 @@ index 0000000000000..ed0c746404703 +MODULE_ALIAS_CRYPTO("blake2s-256-generic"); +MODULE_LICENSE("GPL v2"); diff --git a/include/crypto/internal/blake2s.h b/include/crypto/internal/blake2s.h -index 941693effc7d2..74ff77032e526 100644 +index 941693effc7d..74ff77032e52 100644 --- a/include/crypto/internal/blake2s.h +++ b/include/crypto/internal/blake2s.h @@ -5,6 +5,11 @@ @@ -13580,10 +13580,10 @@ index 941693effc7d2..74ff77032e526 100644 2.18.4 -From 47b565ca50ef44abf472f7c1215122add1848566 Mon Sep 17 00:00:00 2001 +From 52e01d695f727f32057320233fe89c56e94f326c Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 8 Nov 2019 13:22:31 +0100 -Subject: [PATCH 024/124] crypto: blake2s - x86_64 SIMD implementation +Subject: [PATCH 024/146] crypto: blake2s - x86_64 SIMD implementation commit ed0356eda153f6a95649e11feb7b07083caf9e20 upstream. @@ -13608,7 +13608,7 @@ Signed-off-by: Jason A. Donenfeld create mode 100644 arch/x86/crypto/blake2s-glue.c diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile -index 759b1a927826b..922c8ecfa00f5 100644 +index 759b1a927826..922c8ecfa00f 100644 --- a/arch/x86/crypto/Makefile +++ b/arch/x86/crypto/Makefile @@ -48,6 +48,7 @@ ifeq ($(avx_supported),yes) @@ -13629,7 +13629,7 @@ index 759b1a927826b..922c8ecfa00f5 100644 camellia-aesni-avx-x86_64-y := camellia-aesni-avx-asm_64.o \ diff --git a/arch/x86/crypto/blake2s-core.S b/arch/x86/crypto/blake2s-core.S new file mode 100644 -index 0000000000000..8591938eee26d +index 000000000000..8591938eee26 --- /dev/null +++ b/arch/x86/crypto/blake2s-core.S @@ -0,0 +1,258 @@ @@ -13893,7 +13893,7 @@ index 0000000000000..8591938eee26d +#endif /* CONFIG_AS_AVX512 */ diff --git a/arch/x86/crypto/blake2s-glue.c b/arch/x86/crypto/blake2s-glue.c new file mode 100644 -index 0000000000000..4a37ba7cdbe52 +index 000000000000..4a37ba7cdbe5 --- /dev/null +++ b/arch/x86/crypto/blake2s-glue.c @@ -0,0 +1,233 @@ @@ -14131,7 +14131,7 @@ index 0000000000000..4a37ba7cdbe52 +MODULE_ALIAS_CRYPTO("blake2s-256-x86"); +MODULE_LICENSE("GPL v2"); diff --git a/crypto/Kconfig b/crypto/Kconfig -index 81c8a4059afcf..8fd3954bf64c5 100644 +index e60c08264820..73427ae80857 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -657,6 +657,12 @@ config CRYPTO_BLAKE2S @@ -14151,10 +14151,10 @@ index 81c8a4059afcf..8fd3954bf64c5 100644 2.18.4 -From d2eb2dcca95981dab0429adcad504a6200ec3c79 Mon Sep 17 00:00:00 2001 +From 45e840c5915b2e891eb2de2b0dba969a5b6e4754 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 8 Nov 2019 13:22:32 +0100 -Subject: [PATCH 025/124] crypto: curve25519 - generic C library +Subject: [PATCH 025/146] crypto: curve25519 - generic C library implementations commit 0ed42a6f431e930b2e8fae21955406e09fe75d70 upstream. @@ -14195,7 +14195,7 @@ Signed-off-by: Jason A. Donenfeld diff --git a/include/crypto/curve25519.h b/include/crypto/curve25519.h new file mode 100644 -index 0000000000000..4e6dc840b1592 +index 000000000000..4e6dc840b159 --- /dev/null +++ b/include/crypto/curve25519.h @@ -0,0 +1,71 @@ @@ -14271,7 +14271,7 @@ index 0000000000000..4e6dc840b1592 + +#endif /* CURVE25519_H */ diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig -index 7ad98b624e554..b1d830dc1c9e0 100644 +index 7ad98b624e55..b1d830dc1c9e 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -59,6 +59,31 @@ config CRYPTO_LIB_CHACHA @@ -14307,7 +14307,7 @@ index 7ad98b624e554..b1d830dc1c9e0 100644 tristate diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile -index 8ca66b5f9807b..273c55d5e147b 100644 +index 8ca66b5f9807..273c55d5e147 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -16,6 +16,11 @@ libblake2s-generic-y += blake2s-generic.o @@ -14324,7 +14324,7 @@ index 8ca66b5f9807b..273c55d5e147b 100644 diff --git a/lib/crypto/curve25519-fiat32.c b/lib/crypto/curve25519-fiat32.c new file mode 100644 -index 0000000000000..1c455207341d3 +index 000000000000..1c455207341d --- /dev/null +++ b/lib/crypto/curve25519-fiat32.c @@ -0,0 +1,864 @@ @@ -15194,7 +15194,7 @@ index 0000000000000..1c455207341d3 +} diff --git a/lib/crypto/curve25519-hacl64.c b/lib/crypto/curve25519-hacl64.c new file mode 100644 -index 0000000000000..771d82dc5f14e +index 000000000000..771d82dc5f14 --- /dev/null +++ b/lib/crypto/curve25519-hacl64.c @@ -0,0 +1,788 @@ @@ -15988,7 +15988,7 @@ index 0000000000000..771d82dc5f14e +} diff --git a/lib/crypto/curve25519.c b/lib/crypto/curve25519.c new file mode 100644 -index 0000000000000..0106bebe69008 +index 000000000000..0106bebe6900 --- /dev/null +++ b/lib/crypto/curve25519.c @@ -0,0 +1,25 @@ @@ -16021,10 +16021,10 @@ index 0000000000000..0106bebe69008 2.18.4 -From 113295e01877ba4524b22338f84665baa2f3f514 Mon Sep 17 00:00:00 2001 +From 845a3e260be38877faa8ba32bbaa37c738cdf48c Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:33 +0100 -Subject: [PATCH 026/124] crypto: curve25519 - add kpp selftest +Subject: [PATCH 026/146] crypto: curve25519 - add kpp selftest commit f613457a7af085728297bef71233c37faf3c01b1 upstream. @@ -16041,7 +16041,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 1231 insertions(+) diff --git a/crypto/testmgr.c b/crypto/testmgr.c -index 711390861f716..57ab993b9ad25 100644 +index 711390861f71..57ab993b9ad2 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -4295,6 +4295,12 @@ static const struct alg_test_desc alg_test_descs[] = { @@ -16058,7 +16058,7 @@ index 711390861f716..57ab993b9ad25 100644 .alg = "deflate", .test = alg_test_comp, diff --git a/crypto/testmgr.h b/crypto/testmgr.h -index 102fcad549665..5d132ae996b4a 100644 +index 102fcad54966..5d132ae996b4 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h @@ -1030,6 +1030,1231 @@ static const struct kpp_testvec dh_tv_template[] = { @@ -17297,10 +17297,10 @@ index 102fcad549665..5d132ae996b4a 100644 2.18.4 -From f6e91a9e2e4043cf94357163bacdcdebf36c82b4 Mon Sep 17 00:00:00 2001 +From 32b45fd6963e15408bb8c486c7e9aa50bb2c2602 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:34 +0100 -Subject: [PATCH 027/124] crypto: curve25519 - implement generic KPP driver +Subject: [PATCH 027/146] crypto: curve25519 - implement generic KPP driver commit ee772cb641135739c1530647391d5a04c39db192 upstream. @@ -17317,7 +17317,7 @@ Signed-off-by: Jason A. Donenfeld create mode 100644 crypto/curve25519-generic.c diff --git a/crypto/Kconfig b/crypto/Kconfig -index 8fd3954bf64c5..a3fc859830c1e 100644 +index 73427ae80857..e96b33e83061 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -264,6 +264,11 @@ config CRYPTO_ECRDSA @@ -17333,7 +17333,7 @@ index 8fd3954bf64c5..a3fc859830c1e 100644 config CRYPTO_CCM diff --git a/crypto/Makefile b/crypto/Makefile -index fd27edea7c8ec..4e7a0a8f7e357 100644 +index fd27edea7c8e..4e7a0a8f7e35 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -167,6 +167,7 @@ obj-$(CONFIG_CRYPTO_ZSTD) += zstd.o @@ -17346,7 +17346,7 @@ index fd27edea7c8ec..4e7a0a8f7e357 100644 ecdh_generic-y += ecdh_helper.o diff --git a/crypto/curve25519-generic.c b/crypto/curve25519-generic.c new file mode 100644 -index 0000000000000..bd88fd571393d +index 000000000000..bd88fd571393 --- /dev/null +++ b/crypto/curve25519-generic.c @@ -0,0 +1,90 @@ @@ -17444,10 +17444,10 @@ index 0000000000000..bd88fd571393d 2.18.4 -From a9c096766c049ea2699d216bc425875d63d83dc6 Mon Sep 17 00:00:00 2001 +From f7f0065825c1870dbf47739e4120e8a478823ee1 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:35 +0100 -Subject: [PATCH 028/124] crypto: lib/curve25519 - work around Clang stack +Subject: [PATCH 028/146] crypto: lib/curve25519 - work around Clang stack spilling issue commit 660bb8e1f833ea63185fe80fde847e3e42f18e3b upstream. @@ -17473,7 +17473,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/crypto/curve25519-fiat32.c b/lib/crypto/curve25519-fiat32.c -index 1c455207341d3..2fde0ec33dbd0 100644 +index 1c455207341d..2fde0ec33dbd 100644 --- a/lib/crypto/curve25519-fiat32.c +++ b/lib/crypto/curve25519-fiat32.c @@ -223,7 +223,7 @@ static __always_inline void fe_1(fe *h) @@ -17525,10 +17525,10 @@ index 1c455207341d3..2fde0ec33dbd0 100644 2.18.4 -From 7734a4c33e8bde8cfb004406db17663b1eecfce2 Mon Sep 17 00:00:00 2001 +From 009505e1455e4ecbb8f21726fe223afdc1595b14 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 8 Nov 2019 13:22:36 +0100 -Subject: [PATCH 029/124] crypto: curve25519 - x86_64 library and KPP +Subject: [PATCH 029/146] crypto: curve25519 - x86_64 library and KPP implementations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -17560,7 +17560,7 @@ Signed-off-by: Jason A. Donenfeld create mode 100644 arch/x86/crypto/curve25519-x86_64.c diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile -index 922c8ecfa00f5..958440eae27ec 100644 +index 922c8ecfa00f..958440eae27e 100644 --- a/arch/x86/crypto/Makefile +++ b/arch/x86/crypto/Makefile @@ -39,6 +39,7 @@ obj-$(CONFIG_CRYPTO_AEGIS128_AESNI_SSE2) += aegis128-aesni.o @@ -17573,7 +17573,7 @@ index 922c8ecfa00f5..958440eae27ec 100644 ifeq ($(avx_supported),yes) diff --git a/arch/x86/crypto/curve25519-x86_64.c b/arch/x86/crypto/curve25519-x86_64.c new file mode 100644 -index 0000000000000..a52a3fb157279 +index 000000000000..a52a3fb15727 --- /dev/null +++ b/arch/x86/crypto/curve25519-x86_64.c @@ -0,0 +1,2475 @@ @@ -20053,7 +20053,7 @@ index 0000000000000..a52a3fb157279 +MODULE_ALIAS_CRYPTO("curve25519-x86"); +MODULE_LICENSE("GPL v2"); diff --git a/crypto/Kconfig b/crypto/Kconfig -index a3fc859830c1e..b8b738bcc3120 100644 +index e96b33e83061..22b8a3517037 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -269,6 +269,12 @@ config CRYPTO_CURVE25519 @@ -20073,10 +20073,10 @@ index a3fc859830c1e..b8b738bcc3120 100644 2.18.4 -From 1091501f32d5f28d52dbb95a51c2bc649fed3174 Mon Sep 17 00:00:00 2001 +From 0d8c039251886cc6baa974ad248e6724be64aba8 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 8 Nov 2019 13:22:37 +0100 -Subject: [PATCH 030/124] crypto: arm/curve25519 - import Bernstein and +Subject: [PATCH 030/146] crypto: arm/curve25519 - import Bernstein and Schwabe's Curve25519 ARM implementation commit f0fb006b604f98e2309a30f34ef455ac734f7c1c upstream. @@ -20102,7 +20102,7 @@ Signed-off-by: Jason A. Donenfeld diff --git a/arch/arm/crypto/curve25519-core.S b/arch/arm/crypto/curve25519-core.S new file mode 100644 -index 0000000000000..f33b85fef3823 +index 000000000000..f33b85fef382 --- /dev/null +++ b/arch/arm/crypto/curve25519-core.S @@ -0,0 +1,2105 @@ @@ -22215,10 +22215,10 @@ index 0000000000000..f33b85fef3823 2.18.4 -From edccee320f62aca101d12b96b718ba24544da005 Mon Sep 17 00:00:00 2001 +From 76569fd21007e8efdf7e2abbc5f224efa0a518bf Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 8 Nov 2019 13:22:38 +0100 -Subject: [PATCH 031/124] crypto: arm/curve25519 - wire up NEON implementation +Subject: [PATCH 031/146] crypto: arm/curve25519 - wire up NEON implementation commit d8f1308a025fc7e00414194ed742d5f05a21e13c upstream. @@ -22266,7 +22266,7 @@ Signed-off-by: Jason A. Donenfeld create mode 100644 arch/arm/crypto/curve25519-glue.c diff --git a/arch/arm/crypto/Kconfig b/arch/arm/crypto/Kconfig -index 2e8a9289bded3..61fa7e4aa8f9e 100644 +index 2e8a9289bded..61fa7e4aa8f9 100644 --- a/arch/arm/crypto/Kconfig +++ b/arch/arm/crypto/Kconfig @@ -141,4 +141,10 @@ config CRYPTO_NHPOLY1305_NEON @@ -22281,7 +22281,7 @@ index 2e8a9289bded3..61fa7e4aa8f9e 100644 + endif diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile -index 4f6a8a81dabc1..7700385cec9ff 100644 +index 4f6a8a81dabc..7700385cec9f 100644 --- a/arch/arm/crypto/Makefile +++ b/arch/arm/crypto/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_CRYPTO_SHA512_ARM) += sha512-arm.o @@ -22301,7 +22301,7 @@ index 4f6a8a81dabc1..7700385cec9ff 100644 ifdef REGENERATE_ARM_CRYPTO quiet_cmd_perl = PERL $@ diff --git a/arch/arm/crypto/curve25519-core.S b/arch/arm/crypto/curve25519-core.S -index f33b85fef3823..be18af52e7dc9 100644 +index f33b85fef382..be18af52e7dc 100644 --- a/arch/arm/crypto/curve25519-core.S +++ b/arch/arm/crypto/curve25519-core.S @@ -1,43 +1,35 @@ @@ -23151,7 +23151,7 @@ index f33b85fef3823..be18af52e7dc9 100644 +ENDPROC(curve25519_neon) diff --git a/arch/arm/crypto/curve25519-glue.c b/arch/arm/crypto/curve25519-glue.c new file mode 100644 -index 0000000000000..2e9e12d2f642a +index 000000000000..2e9e12d2f642 --- /dev/null +++ b/arch/arm/crypto/curve25519-glue.c @@ -0,0 +1,127 @@ @@ -23286,10 +23286,10 @@ index 0000000000000..2e9e12d2f642a 2.18.4 -From ef108824294502bb5f580c18bd9436600e40f66c Mon Sep 17 00:00:00 2001 +From 5e14603e78b62d7f806b3f1d363b288a1a9297ad Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:39 +0100 -Subject: [PATCH 032/124] crypto: chacha20poly1305 - import construction and +Subject: [PATCH 032/146] crypto: chacha20poly1305 - import construction and selftest from Zinc commit ed20078b7e3331e82828be357147af6a3282e4ce upstream. @@ -23319,7 +23319,7 @@ Signed-off-by: Jason A. Donenfeld diff --git a/include/crypto/chacha20poly1305.h b/include/crypto/chacha20poly1305.h new file mode 100644 -index 0000000000000..ad3b1de58df89 +index 000000000000..ad3b1de58df8 --- /dev/null +++ b/include/crypto/chacha20poly1305.h @@ -0,0 +1,37 @@ @@ -23361,7 +23361,7 @@ index 0000000000000..ad3b1de58df89 + +#endif /* __CHACHA20POLY1305_H */ diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig -index b1d830dc1c9e0..0b2c4fce26d95 100644 +index b1d830dc1c9e..0b2c4fce26d9 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -119,5 +119,12 @@ config CRYPTO_LIB_POLY1305 @@ -23378,7 +23378,7 @@ index b1d830dc1c9e0..0b2c4fce26d95 100644 config CRYPTO_LIB_SHA256 tristate diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile -index 273c55d5e147b..34a701ab8b92e 100644 +index 273c55d5e147..34a701ab8b92 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -16,6 +16,9 @@ libblake2s-generic-y += blake2s-generic.o @@ -23399,7 +23399,7 @@ index 273c55d5e147b..34a701ab8b92e 100644 endif diff --git a/lib/crypto/chacha20poly1305-selftest.c b/lib/crypto/chacha20poly1305-selftest.c new file mode 100644 -index 0000000000000..d1ed0f27cfdbd +index 000000000000..d1ed0f27cfdb --- /dev/null +++ b/lib/crypto/chacha20poly1305-selftest.c @@ -0,0 +1,7348 @@ @@ -30753,7 +30753,7 @@ index 0000000000000..d1ed0f27cfdbd +} diff --git a/lib/crypto/chacha20poly1305.c b/lib/crypto/chacha20poly1305.c new file mode 100644 -index 0000000000000..c12ddbe9eb92a +index 000000000000..c12ddbe9eb92 --- /dev/null +++ b/lib/crypto/chacha20poly1305.c @@ -0,0 +1,219 @@ @@ -30980,10 +30980,10 @@ index 0000000000000..c12ddbe9eb92a 2.18.4 -From 72cffc6045b0175214aa5e4dfc0f5b2c9e090daf Mon Sep 17 00:00:00 2001 +From 742fdd73b41f922f73bc62c80529fcde532d54fe Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 8 Nov 2019 13:22:40 +0100 -Subject: [PATCH 033/124] crypto: lib/chacha20poly1305 - reimplement +Subject: [PATCH 033/146] crypto: lib/chacha20poly1305 - reimplement crypt_from_sg() routine commit d95312a3ccc0cd544d374be2fc45aeaa803e5fd9 upstream. @@ -31017,7 +31017,7 @@ Signed-off-by: Jason A. Donenfeld 3 files changed, 206 insertions(+) diff --git a/include/crypto/chacha20poly1305.h b/include/crypto/chacha20poly1305.h -index ad3b1de58df89..234ee28078efd 100644 +index ad3b1de58df8..234ee28078ef 100644 --- a/include/crypto/chacha20poly1305.h +++ b/include/crypto/chacha20poly1305.h @@ -7,6 +7,7 @@ @@ -31044,7 +31044,7 @@ index ad3b1de58df89..234ee28078efd 100644 + #endif /* __CHACHA20POLY1305_H */ diff --git a/lib/crypto/chacha20poly1305-selftest.c b/lib/crypto/chacha20poly1305-selftest.c -index d1ed0f27cfdbd..465de46dbdef2 100644 +index d1ed0f27cfdb..465de46dbdef 100644 --- a/lib/crypto/chacha20poly1305-selftest.c +++ b/lib/crypto/chacha20poly1305-selftest.c @@ -7250,6 +7250,7 @@ bool __init chacha20poly1305_selftest(void) @@ -31114,7 +31114,7 @@ index d1ed0f27cfdbd..465de46dbdef2 100644 for (i = 0; i < ARRAY_SIZE(xchacha20poly1305_enc_vectors); ++i) { memset(computed_output, 0, MAXIMUM_TEST_BUFFER_LEN); diff --git a/lib/crypto/chacha20poly1305.c b/lib/crypto/chacha20poly1305.c -index c12ddbe9eb92a..821e5cc9b14eb 100644 +index c12ddbe9eb92..821e5cc9b14e 100644 --- a/lib/crypto/chacha20poly1305.c +++ b/lib/crypto/chacha20poly1305.c @@ -11,6 +11,7 @@ @@ -31285,10 +31285,10 @@ index c12ddbe9eb92a..821e5cc9b14eb 100644 2.18.4 -From cca92a35ad8eba8e260236418efc9f4ab8e6d2fd Mon Sep 17 00:00:00 2001 +From a0ebd377f18896ea96d1582779cd8470442ee52c Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 17 Nov 2019 23:21:29 -0800 -Subject: [PATCH 034/124] crypto: chacha_generic - remove unnecessary setkey() +Subject: [PATCH 034/146] crypto: chacha_generic - remove unnecessary setkey() functions commit 2043323a799a660bc84bbee404cf7a2617ec6157 upstream. @@ -31306,7 +31306,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/crypto/chacha_generic.c b/crypto/chacha_generic.c -index c1b1473183938..8beea79ab1178 100644 +index c1b147318393..8beea79ab117 100644 --- a/crypto/chacha_generic.c +++ b/crypto/chacha_generic.c @@ -37,18 +37,6 @@ static int chacha_stream_xor(struct skcipher_request *req, @@ -31359,10 +31359,10 @@ index c1b1473183938..8beea79ab1178 100644 2.18.4 -From f89aff92754c9ace0d91bd99b84c75307db915fc Mon Sep 17 00:00:00 2001 +From 302a308f701836dbab03e85350949451f09b2cd0 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 17 Nov 2019 23:21:58 -0800 -Subject: [PATCH 035/124] crypto: x86/chacha - only unregister algorithms if +Subject: [PATCH 035/146] crypto: x86/chacha - only unregister algorithms if registered commit b62755aed3a3f5ca9edd2718339ccea3b6bbbe57 upstream. @@ -31380,7 +31380,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/crypto/chacha_glue.c b/arch/x86/crypto/chacha_glue.c -index b391e13a9e415..a94e30b6f9413 100644 +index b391e13a9e41..a94e30b6f941 100644 --- a/arch/x86/crypto/chacha_glue.c +++ b/arch/x86/crypto/chacha_glue.c @@ -304,7 +304,8 @@ static int __init chacha_simd_mod_init(void) @@ -31397,10 +31397,10 @@ index b391e13a9e415..a94e30b6f9413 100644 2.18.4 -From 5eb742c619e60b30997e914c3208fea2f7dae232 Mon Sep 17 00:00:00 2001 +From dec1d274471d946c3e6f19f00312629f2f19e512 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 17 Nov 2019 23:22:16 -0800 -Subject: [PATCH 036/124] crypto: lib/chacha20poly1305 - use chacha20_crypt() +Subject: [PATCH 036/146] crypto: lib/chacha20poly1305 - use chacha20_crypt() commit 413808b71e6204b0cc1eeaa77960f7c3cd381d33 upstream. @@ -31417,7 +31417,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/crypto/chacha20poly1305.c b/lib/crypto/chacha20poly1305.c -index 821e5cc9b14eb..6d83cafebc69c 100644 +index 821e5cc9b14e..6d83cafebc69 100644 --- a/lib/crypto/chacha20poly1305.c +++ b/lib/crypto/chacha20poly1305.c @@ -66,14 +66,14 @@ __chacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, @@ -31486,10 +31486,10 @@ index 821e5cc9b14eb..6d83cafebc69c 100644 2.18.4 -From 75a98dd69b85921932935966062555b06b687800 Mon Sep 17 00:00:00 2001 +From 300ad7f2fa05c33b05f31847c1e44c8864438f2a Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 25 Nov 2019 11:31:12 +0100 -Subject: [PATCH 037/124] crypto: arch - conditionalize crypto api in arch glue +Subject: [PATCH 037/146] crypto: arch - conditionalize crypto api in arch glue for lib code commit 8394bfec51e0e565556101bcc4e2fe7551104cd8 upstream. @@ -31519,7 +31519,7 @@ Signed-off-by: Jason A. Donenfeld 11 files changed, 53 insertions(+), 32 deletions(-) diff --git a/arch/arm/crypto/chacha-glue.c b/arch/arm/crypto/chacha-glue.c -index 3f0c057aa0502..7bdf8823066d0 100644 +index 3f0c057aa050..7bdf8823066d 100644 --- a/arch/arm/crypto/chacha-glue.c +++ b/arch/arm/crypto/chacha-glue.c @@ -286,11 +286,13 @@ static struct skcipher_alg neon_algs[] = { @@ -31570,7 +31570,7 @@ index 3f0c057aa0502..7bdf8823066d0 100644 module_init(chacha_simd_mod_init); diff --git a/arch/arm/crypto/curve25519-glue.c b/arch/arm/crypto/curve25519-glue.c -index 2e9e12d2f642a..f3f42cf3b8937 100644 +index 2e9e12d2f642..f3f42cf3b893 100644 --- a/arch/arm/crypto/curve25519-glue.c +++ b/arch/arm/crypto/curve25519-glue.c @@ -108,14 +108,15 @@ static int __init mod_init(void) @@ -31592,7 +31592,7 @@ index 2e9e12d2f642a..f3f42cf3b8937 100644 } diff --git a/arch/arm/crypto/poly1305-glue.c b/arch/arm/crypto/poly1305-glue.c -index 74a725ac89c9f..abe3f2d587dcb 100644 +index 74a725ac89c9..abe3f2d587dc 100644 --- a/arch/arm/crypto/poly1305-glue.c +++ b/arch/arm/crypto/poly1305-glue.c @@ -249,16 +249,19 @@ static int __init arm_poly1305_mod_init(void) @@ -31619,7 +31619,7 @@ index 74a725ac89c9f..abe3f2d587dcb 100644 crypto_unregister_shash(&arm_poly1305_algs[0]); return; diff --git a/arch/arm64/crypto/chacha-neon-glue.c b/arch/arm64/crypto/chacha-neon-glue.c -index b08029d7bde62..71c11d2e9fcda 100644 +index b08029d7bde6..71c11d2e9fcd 100644 --- a/arch/arm64/crypto/chacha-neon-glue.c +++ b/arch/arm64/crypto/chacha-neon-glue.c @@ -211,12 +211,13 @@ static int __init chacha_simd_mod_init(void) @@ -31639,7 +31639,7 @@ index b08029d7bde62..71c11d2e9fcda 100644 } diff --git a/arch/arm64/crypto/poly1305-glue.c b/arch/arm64/crypto/poly1305-glue.c -index dd843d0ee83ab..83a2338a88263 100644 +index dd843d0ee83a..83a2338a8826 100644 --- a/arch/arm64/crypto/poly1305-glue.c +++ b/arch/arm64/crypto/poly1305-glue.c @@ -220,12 +220,13 @@ static int __init neon_poly1305_mod_init(void) @@ -31659,7 +31659,7 @@ index dd843d0ee83ab..83a2338a88263 100644 } diff --git a/arch/mips/crypto/chacha-glue.c b/arch/mips/crypto/chacha-glue.c -index 779e399c9befd..90896029d0cdf 100644 +index 779e399c9bef..90896029d0cd 100644 --- a/arch/mips/crypto/chacha-glue.c +++ b/arch/mips/crypto/chacha-glue.c @@ -128,12 +128,14 @@ static struct skcipher_alg algs[] = { @@ -31680,7 +31680,7 @@ index 779e399c9befd..90896029d0cdf 100644 module_init(chacha_simd_mod_init); diff --git a/arch/mips/crypto/poly1305-glue.c b/arch/mips/crypto/poly1305-glue.c -index b759b6ccc361c..b37d29cf5d0a8 100644 +index b759b6ccc361..b37d29cf5d0a 100644 --- a/arch/mips/crypto/poly1305-glue.c +++ b/arch/mips/crypto/poly1305-glue.c @@ -187,12 +187,14 @@ static struct shash_alg mips_poly1305_alg = { @@ -31701,7 +31701,7 @@ index b759b6ccc361c..b37d29cf5d0a8 100644 module_init(mips_poly1305_mod_init); diff --git a/arch/x86/crypto/blake2s-glue.c b/arch/x86/crypto/blake2s-glue.c -index 4a37ba7cdbe52..1d9ff8a45e1fd 100644 +index 4a37ba7cdbe5..1d9ff8a45e1f 100644 --- a/arch/x86/crypto/blake2s-glue.c +++ b/arch/x86/crypto/blake2s-glue.c @@ -210,12 +210,14 @@ static int __init blake2s_mod_init(void) @@ -31722,7 +31722,7 @@ index 4a37ba7cdbe52..1d9ff8a45e1fd 100644 } diff --git a/arch/x86/crypto/chacha_glue.c b/arch/x86/crypto/chacha_glue.c -index a94e30b6f9413..1bebe11b9ec95 100644 +index a94e30b6f941..1bebe11b9ec9 100644 --- a/arch/x86/crypto/chacha_glue.c +++ b/arch/x86/crypto/chacha_glue.c @@ -299,12 +299,13 @@ static int __init chacha_simd_mod_init(void) @@ -31742,7 +31742,7 @@ index a94e30b6f9413..1bebe11b9ec95 100644 } diff --git a/arch/x86/crypto/curve25519-x86_64.c b/arch/x86/crypto/curve25519-x86_64.c -index a52a3fb157279..eec7d2d242396 100644 +index a52a3fb15727..eec7d2d24239 100644 --- a/arch/x86/crypto/curve25519-x86_64.c +++ b/arch/x86/crypto/curve25519-x86_64.c @@ -2457,13 +2457,14 @@ static int __init curve25519_mod_init(void) @@ -31764,7 +31764,7 @@ index a52a3fb157279..eec7d2d242396 100644 } diff --git a/arch/x86/crypto/poly1305_glue.c b/arch/x86/crypto/poly1305_glue.c -index 370cd88068ec1..0cc4537e6617c 100644 +index 370cd88068ec..0cc4537e6617 100644 --- a/arch/x86/crypto/poly1305_glue.c +++ b/arch/x86/crypto/poly1305_glue.c @@ -224,12 +224,13 @@ static int __init poly1305_simd_mod_init(void) @@ -31787,10 +31787,10 @@ index 370cd88068ec1..0cc4537e6617c 100644 2.18.4 -From cc6f8c60d6936f78b9212bdc1f0bff61343b8152 Mon Sep 17 00:00:00 2001 +From 8b2c8ed5af1a2d895c659ce0060a6eef821fdbfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valdis=20Kl=C4=93tnieks?= Date: Thu, 5 Dec 2019 20:58:36 -0500 -Subject: [PATCH 038/124] crypto: chacha - fix warning message in header file +Subject: [PATCH 038/146] crypto: chacha - fix warning message in header file commit 579d705cd64e44f3fcda1a6cfd5f37468a5ddf63 upstream. @@ -31812,7 +31812,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/crypto/internal/chacha.h b/include/crypto/internal/chacha.h -index aa5d4a16aac5d..b085dc1ac1516 100644 +index aa5d4a16aac5..b085dc1ac151 100644 --- a/include/crypto/internal/chacha.h +++ b/include/crypto/internal/chacha.h @@ -34,7 +34,7 @@ static inline int chacha20_setkey(struct crypto_skcipher *tfm, const u8 *key, @@ -31828,10 +31828,10 @@ index aa5d4a16aac5d..b085dc1ac1516 100644 2.18.4 -From 138ca9bd09bcd8ce0a013f3a75e9de260a6e6d64 Mon Sep 17 00:00:00 2001 +From 93d629ec7c2a5f227a9633444439bdd9e411d9ec Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 11 Dec 2019 10:26:39 +0100 -Subject: [PATCH 039/124] crypto: arm/curve25519 - add arch-specific key +Subject: [PATCH 039/146] crypto: arm/curve25519 - add arch-specific key generation function commit 84faa307249b341f6ad8de3e1869d77a65e26669 upstream. @@ -31851,7 +31851,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 7 insertions(+) diff --git a/arch/arm/crypto/curve25519-glue.c b/arch/arm/crypto/curve25519-glue.c -index f3f42cf3b8937..776ae07e04697 100644 +index f3f42cf3b893..776ae07e0469 100644 --- a/arch/arm/crypto/curve25519-glue.c +++ b/arch/arm/crypto/curve25519-glue.c @@ -38,6 +38,13 @@ void curve25519_arch(u8 out[CURVE25519_KEY_SIZE], @@ -31872,10 +31872,10 @@ index f3f42cf3b8937..776ae07e04697 100644 2.18.4 -From 8ff5eaefb8eac9888d0a6a0d980c28cc5b53310f Mon Sep 17 00:00:00 2001 +From e065d5486028f24d4fe4e948be57039744cdfa3d Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 16 Dec 2019 19:53:26 +0100 -Subject: [PATCH 040/124] crypto: lib/curve25519 - re-add selftests +Subject: [PATCH 040/146] crypto: lib/curve25519 - re-add selftests commit aa127963f1cab2b93c74c9b128a84610203fb674 upstream. @@ -31895,7 +31895,7 @@ Signed-off-by: Jason A. Donenfeld create mode 100644 lib/crypto/curve25519-selftest.c diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile -index 34a701ab8b92e..f97f9b9411105 100644 +index 34a701ab8b92..f97f9b941110 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -36,4 +36,5 @@ libsha256-y := sha256.o @@ -31906,7 +31906,7 @@ index 34a701ab8b92e..f97f9b9411105 100644 endif diff --git a/lib/crypto/curve25519-selftest.c b/lib/crypto/curve25519-selftest.c new file mode 100644 -index 0000000000000..c85e85381e788 +index 000000000000..c85e85381e78 --- /dev/null +++ b/lib/crypto/curve25519-selftest.c @@ -0,0 +1,1321 @@ @@ -33232,7 +33232,7 @@ index 0000000000000..c85e85381e788 + return success; +} diff --git a/lib/crypto/curve25519.c b/lib/crypto/curve25519.c -index 0106bebe69008..c03ccdb994340 100644 +index 0106bebe6900..c03ccdb99434 100644 --- a/lib/crypto/curve25519.c +++ b/lib/crypto/curve25519.c @@ -13,6 +13,8 @@ @@ -33270,10 +33270,10 @@ index 0106bebe69008..c03ccdb994340 100644 2.18.4 -From 998a2390cbacd4218ce639458e68b0ad077e7657 Mon Sep 17 00:00:00 2001 +From 7c1bd803f60dcc55312b4c98998573353060fbfc Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 5 Jan 2020 22:40:46 -0500 -Subject: [PATCH 041/124] crypto: poly1305 - add new 32 and 64-bit generic +Subject: [PATCH 041/146] crypto: poly1305 - add new 32 and 64-bit generic versions commit 1c08a104360f3e18f4ee6346c21cc3923efb952e upstream. @@ -33328,7 +33328,7 @@ Signed-off-by: Jason A. Donenfeld create mode 100644 lib/crypto/poly1305-donna64.c diff --git a/arch/x86/crypto/poly1305-avx2-x86_64.S b/arch/x86/crypto/poly1305-avx2-x86_64.S -index 8b341bc29d416..1688fb551070c 100644 +index 8b341bc29d41..1688fb551070 100644 --- a/arch/x86/crypto/poly1305-avx2-x86_64.S +++ b/arch/x86/crypto/poly1305-avx2-x86_64.S @@ -34,16 +34,16 @@ ORMASK: .octa 0x00000000010000000000000001000000 @@ -33359,7 +33359,7 @@ index 8b341bc29d416..1688fb551070c 100644 #define hc0 %ymm0 #define hc1 %ymm1 diff --git a/arch/x86/crypto/poly1305_glue.c b/arch/x86/crypto/poly1305_glue.c -index 0cc4537e6617c..edb7113e36f32 100644 +index 0cc4537e6617..edb7113e36f3 100644 --- a/arch/x86/crypto/poly1305_glue.c +++ b/arch/x86/crypto/poly1305_glue.c @@ -25,6 +25,21 @@ asmlinkage void poly1305_4block_avx2(u32 *h, const u8 *src, const u32 *r, @@ -33621,7 +33621,7 @@ index 0cc4537e6617c..edb7113e36f32 100644 } diff --git a/crypto/adiantum.c b/crypto/adiantum.c -index aded260922684..c846a887abe19 100644 +index aded26092268..c846a887abe1 100644 --- a/crypto/adiantum.c +++ b/crypto/adiantum.c @@ -72,7 +72,7 @@ struct adiantum_tfm_ctx { @@ -33643,7 +33643,7 @@ index aded260922684..c846a887abe19 100644 /* Hash the left-hand part (the "bulk") of the message using NHPoly1305 */ diff --git a/crypto/nhpoly1305.c b/crypto/nhpoly1305.c -index f6b6a52092b49..8a3006c3b51b9 100644 +index f6b6a52092b4..8a3006c3b51b 100644 --- a/crypto/nhpoly1305.c +++ b/crypto/nhpoly1305.c @@ -210,7 +210,7 @@ int crypto_nhpoly1305_final_helper(struct shash_desc *desc, u8 *dst, nh_t nh_fn) @@ -33656,7 +33656,7 @@ index f6b6a52092b49..8a3006c3b51b9 100644 } EXPORT_SYMBOL(crypto_nhpoly1305_final_helper); diff --git a/crypto/poly1305_generic.c b/crypto/poly1305_generic.c -index 21edbd8c99fbc..94af47eb6fa69 100644 +index 21edbd8c99fb..94af47eb6fa6 100644 --- a/crypto/poly1305_generic.c +++ b/crypto/poly1305_generic.c @@ -31,6 +31,29 @@ static int crypto_poly1305_init(struct shash_desc *desc) @@ -33699,7 +33699,7 @@ index 21edbd8c99fbc..94af47eb6fa69 100644 } diff --git a/include/crypto/internal/poly1305.h b/include/crypto/internal/poly1305.h -index 479b0cab2a1ad..064e52ca52480 100644 +index 479b0cab2a1a..064e52ca5248 100644 --- a/include/crypto/internal/poly1305.h +++ b/include/crypto/internal/poly1305.h @@ -11,48 +11,23 @@ @@ -33762,7 +33762,7 @@ index 479b0cab2a1ad..064e52ca52480 100644 #endif diff --git a/include/crypto/nhpoly1305.h b/include/crypto/nhpoly1305.h -index 53c04423c582e..306925fea1904 100644 +index 53c04423c582..306925fea190 100644 --- a/include/crypto/nhpoly1305.h +++ b/include/crypto/nhpoly1305.h @@ -7,7 +7,7 @@ @@ -33784,7 +33784,7 @@ index 53c04423c582e..306925fea1904 100644 }; diff --git a/include/crypto/poly1305.h b/include/crypto/poly1305.h -index 74c6e1cd73eee..f1f67fc749cf4 100644 +index 74c6e1cd73ee..f1f67fc749cf 100644 --- a/include/crypto/poly1305.h +++ b/include/crypto/poly1305.h @@ -13,12 +13,29 @@ @@ -33832,7 +33832,7 @@ index 74c6e1cd73eee..f1f67fc749cf4 100644 void poly1305_init_arch(struct poly1305_desc_ctx *desc, const u8 *key); diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile -index f97f9b9411105..6ecaf83a5a9aa 100644 +index f97f9b941110..6ecaf83a5a9a 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -28,7 +28,9 @@ obj-$(CONFIG_CRYPTO_LIB_DES) += libdes.o @@ -33848,7 +33848,7 @@ index f97f9b9411105..6ecaf83a5a9aa 100644 libsha256-y := sha256.o diff --git a/lib/crypto/poly1305-donna32.c b/lib/crypto/poly1305-donna32.c new file mode 100644 -index 0000000000000..3cc77d94390b2 +index 000000000000..3cc77d94390b --- /dev/null +++ b/lib/crypto/poly1305-donna32.c @@ -0,0 +1,204 @@ @@ -34058,7 +34058,7 @@ index 0000000000000..3cc77d94390b2 +EXPORT_SYMBOL(poly1305_core_emit); diff --git a/lib/crypto/poly1305-donna64.c b/lib/crypto/poly1305-donna64.c new file mode 100644 -index 0000000000000..6ae181bb43450 +index 000000000000..6ae181bb4345 --- /dev/null +++ b/lib/crypto/poly1305-donna64.c @@ -0,0 +1,185 @@ @@ -34248,7 +34248,7 @@ index 0000000000000..6ae181bb43450 +} +EXPORT_SYMBOL(poly1305_core_emit); diff --git a/lib/crypto/poly1305.c b/lib/crypto/poly1305.c -index 32ec293c65ae7..9d2d14df0fee5 100644 +index 32ec293c65ae..9d2d14df0fee 100644 --- a/lib/crypto/poly1305.c +++ b/lib/crypto/poly1305.c @@ -12,151 +12,9 @@ @@ -34465,10 +34465,10 @@ index 32ec293c65ae7..9d2d14df0fee5 100644 2.18.4 -From 1514821265506dac2578cfc1f22f9dde3d899cf2 Mon Sep 17 00:00:00 2001 +From 5d6e3bbd0bfd66937ea4b0ae1a785561ebe05464 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 5 Jan 2020 22:40:47 -0500 -Subject: [PATCH 042/124] crypto: x86/poly1305 - import unmodified cryptogams +Subject: [PATCH 042/146] crypto: x86/poly1305 - import unmodified cryptogams implementation commit 0896ca2a0cb6127e8a129f1f2a680d49b6b0f65c upstream. @@ -34488,7 +34488,7 @@ Signed-off-by: Jason A. Donenfeld diff --git a/arch/x86/crypto/poly1305-x86_64-cryptogams.pl b/arch/x86/crypto/poly1305-x86_64-cryptogams.pl new file mode 100644 -index 0000000000000..342ad7f18aa71 +index 000000000000..342ad7f18aa7 --- /dev/null +++ b/arch/x86/crypto/poly1305-x86_64-cryptogams.pl @@ -0,0 +1,4159 @@ @@ -38655,10 +38655,10 @@ index 0000000000000..342ad7f18aa71 2.18.4 -From e0a371560fd5181e32e24ecc42a66392e7c50e60 Mon Sep 17 00:00:00 2001 +From e71eafc8d5f3178e67a030dda5074771852b892d Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 5 Jan 2020 22:40:48 -0500 -Subject: [PATCH 043/124] crypto: x86/poly1305 - wire up faster implementations +Subject: [PATCH 043/146] crypto: x86/poly1305 - wire up faster implementations for kernel commit d7d7b853566254648df59f7ea27ea05952a6cfa8 upstream. @@ -38783,13 +38783,13 @@ Signed-off-by: Jason A. Donenfeld diff --git a/arch/x86/crypto/.gitignore b/arch/x86/crypto/.gitignore new file mode 100644 -index 0000000000000..c406ea6571fac +index 000000000000..c406ea6571fa --- /dev/null +++ b/arch/x86/crypto/.gitignore @@ -0,0 +1 @@ +poly1305-x86_64.S diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile -index 958440eae27ec..b69e00bf20b82 100644 +index 958440eae27e..b69e00bf20b8 100644 --- a/arch/x86/crypto/Makefile +++ b/arch/x86/crypto/Makefile @@ -73,6 +73,10 @@ aegis128-aesni-y := aegis128-aesni-asm.o aegis128-aesni-glue.o @@ -38825,7 +38825,7 @@ index 958440eae27ec..b69e00bf20b82 100644 + $(call if_changed,perlasm) diff --git a/arch/x86/crypto/poly1305-avx2-x86_64.S b/arch/x86/crypto/poly1305-avx2-x86_64.S deleted file mode 100644 -index 1688fb551070c..0000000000000 +index 1688fb551070..000000000000 --- a/arch/x86/crypto/poly1305-avx2-x86_64.S +++ /dev/null @@ -1,390 +0,0 @@ @@ -39221,7 +39221,7 @@ index 1688fb551070c..0000000000000 -ENDPROC(poly1305_4block_avx2) diff --git a/arch/x86/crypto/poly1305-sse2-x86_64.S b/arch/x86/crypto/poly1305-sse2-x86_64.S deleted file mode 100644 -index 5578f846e622b..0000000000000 +index 5578f846e622..000000000000 --- a/arch/x86/crypto/poly1305-sse2-x86_64.S +++ /dev/null @@ -1,590 +0,0 @@ @@ -39816,7 +39816,7 @@ index 5578f846e622b..0000000000000 - ret -ENDPROC(poly1305_2block_sse2) diff --git a/arch/x86/crypto/poly1305-x86_64-cryptogams.pl b/arch/x86/crypto/poly1305-x86_64-cryptogams.pl -index 342ad7f18aa71..80061bea6b16a 100644 +index 342ad7f18aa7..80061bea6b16 100644 --- a/arch/x86/crypto/poly1305-x86_64-cryptogams.pl +++ b/arch/x86/crypto/poly1305-x86_64-cryptogams.pl @@ -1,11 +1,14 @@ @@ -40987,7 +40987,7 @@ index 342ad7f18aa71..80061bea6b16a 100644 } close STDOUT; diff --git a/arch/x86/crypto/poly1305_glue.c b/arch/x86/crypto/poly1305_glue.c -index edb7113e36f32..657363588e0c8 100644 +index edb7113e36f3..657363588e0c 100644 --- a/arch/x86/crypto/poly1305_glue.c +++ b/arch/x86/crypto/poly1305_glue.c @@ -1,8 +1,6 @@ @@ -41576,7 +41576,7 @@ index edb7113e36f32..657363588e0c8 100644 MODULE_ALIAS_CRYPTO("poly1305"); MODULE_ALIAS_CRYPTO("poly1305-simd"); diff --git a/lib/crypto/Kconfig b/lib/crypto/Kconfig -index 0b2c4fce26d95..14c032de276e6 100644 +index 0b2c4fce26d9..14c032de276e 100644 --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -90,7 +90,7 @@ config CRYPTO_LIB_DES @@ -41592,10 +41592,10 @@ index 0b2c4fce26d95..14c032de276e6 100644 2.18.4 -From 4b0829367ac6d33721304193f23c3892cffed108 Mon Sep 17 00:00:00 2001 +From 91d5c09a05eb22f079dbf7565fabb5f8bf64dc27 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 5 Jan 2020 22:40:49 -0500 -Subject: [PATCH 044/124] crypto: {arm,arm64,mips}/poly1305 - remove redundant +Subject: [PATCH 044/146] crypto: {arm,arm64,mips}/poly1305 - remove redundant non-reduction from emit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -41641,7 +41641,7 @@ Signed-off-by: Jason A. Donenfeld 3 files changed, 6 insertions(+), 48 deletions(-) diff --git a/arch/arm/crypto/poly1305-glue.c b/arch/arm/crypto/poly1305-glue.c -index abe3f2d587dcb..ceec04ec2f405 100644 +index abe3f2d587dc..ceec04ec2f40 100644 --- a/arch/arm/crypto/poly1305-glue.c +++ b/arch/arm/crypto/poly1305-glue.c @@ -20,7 +20,7 @@ @@ -41684,7 +41684,7 @@ index abe3f2d587dcb..ceec04ec2f405 100644 } EXPORT_SYMBOL(poly1305_final_arch); diff --git a/arch/arm64/crypto/poly1305-glue.c b/arch/arm64/crypto/poly1305-glue.c -index 83a2338a88263..e97b092f56b8f 100644 +index 83a2338a8826..e97b092f56b8 100644 --- a/arch/arm64/crypto/poly1305-glue.c +++ b/arch/arm64/crypto/poly1305-glue.c @@ -21,7 +21,7 @@ @@ -41727,7 +41727,7 @@ index 83a2338a88263..e97b092f56b8f 100644 } EXPORT_SYMBOL(poly1305_final_arch); diff --git a/arch/mips/crypto/poly1305-glue.c b/arch/mips/crypto/poly1305-glue.c -index b37d29cf5d0a8..fc881b46d9111 100644 +index b37d29cf5d0a..fc881b46d911 100644 --- a/arch/mips/crypto/poly1305-glue.c +++ b/arch/mips/crypto/poly1305-glue.c @@ -15,7 +15,7 @@ @@ -41773,10 +41773,10 @@ index b37d29cf5d0a8..fc881b46d9111 100644 2.18.4 -From b2f7f81574ddd4b2dcbc25919649bc6fa9682c10 Mon Sep 17 00:00:00 2001 +From e9d319102e757412e29b8f08bb94a2869b208b62 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Wed, 8 Jan 2020 12:37:35 +0800 -Subject: [PATCH 045/124] crypto: curve25519 - Fix selftest build error +Subject: [PATCH 045/146] crypto: curve25519 - Fix selftest build error commit a8bdf2c42ee4d1ee42af1f3601f85de94e70a421 upstream. @@ -41815,7 +41815,7 @@ Signed-off-by: Jason A. Donenfeld create mode 100644 lib/crypto/curve25519-generic.c diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile -index 6ecaf83a5a9aa..3a435629d9ce9 100644 +index 6ecaf83a5a9a..3a435629d9ce 100644 --- a/lib/crypto/Makefile +++ b/lib/crypto/Makefile @@ -19,9 +19,12 @@ libblake2s-y += blake2s.o @@ -41836,7 +41836,7 @@ index 6ecaf83a5a9aa..3a435629d9ce9 100644 obj-$(CONFIG_CRYPTO_LIB_DES) += libdes.o diff --git a/lib/crypto/curve25519-generic.c b/lib/crypto/curve25519-generic.c new file mode 100644 -index 0000000000000..de7c99172fa25 +index 000000000000..de7c99172fa2 --- /dev/null +++ b/lib/crypto/curve25519-generic.c @@ -0,0 +1,24 @@ @@ -41865,7 +41865,7 @@ index 0000000000000..de7c99172fa25 +MODULE_DESCRIPTION("Curve25519 scalar multiplication"); +MODULE_AUTHOR("Jason A. Donenfeld "); diff --git a/lib/crypto/curve25519.c b/lib/crypto/curve25519.c -index c03ccdb994340..288a62cd29b22 100644 +index c03ccdb99434..288a62cd29b2 100644 --- a/lib/crypto/curve25519.c +++ b/lib/crypto/curve25519.c @@ -15,13 +15,6 @@ @@ -41886,10 +41886,10 @@ index c03ccdb994340..288a62cd29b22 100644 2.18.4 -From 3c3b7530f886f252e4a5135e9fb4e168d3bc06fc Mon Sep 17 00:00:00 2001 +From ea6599b1eed73a11ad4023899fccec508fb18000 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 16 Jan 2020 18:23:55 +0100 -Subject: [PATCH 046/124] crypto: x86/poly1305 - fix .gitignore typo +Subject: [PATCH 046/146] crypto: x86/poly1305 - fix .gitignore typo commit 1f6868995326cc82102049e349d8dbd116bdb656 upstream. @@ -41905,7 +41905,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/crypto/.gitignore b/arch/x86/crypto/.gitignore -index c406ea6571fac..30be0400a4392 100644 +index c406ea6571fa..30be0400a439 100644 --- a/arch/x86/crypto/.gitignore +++ b/arch/x86/crypto/.gitignore @@ -1 +1 @@ @@ -41915,10 +41915,10 @@ index c406ea6571fac..30be0400a4392 100644 2.18.4 -From 24c3f89e6a2dba65e02f6dc713ed1ea792c7e4bc Mon Sep 17 00:00:00 2001 +From b2947dd4cdd69c592c9a860689f4bb0dc5617b6e Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 16 Jan 2020 21:26:34 +0100 -Subject: [PATCH 047/124] crypto: chacha20poly1305 - add back missing test +Subject: [PATCH 047/146] crypto: chacha20poly1305 - add back missing test vectors and test chunking commit 72c7943792c9e7788ddd182337bcf8f650cf56f5 upstream. @@ -41942,7 +41942,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1698 insertions(+), 14 deletions(-) diff --git a/lib/crypto/chacha20poly1305-selftest.c b/lib/crypto/chacha20poly1305-selftest.c -index 465de46dbdef2..c391a91364e9d 100644 +index 465de46dbdef..c391a91364e9 100644 --- a/lib/crypto/chacha20poly1305-selftest.c +++ b/lib/crypto/chacha20poly1305-selftest.c @@ -4,6 +4,7 @@ @@ -43779,10 +43779,10 @@ index 465de46dbdef2..c391a91364e9d 100644 2.18.4 -From d153b7c88cdc9ec38f697ca2e38dea285bcdceac Mon Sep 17 00:00:00 2001 +From 989619212ada13f3e10b190254b8ed6b9a4b4489 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 17 Jan 2020 11:42:22 +0100 -Subject: [PATCH 048/124] crypto: x86/poly1305 - emit does base conversion +Subject: [PATCH 048/146] crypto: x86/poly1305 - emit does base conversion itself commit f9e7fe32a792726186301423ff63a465d63386e1 upstream. @@ -43799,7 +43799,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/x86/crypto/poly1305_glue.c b/arch/x86/crypto/poly1305_glue.c -index 657363588e0c8..79bb58737d528 100644 +index 657363588e0c..79bb58737d52 100644 --- a/arch/x86/crypto/poly1305_glue.c +++ b/arch/x86/crypto/poly1305_glue.c @@ -123,13 +123,9 @@ static void poly1305_simd_blocks(void *ctx, const u8 *inp, size_t len, @@ -43822,10 +43822,10 @@ index 657363588e0c8..79bb58737d528 100644 2.18.4 -From af38a277273dd3fa1b45647bd1d18c642d6f6698 Mon Sep 17 00:00:00 2001 +From 57717131cfa1dff14c12c0b8b3eb5b2b875ff17b Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 17 Jan 2020 17:43:18 +0100 -Subject: [PATCH 049/124] crypto: arm/chacha - fix build failured when kernel +Subject: [PATCH 049/146] crypto: arm/chacha - fix build failured when kernel mode NEON is disabled commit 0bc81767c5bd9d005fae1099fb39eb3688370cb1 upstream. @@ -43861,7 +43861,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/crypto/chacha-glue.c b/arch/arm/crypto/chacha-glue.c -index 7bdf8823066d0..893692ed12b76 100644 +index 7bdf8823066d..893692ed12b7 100644 --- a/arch/arm/crypto/chacha-glue.c +++ b/arch/arm/crypto/chacha-glue.c @@ -115,7 +115,7 @@ static int chacha_stream_xor(struct skcipher_request *req, @@ -43886,10 +43886,10 @@ index 7bdf8823066d0..893692ed12b76 100644 2.18.4 -From 8d96035b613c0fe1b0ae270bfd8512b2b133ef4d Mon Sep 17 00:00:00 2001 +From 0a886d997f788d61d5d7fdc14a003aecc410594f Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 17 Jan 2020 12:01:36 +0100 -Subject: [PATCH 050/124] crypto: Kconfig - allow tests to be disabled when +Subject: [PATCH 050/146] crypto: Kconfig - allow tests to be disabled when manager is disabled commit 2343d1529aff8b552589f622c23932035ed7a05d upstream. @@ -43907,7 +43907,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 4 deletions(-) diff --git a/crypto/Kconfig b/crypto/Kconfig -index b8b738bcc3120..8fcf630471dcf 100644 +index 22b8a3517037..626032b9f085 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -136,8 +136,6 @@ config CRYPTO_USER @@ -43932,10 +43932,10 @@ index b8b738bcc3120..8fcf630471dcf 100644 2.18.4 -From cf0d4a4876f6649420a87d0cec615b14af0c85b5 Mon Sep 17 00:00:00 2001 +From 46247d442a64973fa271280913a7d23d4d103ad2 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 6 Feb 2020 12:42:01 +0100 -Subject: [PATCH 051/124] crypto: chacha20poly1305 - prevent integer overflow +Subject: [PATCH 051/146] crypto: chacha20poly1305 - prevent integer overflow on large input commit c9cc0517bba9f0213f1e55172feceb99e5512daf upstream. @@ -43961,7 +43961,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 3 insertions(+) diff --git a/lib/crypto/chacha20poly1305.c b/lib/crypto/chacha20poly1305.c -index 6d83cafebc69c..ad0699ce702f9 100644 +index 6d83cafebc69..ad0699ce702f 100644 --- a/lib/crypto/chacha20poly1305.c +++ b/lib/crypto/chacha20poly1305.c @@ -235,6 +235,9 @@ bool chacha20poly1305_crypt_sg_inplace(struct scatterlist *src, @@ -43978,10 +43978,10 @@ index 6d83cafebc69c..ad0699ce702f9 100644 2.18.4 -From 38bb5c7c289c7312e9d1019d53ff0a78a11c6452 Mon Sep 17 00:00:00 2001 +From 1f25170ac28f01e9bc9351d124b28e7d5dea18b8 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 1 Mar 2020 22:52:35 +0800 -Subject: [PATCH 052/124] crypto: x86/curve25519 - support assemblers with no +Subject: [PATCH 052/146] crypto: x86/curve25519 - support assemblers with no adx support commit 1579f1bc3b753d17a44de3457d5c6f4a5b14c752 upstream. @@ -44003,10 +44003,10 @@ Signed-off-by: Jason A. Donenfeld 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/arch/x86/Makefile b/arch/x86/Makefile -index 8ca3cf7c5ec97..03c7ec1dc83f0 100644 +index 69f0cb01c666..d2c4047b9ec1 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile -@@ -197,9 +197,10 @@ avx2_instr :=$(call as-instr,vpbroadcastb %xmm0$(comma)%ymm1,-DCONFIG_AS_AVX2=1) +@@ -198,9 +198,10 @@ avx2_instr :=$(call as-instr,vpbroadcastb %xmm0$(comma)%ymm1,-DCONFIG_AS_AVX2=1) avx512_instr :=$(call as-instr,vpmovm2b %k1$(comma)%zmm5,-DCONFIG_AS_AVX512=1) sha1_ni_instr :=$(call as-instr,sha1msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA1_NI=1) sha256_ni_instr :=$(call as-instr,sha256msg1 %xmm0$(comma)%xmm1,-DCONFIG_AS_SHA256_NI=1) @@ -44020,7 +44020,7 @@ index 8ca3cf7c5ec97..03c7ec1dc83f0 100644 KBUILD_LDFLAGS := -m elf_$(UTS_MACHINE) diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile -index b69e00bf20b82..8c2e9eadee8a0 100644 +index b69e00bf20b8..8c2e9eadee8a 100644 --- a/arch/x86/crypto/Makefile +++ b/arch/x86/crypto/Makefile @@ -11,6 +11,7 @@ avx2_supported := $(call as-instr,vpgatherdd %ymm0$(comma)(%eax$(comma)%ymm1\ @@ -44045,7 +44045,7 @@ index b69e00bf20b82..8c2e9eadee8a0 100644 # These modules require assembler to support AVX. ifeq ($(avx_supported),yes) diff --git a/include/crypto/curve25519.h b/include/crypto/curve25519.h -index 4e6dc840b1592..9ecb3c1f0f15d 100644 +index 4e6dc840b159..9ecb3c1f0f15 100644 --- a/include/crypto/curve25519.h +++ b/include/crypto/curve25519.h @@ -33,7 +33,8 @@ bool __must_check curve25519(u8 mypublic[CURVE25519_KEY_SIZE], @@ -44072,10 +44072,10 @@ index 4e6dc840b1592..9ecb3c1f0f15d 100644 2.18.4 -From 865fde1df114cb6121f0af4af38261f5a0d824ce Mon Sep 17 00:00:00 2001 +From a0cbd63e7d722cfa429bc25e22bbd112b163bbbe Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 18 Mar 2020 20:27:32 -0600 -Subject: [PATCH 053/124] crypto: arm64/chacha - correctly walk through blocks +Subject: [PATCH 053/146] crypto: arm64/chacha - correctly walk through blocks commit c8cfcb78c65877313cda7bcbace624d3dbd1f3b3 upstream. @@ -44103,7 +44103,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/arch/arm64/crypto/chacha-neon-glue.c b/arch/arm64/crypto/chacha-neon-glue.c -index 71c11d2e9fcda..2189436122617 100644 +index 71c11d2e9fcd..218943612261 100644 --- a/arch/arm64/crypto/chacha-neon-glue.c +++ b/arch/arm64/crypto/chacha-neon-glue.c @@ -55,10 +55,10 @@ static void chacha_doneon(u32 *state, u8 *dst, const u8 *src, @@ -44122,7 +44122,7 @@ index 71c11d2e9fcda..2189436122617 100644 } diff --git a/lib/crypto/chacha20poly1305-selftest.c b/lib/crypto/chacha20poly1305-selftest.c -index c391a91364e9d..fa43deda2660d 100644 +index c391a91364e9..fa43deda2660 100644 --- a/lib/crypto/chacha20poly1305-selftest.c +++ b/lib/crypto/chacha20poly1305-selftest.c @@ -9028,10 +9028,15 @@ bool __init chacha20poly1305_selftest(void) @@ -44148,10 +44148,10 @@ index c391a91364e9d..fa43deda2660d 100644 2.18.4 -From 0600853de17c8b222156fb878666b5c384a422bb Mon Sep 17 00:00:00 2001 +From bee23d398a9934de3f84968bb2cb30c90cf870db Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 20 Jan 2020 18:18:15 +0100 -Subject: [PATCH 054/124] crypto: x86/curve25519 - replace with formally +Subject: [PATCH 054/146] crypto: x86/curve25519 - replace with formally verified implementation commit 07b586fe06625b0b610dc3d3a969c51913d143d4 upstream. @@ -44231,7 +44231,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1292 insertions(+), 2254 deletions(-) diff --git a/arch/x86/crypto/curve25519-x86_64.c b/arch/x86/crypto/curve25519-x86_64.c -index eec7d2d242396..e4e58b8e9afe4 100644 +index eec7d2d24239..e4e58b8e9afe 100644 --- a/arch/x86/crypto/curve25519-x86_64.c +++ b/arch/x86/crypto/curve25519-x86_64.c @@ -1,8 +1,7 @@ @@ -47905,10 +47905,10 @@ index eec7d2d242396..e4e58b8e9afe4 100644 2.18.4 -From 33e7ca090c0d17f2894b44a168d49f4e51ba1b30 Mon Sep 17 00:00:00 2001 +From 762726b4ef3a99d8af8fe5ff96e9c1a990033835 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 1 Mar 2020 16:06:56 +0800 -Subject: [PATCH 055/124] crypto: x86/curve25519 - leave r12 as spare register +Subject: [PATCH 055/146] crypto: x86/curve25519 - leave r12 as spare register commit dc7fc3a53ae158263196b1892b672aedf67796c5 upstream. @@ -47924,7 +47924,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/arch/x86/crypto/curve25519-x86_64.c b/arch/x86/crypto/curve25519-x86_64.c -index e4e58b8e9afe4..8a17621f7d3a3 100644 +index e4e58b8e9afe..8a17621f7d3a 100644 --- a/arch/x86/crypto/curve25519-x86_64.c +++ b/arch/x86/crypto/curve25519-x86_64.c @@ -167,28 +167,28 @@ static inline void fmul(u64 *out, const u64 *f1, const u64 *f2, u64 *tmp) @@ -48287,10 +48287,10 @@ index e4e58b8e9afe4..8a17621f7d3a3 100644 2.18.4 -From b6f9158fd02f157a6ebdea1b6d0da528d3cdb90d Mon Sep 17 00:00:00 2001 +From 111a1658d82d6b3c20b679e7f970009facdaca9c Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 19 Mar 2020 11:56:17 -0600 -Subject: [PATCH 056/124] crypto: arm[64]/poly1305 - add artifact to .gitignore +Subject: [PATCH 056/146] crypto: arm[64]/poly1305 - add artifact to .gitignore files commit 6e4e00d8b68ca7eb30d08afb740033e0d36abe55 upstream. @@ -48311,7 +48311,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 2 insertions(+) diff --git a/arch/arm/crypto/.gitignore b/arch/arm/crypto/.gitignore -index 31e1f538df7de..a3c7ad52a469f 100644 +index 31e1f538df7d..a3c7ad52a469 100644 --- a/arch/arm/crypto/.gitignore +++ b/arch/arm/crypto/.gitignore @@ -1,3 +1,4 @@ @@ -48320,7 +48320,7 @@ index 31e1f538df7de..a3c7ad52a469f 100644 sha512-core.S +poly1305-core.S diff --git a/arch/arm64/crypto/.gitignore b/arch/arm64/crypto/.gitignore -index 879df8781ed56..e403b1343328d 100644 +index 879df8781ed5..e403b1343328 100644 --- a/arch/arm64/crypto/.gitignore +++ b/arch/arm64/crypto/.gitignore @@ -1,2 +1,3 @@ @@ -48331,10 +48331,10 @@ index 879df8781ed56..e403b1343328d 100644 2.18.4 -From f822009c12b208ef9a7024274d17064cee17d1e9 Mon Sep 17 00:00:00 2001 +From c0f39d7fa312e884e94e6c62f019caf0ab001100 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 23 Apr 2020 15:54:04 -0600 -Subject: [PATCH 057/124] crypto: arch/lib - limit simd usage to 4k chunks +Subject: [PATCH 057/146] crypto: arch/lib - limit simd usage to 4k chunks commit 706024a52c614b478b63f7728d202532ce6591a9 upstream. @@ -48380,7 +48380,7 @@ Signed-off-by: Jason A. Donenfeld 7 files changed, 65 insertions(+), 30 deletions(-) diff --git a/arch/arm/crypto/chacha-glue.c b/arch/arm/crypto/chacha-glue.c -index 893692ed12b76..cd131b454c2ee 100644 +index 893692ed12b7..cd131b454c2e 100644 --- a/arch/arm/crypto/chacha-glue.c +++ b/arch/arm/crypto/chacha-glue.c @@ -91,9 +91,17 @@ void chacha_crypt_arch(u32 *state, u8 *dst, const u8 *src, unsigned int bytes, @@ -48405,7 +48405,7 @@ index 893692ed12b76..cd131b454c2ee 100644 EXPORT_SYMBOL(chacha_crypt_arch); diff --git a/arch/arm/crypto/poly1305-glue.c b/arch/arm/crypto/poly1305-glue.c -index ceec04ec2f405..13cfef4ae22e3 100644 +index ceec04ec2f40..13cfef4ae22e 100644 --- a/arch/arm/crypto/poly1305-glue.c +++ b/arch/arm/crypto/poly1305-glue.c @@ -160,13 +160,20 @@ void poly1305_update_arch(struct poly1305_desc_ctx *dctx, const u8 *src, @@ -48434,7 +48434,7 @@ index ceec04ec2f405..13cfef4ae22e3 100644 } diff --git a/arch/arm64/crypto/chacha-neon-glue.c b/arch/arm64/crypto/chacha-neon-glue.c -index 2189436122617..1d9824c4ae43b 100644 +index 218943612261..1d9824c4ae43 100644 --- a/arch/arm64/crypto/chacha-neon-glue.c +++ b/arch/arm64/crypto/chacha-neon-glue.c @@ -87,9 +87,17 @@ void chacha_crypt_arch(u32 *state, u8 *dst, const u8 *src, unsigned int bytes, @@ -48459,7 +48459,7 @@ index 2189436122617..1d9824c4ae43b 100644 EXPORT_SYMBOL(chacha_crypt_arch); diff --git a/arch/arm64/crypto/poly1305-glue.c b/arch/arm64/crypto/poly1305-glue.c -index e97b092f56b8f..f33ada70c4ed8 100644 +index e97b092f56b8..f33ada70c4ed 100644 --- a/arch/arm64/crypto/poly1305-glue.c +++ b/arch/arm64/crypto/poly1305-glue.c @@ -143,13 +143,20 @@ void poly1305_update_arch(struct poly1305_desc_ctx *dctx, const u8 *src, @@ -48488,7 +48488,7 @@ index e97b092f56b8f..f33ada70c4ed8 100644 } diff --git a/arch/x86/crypto/blake2s-glue.c b/arch/x86/crypto/blake2s-glue.c -index 1d9ff8a45e1fd..94ac5bdd9f6f2 100644 +index 1d9ff8a45e1f..94ac5bdd9f6f 100644 --- a/arch/x86/crypto/blake2s-glue.c +++ b/arch/x86/crypto/blake2s-glue.c @@ -32,16 +32,16 @@ void blake2s_compress_arch(struct blake2s_state *state, @@ -48524,7 +48524,7 @@ index 1d9ff8a45e1fd..94ac5bdd9f6f2 100644 EXPORT_SYMBOL(blake2s_compress_arch); diff --git a/arch/x86/crypto/chacha_glue.c b/arch/x86/crypto/chacha_glue.c -index 1bebe11b9ec95..f3bfce21bc0d4 100644 +index 1bebe11b9ec9..f3bfce21bc0d 100644 --- a/arch/x86/crypto/chacha_glue.c +++ b/arch/x86/crypto/chacha_glue.c @@ -154,9 +154,17 @@ void chacha_crypt_arch(u32 *state, u8 *dst, const u8 *src, unsigned int bytes, @@ -48549,7 +48549,7 @@ index 1bebe11b9ec95..f3bfce21bc0d4 100644 EXPORT_SYMBOL(chacha_crypt_arch); diff --git a/arch/x86/crypto/poly1305_glue.c b/arch/x86/crypto/poly1305_glue.c -index 79bb58737d528..61b2bc8b69861 100644 +index 79bb58737d52..61b2bc8b6986 100644 --- a/arch/x86/crypto/poly1305_glue.c +++ b/arch/x86/crypto/poly1305_glue.c @@ -91,8 +91,8 @@ static void poly1305_simd_blocks(void *ctx, const u8 *inp, size_t len, @@ -48592,10 +48592,10 @@ index 79bb58737d528..61b2bc8b69861 100644 2.18.4 -From 4a0052127f0109bf05f8c233a68caff836851548 Mon Sep 17 00:00:00 2001 +From 5b87cb7162f0352de670edcc68b01a9a68234e2c Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Wed, 8 Jul 2020 12:41:13 +1000 -Subject: [PATCH 058/124] crypto: lib/chacha20poly1305 - Add missing function +Subject: [PATCH 058/146] crypto: lib/chacha20poly1305 - Add missing function declaration commit 06cc2afbbdf9a9e8df3e2f8db724997dd6e1b4ac upstream. @@ -48611,7 +48611,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/crypto/chacha20poly1305.h b/include/crypto/chacha20poly1305.h -index 234ee28078efd..d2ac3ff7dc1ec 100644 +index 234ee28078ef..d2ac3ff7dc1e 100644 --- a/include/crypto/chacha20poly1305.h +++ b/include/crypto/chacha20poly1305.h @@ -45,4 +45,6 @@ bool chacha20poly1305_decrypt_sg_inplace(struct scatterlist *src, size_t src_len @@ -48622,7 +48622,7 @@ index 234ee28078efd..d2ac3ff7dc1ec 100644 + #endif /* __CHACHA20POLY1305_H */ diff --git a/lib/crypto/chacha20poly1305.c b/lib/crypto/chacha20poly1305.c -index ad0699ce702f9..431e042803327 100644 +index ad0699ce702f..431e04280332 100644 --- a/lib/crypto/chacha20poly1305.c +++ b/lib/crypto/chacha20poly1305.c @@ -21,8 +21,6 @@ @@ -48638,10 +48638,10 @@ index ad0699ce702f9..431e042803327 100644 2.18.4 -From 74bf0ebb74242f61b71ab70a5d11b14b3b67baa4 Mon Sep 17 00:00:00 2001 +From e932245ffd6f3900bbb7d47237a014cc3a935e5b Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Wed, 8 Jul 2020 12:11:18 +0300 -Subject: [PATCH 059/124] crypto: x86/chacha-sse3 - use unaligned loads for +Subject: [PATCH 059/146] crypto: x86/chacha-sse3 - use unaligned loads for state array commit e79a31715193686e92dadb4caedfbb1f5de3659c upstream. @@ -48672,7 +48672,7 @@ Signed-off-by: Jason A. Donenfeld 3 files changed, 10 insertions(+), 27 deletions(-) diff --git a/arch/x86/crypto/chacha-ssse3-x86_64.S b/arch/x86/crypto/chacha-ssse3-x86_64.S -index 2d86c7d6dc88c..a556a57f1a4af 100644 +index 2d86c7d6dc88..a556a57f1a4a 100644 --- a/arch/x86/crypto/chacha-ssse3-x86_64.S +++ b/arch/x86/crypto/chacha-ssse3-x86_64.S @@ -120,10 +120,10 @@ ENTRY(chacha_block_xor_ssse3) @@ -48706,7 +48706,7 @@ index 2d86c7d6dc88c..a556a57f1a4af 100644 mov %edx,%r8d call chacha_permute diff --git a/arch/x86/crypto/chacha_glue.c b/arch/x86/crypto/chacha_glue.c -index f3bfce21bc0d4..4c4dc64398cbb 100644 +index f3bfce21bc0d..4c4dc64398cb 100644 --- a/arch/x86/crypto/chacha_glue.c +++ b/arch/x86/crypto/chacha_glue.c @@ -14,8 +14,6 @@ @@ -48777,7 +48777,7 @@ index f3bfce21bc0d4..4c4dc64398cbb 100644 if (req->cryptlen > CHACHA_BLOCK_SIZE && crypto_simd_usable()) { diff --git a/include/crypto/chacha.h b/include/crypto/chacha.h -index 2676f4fbd4c16..3a1c72fdb7cf5 100644 +index 2676f4fbd4c1..3a1c72fdb7cf 100644 --- a/include/crypto/chacha.h +++ b/include/crypto/chacha.h @@ -25,11 +25,7 @@ @@ -48796,10 +48796,10 @@ index 2676f4fbd4c16..3a1c72fdb7cf5 100644 2.18.4 -From 12edfd666753a2587de59e2a5284bd84340969f7 Mon Sep 17 00:00:00 2001 +From ce24a24c00238030cd98499f18ebeb5bdb6278c3 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Thu, 23 Jul 2020 17:50:48 +1000 -Subject: [PATCH 060/124] crypto: x86/curve25519 - Remove unused carry +Subject: [PATCH 060/146] crypto: x86/curve25519 - Remove unused carry variables commit 054a5540fb8f7268e2c79e9deab4242db15c8cba upstream. @@ -48817,7 +48817,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/x86/crypto/curve25519-x86_64.c b/arch/x86/crypto/curve25519-x86_64.c -index 8a17621f7d3a3..8acbb6584a370 100644 +index 8a17621f7d3a..8acbb6584a37 100644 --- a/arch/x86/crypto/curve25519-x86_64.c +++ b/arch/x86/crypto/curve25519-x86_64.c @@ -948,10 +948,8 @@ static void store_felem(u64 *b, u64 *f) @@ -48849,10 +48849,10 @@ index 8a17621f7d3a3..8acbb6584a370 100644 2.18.4 -From eb45a16164b3d0089254b65bfe9ffb746db3d5dd Mon Sep 17 00:00:00 2001 +From 4407f634a72bbd4ca8b80fe2d021a72c6c9f2982 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Mon, 24 Aug 2020 11:09:53 -0300 -Subject: [PATCH 061/124] crypto: arm/curve25519 - include +Subject: [PATCH 061/146] crypto: arm/curve25519 - include commit 6779d0e6b0fe193ab3010ea201782ca6f75a3862 upstream. @@ -48877,7 +48877,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 insertion(+) diff --git a/arch/arm/crypto/curve25519-glue.c b/arch/arm/crypto/curve25519-glue.c -index 776ae07e04697..31eb75b6002fb 100644 +index 776ae07e0469..31eb75b6002f 100644 --- a/arch/arm/crypto/curve25519-glue.c +++ b/arch/arm/crypto/curve25519-glue.c @@ -16,6 +16,7 @@ @@ -48892,10 +48892,10 @@ index 776ae07e04697..31eb75b6002fb 100644 2.18.4 -From 80a12d0385f827f969593a230d81a22d579b570f Mon Sep 17 00:00:00 2001 +From 4335b37ce242cc685366985940914b6956f8191e Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Tue, 25 Aug 2020 11:23:00 +1000 -Subject: [PATCH 062/124] crypto: arm/poly1305 - Add prototype for +Subject: [PATCH 062/146] crypto: arm/poly1305 - Add prototype for poly1305_blocks_neon commit 51982ea02aef972132eb35c583d3e4c5b83166e5 upstream. @@ -48917,7 +48917,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 insertion(+) diff --git a/arch/arm/crypto/poly1305-glue.c b/arch/arm/crypto/poly1305-glue.c -index 13cfef4ae22e3..3023c1acfa194 100644 +index 13cfef4ae22e..3023c1acfa19 100644 --- a/arch/arm/crypto/poly1305-glue.c +++ b/arch/arm/crypto/poly1305-glue.c @@ -20,6 +20,7 @@ @@ -48932,10 +48932,10 @@ index 13cfef4ae22e3..3023c1acfa194 100644 2.18.4 -From e1ac9711ecfd2a32558fed950bd78121dd820c50 Mon Sep 17 00:00:00 2001 +From 11af7797dc74c07a0127aa47e271fd014de0784a Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 27 Aug 2020 19:30:58 +0200 -Subject: [PATCH 063/124] crypto: curve25519-x86_64 - Use XORL r32,32 +Subject: [PATCH 063/146] crypto: curve25519-x86_64 - Use XORL r32,32 commit db719539fd3889836900bf912755aa30a5985e9a upstream. @@ -48954,7 +48954,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/arch/x86/crypto/curve25519-x86_64.c b/arch/x86/crypto/curve25519-x86_64.c -index 8acbb6584a370..a9edb6f8a0ba6 100644 +index 8acbb6584a37..a9edb6f8a0ba 100644 --- a/arch/x86/crypto/curve25519-x86_64.c +++ b/arch/x86/crypto/curve25519-x86_64.c @@ -45,11 +45,11 @@ static inline u64 add_scalar(u64 *out, const u64 *f1, u64 f2) @@ -49199,10 +49199,10 @@ index 8acbb6584a370..a9edb6f8a0ba6 100644 2.18.4 -From d935e644f116acda8d7587b156b69b88c82d02c9 Mon Sep 17 00:00:00 2001 +From 6fd5855667696fd5b5a771516d5e2ce998b43ae2 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 27 Aug 2020 19:38:31 +0200 -Subject: [PATCH 064/124] crypto: poly1305-x86_64 - Use XORL r32,32 +Subject: [PATCH 064/146] crypto: poly1305-x86_64 - Use XORL r32,32 commit 7dfd1e01b3dfc13431b1b25720cf2692a7e111ef upstream. @@ -49221,7 +49221,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/crypto/poly1305-x86_64-cryptogams.pl b/arch/x86/crypto/poly1305-x86_64-cryptogams.pl -index 80061bea6b16a..5b593990501d3 100644 +index 80061bea6b16..5b593990501d 100644 --- a/arch/x86/crypto/poly1305-x86_64-cryptogams.pl +++ b/arch/x86/crypto/poly1305-x86_64-cryptogams.pl @@ -246,7 +246,7 @@ $code.=<<___ if (!$kernel); @@ -49264,10 +49264,10 @@ index 80061bea6b16a..5b593990501d3 100644 2.18.4 -From 050beea218e4924963b5dc066620aa6e4d763f48 Mon Sep 17 00:00:00 2001 +From ec2951c3d1061d4077715c7a730322461d7c3690 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Thu, 24 Sep 2020 13:29:04 +1000 -Subject: [PATCH 065/124] crypto: x86/poly1305 - Remove assignments with no +Subject: [PATCH 065/146] crypto: x86/poly1305 - Remove assignments with no effect commit 4a0c1de64bf9d9027a6f19adfba89fc27893db23 upstream. @@ -49283,7 +49283,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 3 deletions(-) diff --git a/arch/x86/crypto/poly1305_glue.c b/arch/x86/crypto/poly1305_glue.c -index 61b2bc8b69861..7de5046fe5832 100644 +index 61b2bc8b6986..7de5046fe583 100644 --- a/arch/x86/crypto/poly1305_glue.c +++ b/arch/x86/crypto/poly1305_glue.c @@ -157,9 +157,6 @@ static unsigned int crypto_poly1305_setdctxkey(struct poly1305_desc_ctx *dctx, @@ -49300,10 +49300,10 @@ index 61b2bc8b69861..7de5046fe5832 100644 2.18.4 -From ee088bff793df6e9a62a9e0bd80b138dc583ee63 Mon Sep 17 00:00:00 2001 +From 478913a6fef82357061b745bbc2ce29429fadd66 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 23 Oct 2020 15:27:48 -0700 -Subject: [PATCH 066/124] crypto: x86/poly1305 - add back a needed assignment +Subject: [PATCH 066/146] crypto: x86/poly1305 - add back a needed assignment commit c3a98c3ad5c0dc60a1ac66bf91147a3f39cac96b upstream. @@ -49324,7 +49324,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 insertion(+) diff --git a/arch/x86/crypto/poly1305_glue.c b/arch/x86/crypto/poly1305_glue.c -index 7de5046fe5832..b69e362730d02 100644 +index 7de5046fe583..b69e362730d0 100644 --- a/arch/x86/crypto/poly1305_glue.c +++ b/arch/x86/crypto/poly1305_glue.c @@ -157,6 +157,7 @@ static unsigned int crypto_poly1305_setdctxkey(struct poly1305_desc_ctx *dctx, @@ -49339,10 +49339,10 @@ index 7de5046fe5832..b69e362730d02 100644 2.18.4 -From 523adc158011314e131f6f31379a4a91933c423f Mon Sep 17 00:00:00 2001 +From 77732a7818d751b17ce13bd90fe2d66a9aa544a9 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 2 Nov 2020 14:48:15 +0100 -Subject: [PATCH 067/124] crypto: Kconfig - CRYPTO_MANAGER_EXTRA_TESTS requires +Subject: [PATCH 067/146] crypto: Kconfig - CRYPTO_MANAGER_EXTRA_TESTS requires the manager commit 6569e3097f1c4a490bdf2b23d326855e04942dfd upstream. @@ -49362,7 +49362,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/Kconfig b/crypto/Kconfig -index 8fcf630471dcf..fd5a8724ed385 100644 +index 626032b9f085..eaf21eaca136 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -145,7 +145,7 @@ config CRYPTO_MANAGER_DISABLE_TESTS @@ -49378,10 +49378,10 @@ index 8fcf630471dcf..fd5a8724ed385 100644 2.18.4 -From f18ccdfbe79e8501a36e89939dcfd6312033b744 Mon Sep 17 00:00:00 2001 +From 67e8123454dbd84215be567aaac5314b667dd4b9 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Tue, 3 Nov 2020 17:28:09 +0100 -Subject: [PATCH 068/124] crypto: arm/chacha-neon - optimize for non-block size +Subject: [PATCH 068/146] crypto: arm/chacha-neon - optimize for non-block size multiples commit 86cd97ec4b943af35562a74688bc4e909b32c3d1 upstream. @@ -49424,7 +49424,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 107 insertions(+), 24 deletions(-) diff --git a/arch/arm/crypto/chacha-glue.c b/arch/arm/crypto/chacha-glue.c -index cd131b454c2ee..f603184dc0f58 100644 +index cd131b454c2e..f603184dc0f5 100644 --- a/arch/arm/crypto/chacha-glue.c +++ b/arch/arm/crypto/chacha-glue.c @@ -23,7 +23,7 @@ @@ -49478,7 +49478,7 @@ index cd131b454c2ee..f603184dc0f58 100644 } diff --git a/arch/arm/crypto/chacha-neon-core.S b/arch/arm/crypto/chacha-neon-core.S -index eb22926d49127..13d12f672656b 100644 +index eb22926d4912..13d12f672656 100644 --- a/arch/arm/crypto/chacha-neon-core.S +++ b/arch/arm/crypto/chacha-neon-core.S @@ -47,6 +47,7 @@ @@ -49658,10 +49658,10 @@ index eb22926d49127..13d12f672656b 100644 2.18.4 -From 687cd321ca27a865f9b353b5f9186a3373c6ac4c Mon Sep 17 00:00:00 2001 +From 661f1a82453039185fe9393ca3cf3a6dbce007db Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Fri, 6 Nov 2020 17:39:38 +0100 -Subject: [PATCH 069/124] crypto: arm64/chacha - simplify tail block handling +Subject: [PATCH 069/146] crypto: arm64/chacha - simplify tail block handling commit c4fc6328d6c67690a7e6e03f43a5a976a13120ef upstream. @@ -49691,7 +49691,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 69 insertions(+), 124 deletions(-) diff --git a/arch/arm64/crypto/chacha-neon-core.S b/arch/arm64/crypto/chacha-neon-core.S -index 706c4e10e9e29..50d9dd173be79 100644 +index 706c4e10e9e2..50d9dd173be7 100644 --- a/arch/arm64/crypto/chacha-neon-core.S +++ b/arch/arm64/crypto/chacha-neon-core.S @@ -195,7 +195,6 @@ ENTRY(chacha_4block_xor_neon) @@ -49988,10 +49988,10 @@ index 706c4e10e9e29..50d9dd173be79 100644 2.18.4 -From 973aa27a4460512f93a0a5de7446b1e90c639e1c Mon Sep 17 00:00:00 2001 +From 844ccf12c635ace01ee135779fd58f71621333d1 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 15 Jan 2021 20:30:12 +0100 -Subject: [PATCH 070/124] crypto: lib/chacha20poly1305 - define empty module +Subject: [PATCH 070/146] crypto: lib/chacha20poly1305 - define empty module exit function commit ac88c322d0f2917d41d13553c69e9d7f043c8b6f upstream. @@ -50011,7 +50011,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 5 insertions(+) diff --git a/lib/crypto/chacha20poly1305.c b/lib/crypto/chacha20poly1305.c -index 431e042803327..1fec56e5dd511 100644 +index 431e04280332..1fec56e5dd51 100644 --- a/lib/crypto/chacha20poly1305.c +++ b/lib/crypto/chacha20poly1305.c @@ -364,7 +364,12 @@ static int __init mod_init(void) @@ -50031,10 +50031,10 @@ index 431e042803327..1fec56e5dd511 100644 2.18.4 -From 8f8e54f37e8172cece9914470b0493f255d38857 Mon Sep 17 00:00:00 2001 +From 52dc0dbf0f09f3cd607e5b003b611b8227a31b9e Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Sun, 13 Dec 2020 15:39:29 +0100 -Subject: [PATCH 071/124] crypto: arm/chacha-neon - add missing counter +Subject: [PATCH 071/146] crypto: arm/chacha-neon - add missing counter increment commit fd16931a2f518a32753920ff20895e5cf04c8ff1 upstream. @@ -50061,7 +50061,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 insertion(+) diff --git a/arch/arm/crypto/chacha-glue.c b/arch/arm/crypto/chacha-glue.c -index f603184dc0f58..a408f4bcfd625 100644 +index f603184dc0f5..a408f4bcfd62 100644 --- a/arch/arm/crypto/chacha-glue.c +++ b/arch/arm/crypto/chacha-glue.c @@ -60,6 +60,7 @@ static void chacha_doneon(u32 *state, u8 *dst, const u8 *src, @@ -50076,10 +50076,10 @@ index f603184dc0f58..a408f4bcfd625 100644 2.18.4 -From c7211888d3d667d5ab18286bba218419460cd543 Mon Sep 17 00:00:00 2001 +From 2a565d93e2a11b7d92679e8b2c65f34a7a1d186b Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 9 Dec 2019 00:27:34 +0100 -Subject: [PATCH 072/124] net: WireGuard secure network tunnel +Subject: [PATCH 072/146] net: WireGuard secure network tunnel commit e7096c131e5161fa3b8e52a650d7719d2857adfd upstream. @@ -50269,7 +50269,7 @@ Signed-off-by: Jason A. Donenfeld create mode 100755 tools/testing/selftests/wireguard/netns.sh diff --git a/MAINTAINERS b/MAINTAINERS -index 1407008df7491..2395dfb37d1ac 100644 +index 1407008df749..2395dfb37d1a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17584,6 +17584,14 @@ L: linux-gpio@vger.kernel.org @@ -50288,7 +50288,7 @@ index 1407008df7491..2395dfb37d1ac 100644 M: Miloslav Trmac S: Maintained diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig -index df3cd2589bcfe..16ad145e22c91 100644 +index df3cd2589bcf..16ad145e22c9 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -71,6 +71,47 @@ config DUMMY @@ -50340,7 +50340,7 @@ index df3cd2589bcfe..16ad145e22c91 100644 tristate "EQL (serial line load balancing) support" ---help--- diff --git a/drivers/net/Makefile b/drivers/net/Makefile -index 0d3ba056cda3c..953b7c12f0b0c 100644 +index 0d3ba056cda3..953b7c12f0b0 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -10,6 +10,7 @@ obj-$(CONFIG_BONDING) += bonding/ @@ -50353,7 +50353,7 @@ index 0d3ba056cda3c..953b7c12f0b0c 100644 obj-$(CONFIG_MACSEC) += macsec.o diff --git a/drivers/net/wireguard/Makefile b/drivers/net/wireguard/Makefile new file mode 100644 -index 0000000000000..fc52b2cb500b3 +index 000000000000..fc52b2cb500b --- /dev/null +++ b/drivers/net/wireguard/Makefile @@ -0,0 +1,18 @@ @@ -50377,7 +50377,7 @@ index 0000000000000..fc52b2cb500b3 +obj-$(CONFIG_WIREGUARD) := wireguard.o diff --git a/drivers/net/wireguard/allowedips.c b/drivers/net/wireguard/allowedips.c new file mode 100644 -index 0000000000000..72667d5399c34 +index 000000000000..72667d5399c3 --- /dev/null +++ b/drivers/net/wireguard/allowedips.c @@ -0,0 +1,381 @@ @@ -50764,7 +50764,7 @@ index 0000000000000..72667d5399c34 +#include "selftest/allowedips.c" diff --git a/drivers/net/wireguard/allowedips.h b/drivers/net/wireguard/allowedips.h new file mode 100644 -index 0000000000000..e5c83cafcef4c +index 000000000000..e5c83cafcef4 --- /dev/null +++ b/drivers/net/wireguard/allowedips.h @@ -0,0 +1,59 @@ @@ -50829,7 +50829,7 @@ index 0000000000000..e5c83cafcef4c +#endif /* _WG_ALLOWEDIPS_H */ diff --git a/drivers/net/wireguard/cookie.c b/drivers/net/wireguard/cookie.c new file mode 100644 -index 0000000000000..4956f0499c198 +index 000000000000..4956f0499c19 --- /dev/null +++ b/drivers/net/wireguard/cookie.c @@ -0,0 +1,236 @@ @@ -51071,7 +51071,7 @@ index 0000000000000..4956f0499c198 +} diff --git a/drivers/net/wireguard/cookie.h b/drivers/net/wireguard/cookie.h new file mode 100644 -index 0000000000000..c4bd61ca03f24 +index 000000000000..c4bd61ca03f2 --- /dev/null +++ b/drivers/net/wireguard/cookie.h @@ -0,0 +1,59 @@ @@ -51136,7 +51136,7 @@ index 0000000000000..c4bd61ca03f24 +#endif /* _WG_COOKIE_H */ diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c new file mode 100644 -index 0000000000000..16b19824b9ad0 +index 000000000000..16b19824b9ad --- /dev/null +++ b/drivers/net/wireguard/device.c @@ -0,0 +1,458 @@ @@ -51600,7 +51600,7 @@ index 0000000000000..16b19824b9ad0 +} diff --git a/drivers/net/wireguard/device.h b/drivers/net/wireguard/device.h new file mode 100644 -index 0000000000000..b15a8be9d8169 +index 000000000000..b15a8be9d816 --- /dev/null +++ b/drivers/net/wireguard/device.h @@ -0,0 +1,65 @@ @@ -51671,7 +51671,7 @@ index 0000000000000..b15a8be9d8169 +#endif /* _WG_DEVICE_H */ diff --git a/drivers/net/wireguard/main.c b/drivers/net/wireguard/main.c new file mode 100644 -index 0000000000000..10c0a40f6a9e5 +index 000000000000..10c0a40f6a9e --- /dev/null +++ b/drivers/net/wireguard/main.c @@ -0,0 +1,64 @@ @@ -51741,7 +51741,7 @@ index 0000000000000..10c0a40f6a9e5 +MODULE_ALIAS_GENL_FAMILY(WG_GENL_NAME); diff --git a/drivers/net/wireguard/messages.h b/drivers/net/wireguard/messages.h new file mode 100644 -index 0000000000000..b8a7b9ce32ba7 +index 000000000000..b8a7b9ce32ba --- /dev/null +++ b/drivers/net/wireguard/messages.h @@ -0,0 +1,128 @@ @@ -51875,7 +51875,7 @@ index 0000000000000..b8a7b9ce32ba7 +#endif /* _WG_MESSAGES_H */ diff --git a/drivers/net/wireguard/netlink.c b/drivers/net/wireguard/netlink.c new file mode 100644 -index 0000000000000..0739a2cd19203 +index 000000000000..0739a2cd1920 --- /dev/null +++ b/drivers/net/wireguard/netlink.c @@ -0,0 +1,648 @@ @@ -52529,7 +52529,7 @@ index 0000000000000..0739a2cd19203 +} diff --git a/drivers/net/wireguard/netlink.h b/drivers/net/wireguard/netlink.h new file mode 100644 -index 0000000000000..15100d92e2e32 +index 000000000000..15100d92e2e3 --- /dev/null +++ b/drivers/net/wireguard/netlink.h @@ -0,0 +1,12 @@ @@ -52547,7 +52547,7 @@ index 0000000000000..15100d92e2e32 +#endif /* _WG_NETLINK_H */ diff --git a/drivers/net/wireguard/noise.c b/drivers/net/wireguard/noise.c new file mode 100644 -index 0000000000000..d71c8db68a8ce +index 000000000000..d71c8db68a8c --- /dev/null +++ b/drivers/net/wireguard/noise.c @@ -0,0 +1,828 @@ @@ -53381,7 +53381,7 @@ index 0000000000000..d71c8db68a8ce +} diff --git a/drivers/net/wireguard/noise.h b/drivers/net/wireguard/noise.h new file mode 100644 -index 0000000000000..138a07bb817ce +index 000000000000..138a07bb817c --- /dev/null +++ b/drivers/net/wireguard/noise.h @@ -0,0 +1,137 @@ @@ -53524,7 +53524,7 @@ index 0000000000000..138a07bb817ce +#endif /* _WG_NOISE_H */ diff --git a/drivers/net/wireguard/peer.c b/drivers/net/wireguard/peer.c new file mode 100644 -index 0000000000000..071eedf33f5aa +index 000000000000..071eedf33f5a --- /dev/null +++ b/drivers/net/wireguard/peer.c @@ -0,0 +1,240 @@ @@ -53770,7 +53770,7 @@ index 0000000000000..071eedf33f5aa +} diff --git a/drivers/net/wireguard/peer.h b/drivers/net/wireguard/peer.h new file mode 100644 -index 0000000000000..23af409229972 +index 000000000000..23af40922997 --- /dev/null +++ b/drivers/net/wireguard/peer.h @@ -0,0 +1,83 @@ @@ -53859,7 +53859,7 @@ index 0000000000000..23af409229972 +#endif /* _WG_PEER_H */ diff --git a/drivers/net/wireguard/peerlookup.c b/drivers/net/wireguard/peerlookup.c new file mode 100644 -index 0000000000000..e4deb331476b3 +index 000000000000..e4deb331476b --- /dev/null +++ b/drivers/net/wireguard/peerlookup.c @@ -0,0 +1,221 @@ @@ -54086,7 +54086,7 @@ index 0000000000000..e4deb331476b3 +} diff --git a/drivers/net/wireguard/peerlookup.h b/drivers/net/wireguard/peerlookup.h new file mode 100644 -index 0000000000000..ced8117976800 +index 000000000000..ced811797680 --- /dev/null +++ b/drivers/net/wireguard/peerlookup.h @@ -0,0 +1,64 @@ @@ -54156,7 +54156,7 @@ index 0000000000000..ced8117976800 +#endif /* _WG_PEERLOOKUP_H */ diff --git a/drivers/net/wireguard/queueing.c b/drivers/net/wireguard/queueing.c new file mode 100644 -index 0000000000000..5c964fcb994ec +index 000000000000..5c964fcb994e --- /dev/null +++ b/drivers/net/wireguard/queueing.c @@ -0,0 +1,53 @@ @@ -54215,7 +54215,7 @@ index 0000000000000..5c964fcb994ec +} diff --git a/drivers/net/wireguard/queueing.h b/drivers/net/wireguard/queueing.h new file mode 100644 -index 0000000000000..58fdd630b246c +index 000000000000..58fdd630b246 --- /dev/null +++ b/drivers/net/wireguard/queueing.h @@ -0,0 +1,197 @@ @@ -54418,7 +54418,7 @@ index 0000000000000..58fdd630b246c +#endif /* _WG_QUEUEING_H */ diff --git a/drivers/net/wireguard/ratelimiter.c b/drivers/net/wireguard/ratelimiter.c new file mode 100644 -index 0000000000000..3fedd1d21f5ee +index 000000000000..3fedd1d21f5e --- /dev/null +++ b/drivers/net/wireguard/ratelimiter.c @@ -0,0 +1,223 @@ @@ -54647,7 +54647,7 @@ index 0000000000000..3fedd1d21f5ee +#include "selftest/ratelimiter.c" diff --git a/drivers/net/wireguard/ratelimiter.h b/drivers/net/wireguard/ratelimiter.h new file mode 100644 -index 0000000000000..83067f71ea99e +index 000000000000..83067f71ea99 --- /dev/null +++ b/drivers/net/wireguard/ratelimiter.h @@ -0,0 +1,19 @@ @@ -54672,7 +54672,7 @@ index 0000000000000..83067f71ea99e +#endif /* _WG_RATELIMITER_H */ diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c new file mode 100644 -index 0000000000000..7e675f5414910 +index 000000000000..7e675f541491 --- /dev/null +++ b/drivers/net/wireguard/receive.c @@ -0,0 +1,595 @@ @@ -55273,7 +55273,7 @@ index 0000000000000..7e675f5414910 +} diff --git a/drivers/net/wireguard/selftest/allowedips.c b/drivers/net/wireguard/selftest/allowedips.c new file mode 100644 -index 0000000000000..846db14cb046b +index 000000000000..846db14cb046 --- /dev/null +++ b/drivers/net/wireguard/selftest/allowedips.c @@ -0,0 +1,683 @@ @@ -55962,7 +55962,7 @@ index 0000000000000..846db14cb046b +#endif diff --git a/drivers/net/wireguard/selftest/counter.c b/drivers/net/wireguard/selftest/counter.c new file mode 100644 -index 0000000000000..f4fbb9072ed73 +index 000000000000..f4fbb9072ed7 --- /dev/null +++ b/drivers/net/wireguard/selftest/counter.c @@ -0,0 +1,104 @@ @@ -56072,7 +56072,7 @@ index 0000000000000..f4fbb9072ed73 +#endif diff --git a/drivers/net/wireguard/selftest/ratelimiter.c b/drivers/net/wireguard/selftest/ratelimiter.c new file mode 100644 -index 0000000000000..bcd6462e45401 +index 000000000000..bcd6462e4540 --- /dev/null +++ b/drivers/net/wireguard/selftest/ratelimiter.c @@ -0,0 +1,226 @@ @@ -56304,7 +56304,7 @@ index 0000000000000..bcd6462e45401 +#endif diff --git a/drivers/net/wireguard/send.c b/drivers/net/wireguard/send.c new file mode 100644 -index 0000000000000..c132605634460 +index 000000000000..c13260563446 --- /dev/null +++ b/drivers/net/wireguard/send.c @@ -0,0 +1,413 @@ @@ -56723,7 +56723,7 @@ index 0000000000000..c132605634460 +} diff --git a/drivers/net/wireguard/socket.c b/drivers/net/wireguard/socket.c new file mode 100644 -index 0000000000000..c46256d0d81c1 +index 000000000000..c46256d0d81c --- /dev/null +++ b/drivers/net/wireguard/socket.c @@ -0,0 +1,437 @@ @@ -57166,7 +57166,7 @@ index 0000000000000..c46256d0d81c1 +} diff --git a/drivers/net/wireguard/socket.h b/drivers/net/wireguard/socket.h new file mode 100644 -index 0000000000000..bab5848efbcdf +index 000000000000..bab5848efbcd --- /dev/null +++ b/drivers/net/wireguard/socket.h @@ -0,0 +1,44 @@ @@ -57216,7 +57216,7 @@ index 0000000000000..bab5848efbcdf +#endif /* _WG_SOCKET_H */ diff --git a/drivers/net/wireguard/timers.c b/drivers/net/wireguard/timers.c new file mode 100644 -index 0000000000000..d54d32ac9bc41 +index 000000000000..d54d32ac9bc4 --- /dev/null +++ b/drivers/net/wireguard/timers.c @@ -0,0 +1,243 @@ @@ -57465,7 +57465,7 @@ index 0000000000000..d54d32ac9bc41 +} diff --git a/drivers/net/wireguard/timers.h b/drivers/net/wireguard/timers.h new file mode 100644 -index 0000000000000..f0653dcb13266 +index 000000000000..f0653dcb1326 --- /dev/null +++ b/drivers/net/wireguard/timers.h @@ -0,0 +1,31 @@ @@ -57502,14 +57502,14 @@ index 0000000000000..f0653dcb13266 +#endif /* _WG_TIMERS_H */ diff --git a/drivers/net/wireguard/version.h b/drivers/net/wireguard/version.h new file mode 100644 -index 0000000000000..a1a269a116344 +index 000000000000..a1a269a11634 --- /dev/null +++ b/drivers/net/wireguard/version.h @@ -0,0 +1 @@ +#define WIREGUARD_VERSION "1.0.0" diff --git a/include/uapi/linux/wireguard.h b/include/uapi/linux/wireguard.h new file mode 100644 -index 0000000000000..dd8a47c4ad11f +index 000000000000..dd8a47c4ad11 --- /dev/null +++ b/include/uapi/linux/wireguard.h @@ -0,0 +1,196 @@ @@ -57711,7 +57711,7 @@ index 0000000000000..dd8a47c4ad11f +#endif /* _WG_UAPI_WIREGUARD_H */ diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh new file mode 100755 -index 0000000000000..e7310d9390f7e +index 000000000000..e7310d9390f7 --- /dev/null +++ b/tools/testing/selftests/wireguard/netns.sh @@ -0,0 +1,537 @@ @@ -58256,10 +58256,10 @@ index 0000000000000..e7310d9390f7e 2.18.4 -From 9ba5b1f9cc591fbbe725045f93de149c66e347ec Mon Sep 17 00:00:00 2001 +From 816cade9874413664aaa1ac0b66b97336b40dda2 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 15 Dec 2019 22:08:00 +0100 -Subject: [PATCH 073/124] wireguard: selftests: import harness makefile for +Subject: [PATCH 073/146] wireguard: selftests: import harness makefile for test suite commit 65d88d04114bca7d85faebd5fed61069cb2b632c upstream. @@ -58336,7 +58336,7 @@ Signed-off-by: Jason A. Donenfeld diff --git a/tools/testing/selftests/wireguard/qemu/.gitignore b/tools/testing/selftests/wireguard/qemu/.gitignore new file mode 100644 -index 0000000000000..415b542a9d599 +index 000000000000..415b542a9d59 --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/.gitignore @@ -0,0 +1,2 @@ @@ -58344,7 +58344,7 @@ index 0000000000000..415b542a9d599 +distfiles/ diff --git a/tools/testing/selftests/wireguard/qemu/Makefile b/tools/testing/selftests/wireguard/qemu/Makefile new file mode 100644 -index 0000000000000..6d51bf78eeff4 +index 000000000000..6d51bf78eeff --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/Makefile @@ -0,0 +1,385 @@ @@ -58735,7 +58735,7 @@ index 0000000000000..6d51bf78eeff4 +.DELETE_ON_ERROR: diff --git a/tools/testing/selftests/wireguard/qemu/arch/aarch64.config b/tools/testing/selftests/wireguard/qemu/arch/aarch64.config new file mode 100644 -index 0000000000000..3d063bb247bbe +index 000000000000..3d063bb247bb --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/arch/aarch64.config @@ -0,0 +1,5 @@ @@ -58746,7 +58746,7 @@ index 0000000000000..3d063bb247bbe +CONFIG_FRAME_WARN=1280 diff --git a/tools/testing/selftests/wireguard/qemu/arch/aarch64_be.config b/tools/testing/selftests/wireguard/qemu/arch/aarch64_be.config new file mode 100644 -index 0000000000000..dbdc7e406a7ba +index 000000000000..dbdc7e406a7b --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/arch/aarch64_be.config @@ -0,0 +1,6 @@ @@ -58758,7 +58758,7 @@ index 0000000000000..dbdc7e406a7ba +CONFIG_FRAME_WARN=1280 diff --git a/tools/testing/selftests/wireguard/qemu/arch/arm.config b/tools/testing/selftests/wireguard/qemu/arch/arm.config new file mode 100644 -index 0000000000000..148f499054182 +index 000000000000..148f49905418 --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/arch/arm.config @@ -0,0 +1,9 @@ @@ -58773,7 +58773,7 @@ index 0000000000000..148f499054182 +CONFIG_FRAME_WARN=1024 diff --git a/tools/testing/selftests/wireguard/qemu/arch/armeb.config b/tools/testing/selftests/wireguard/qemu/arch/armeb.config new file mode 100644 -index 0000000000000..bd76b07d00a2c +index 000000000000..bd76b07d00a2 --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/arch/armeb.config @@ -0,0 +1,10 @@ @@ -58789,7 +58789,7 @@ index 0000000000000..bd76b07d00a2c +CONFIG_FRAME_WARN=1024 diff --git a/tools/testing/selftests/wireguard/qemu/arch/i686.config b/tools/testing/selftests/wireguard/qemu/arch/i686.config new file mode 100644 -index 0000000000000..a85025d7206ee +index 000000000000..a85025d7206e --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/arch/i686.config @@ -0,0 +1,5 @@ @@ -58800,7 +58800,7 @@ index 0000000000000..a85025d7206ee +CONFIG_FRAME_WARN=1024 diff --git a/tools/testing/selftests/wireguard/qemu/arch/m68k.config b/tools/testing/selftests/wireguard/qemu/arch/m68k.config new file mode 100644 -index 0000000000000..5381ea10896c3 +index 000000000000..5381ea10896c --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/arch/m68k.config @@ -0,0 +1,9 @@ @@ -58815,7 +58815,7 @@ index 0000000000000..5381ea10896c3 +CONFIG_FRAME_WARN=1024 diff --git a/tools/testing/selftests/wireguard/qemu/arch/mips.config b/tools/testing/selftests/wireguard/qemu/arch/mips.config new file mode 100644 -index 0000000000000..df71d6b95546f +index 000000000000..df71d6b95546 --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/arch/mips.config @@ -0,0 +1,11 @@ @@ -58832,7 +58832,7 @@ index 0000000000000..df71d6b95546f +CONFIG_FRAME_WARN=1024 diff --git a/tools/testing/selftests/wireguard/qemu/arch/mips64.config b/tools/testing/selftests/wireguard/qemu/arch/mips64.config new file mode 100644 -index 0000000000000..90c783f725c4d +index 000000000000..90c783f725c4 --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/arch/mips64.config @@ -0,0 +1,14 @@ @@ -58852,7 +58852,7 @@ index 0000000000000..90c783f725c4d +CONFIG_FRAME_WARN=1280 diff --git a/tools/testing/selftests/wireguard/qemu/arch/mips64el.config b/tools/testing/selftests/wireguard/qemu/arch/mips64el.config new file mode 100644 -index 0000000000000..435b0b43e00cb +index 000000000000..435b0b43e00c --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/arch/mips64el.config @@ -0,0 +1,15 @@ @@ -58873,7 +58873,7 @@ index 0000000000000..435b0b43e00cb +CONFIG_FRAME_WARN=1280 diff --git a/tools/testing/selftests/wireguard/qemu/arch/mipsel.config b/tools/testing/selftests/wireguard/qemu/arch/mipsel.config new file mode 100644 -index 0000000000000..62bb50c4a85fc +index 000000000000..62bb50c4a85f --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/arch/mipsel.config @@ -0,0 +1,12 @@ @@ -58891,7 +58891,7 @@ index 0000000000000..62bb50c4a85fc +CONFIG_FRAME_WARN=1024 diff --git a/tools/testing/selftests/wireguard/qemu/arch/powerpc.config b/tools/testing/selftests/wireguard/qemu/arch/powerpc.config new file mode 100644 -index 0000000000000..57957093b71b8 +index 000000000000..57957093b71b --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/arch/powerpc.config @@ -0,0 +1,10 @@ @@ -58907,7 +58907,7 @@ index 0000000000000..57957093b71b8 +CONFIG_FRAME_WARN=1024 diff --git a/tools/testing/selftests/wireguard/qemu/arch/powerpc64le.config b/tools/testing/selftests/wireguard/qemu/arch/powerpc64le.config new file mode 100644 -index 0000000000000..990c510a9cfa5 +index 000000000000..990c510a9cfa --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/arch/powerpc64le.config @@ -0,0 +1,12 @@ @@ -58925,7 +58925,7 @@ index 0000000000000..990c510a9cfa5 +CONFIG_FRAME_WARN=1280 diff --git a/tools/testing/selftests/wireguard/qemu/arch/x86_64.config b/tools/testing/selftests/wireguard/qemu/arch/x86_64.config new file mode 100644 -index 0000000000000..00a1ef4869d58 +index 000000000000..00a1ef4869d5 --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/arch/x86_64.config @@ -0,0 +1,5 @@ @@ -58936,7 +58936,7 @@ index 0000000000000..00a1ef4869d58 +CONFIG_FRAME_WARN=1280 diff --git a/tools/testing/selftests/wireguard/qemu/debug.config b/tools/testing/selftests/wireguard/qemu/debug.config new file mode 100644 -index 0000000000000..b9c72706fe4db +index 000000000000..b9c72706fe4d --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/debug.config @@ -0,0 +1,67 @@ @@ -59009,7 +59009,7 @@ index 0000000000000..b9c72706fe4db +CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y diff --git a/tools/testing/selftests/wireguard/qemu/init.c b/tools/testing/selftests/wireguard/qemu/init.c new file mode 100644 -index 0000000000000..51e5ddedee886 +index 000000000000..51e5ddedee88 --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/init.c @@ -0,0 +1,284 @@ @@ -59299,7 +59299,7 @@ index 0000000000000..51e5ddedee886 +} diff --git a/tools/testing/selftests/wireguard/qemu/kernel.config b/tools/testing/selftests/wireguard/qemu/kernel.config new file mode 100644 -index 0000000000000..9cca30206014d +index 000000000000..9cca30206014 --- /dev/null +++ b/tools/testing/selftests/wireguard/qemu/kernel.config @@ -0,0 +1,86 @@ @@ -59393,10 +59393,10 @@ index 0000000000000..9cca30206014d 2.18.4 -From f70e1a6c29e243adda7b1f5da28c10eb39d167f3 Mon Sep 17 00:00:00 2001 +From 1e2e29be06d62c973c729b60895a300176a81d50 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 15 Dec 2019 22:08:01 +0100 -Subject: [PATCH 074/124] wireguard: Kconfig: select parent dependency for +Subject: [PATCH 074/146] wireguard: Kconfig: select parent dependency for crypto commit d7c68a38bb4f9b7c1a2e4a772872c752ee5c44a6 upstream. @@ -59414,7 +59414,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 2 insertions(+) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig -index 16ad145e22c91..57f1ba924f4ec 100644 +index 16ad145e22c9..57f1ba924f4e 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -85,6 +85,8 @@ config WIREGUARD @@ -59430,10 +59430,10 @@ index 16ad145e22c91..57f1ba924f4ec 100644 2.18.4 -From 99693926e0ba394e2cd6e0b2816f722e10713979 Mon Sep 17 00:00:00 2001 +From 38179aa1712a539a1576dda5a0df921360006b60 Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 15 Dec 2019 22:08:02 +0100 -Subject: [PATCH 075/124] wireguard: global: fix spelling mistakes in comments +Subject: [PATCH 075/146] wireguard: global: fix spelling mistakes in comments commit a2ec8b5706944d228181c8b91d815f41d6dd8e7b upstream. @@ -59450,7 +59450,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c -index 7e675f5414910..9c6bab9c981f4 100644 +index 7e675f541491..9c6bab9c981f 100644 --- a/drivers/net/wireguard/receive.c +++ b/drivers/net/wireguard/receive.c @@ -380,7 +380,7 @@ static void wg_packet_consume_data_done(struct wg_peer *peer, @@ -59463,7 +59463,7 @@ index 7e675f5414910..9c6bab9c981f4 100644 */ skb->ip_summed = CHECKSUM_UNNECESSARY; diff --git a/include/uapi/linux/wireguard.h b/include/uapi/linux/wireguard.h -index dd8a47c4ad11f..ae88be14c9478 100644 +index dd8a47c4ad11..ae88be14c947 100644 --- a/include/uapi/linux/wireguard.h +++ b/include/uapi/linux/wireguard.h @@ -18,13 +18,13 @@ @@ -59504,10 +59504,10 @@ index dd8a47c4ad11f..ae88be14c9478 100644 2.18.4 -From 047cec8e8a87e67fafe1264b333d0982510d6a26 Mon Sep 17 00:00:00 2001 +From 3da5248ad704c7dd3e4a6249bf490415501bea1f Mon Sep 17 00:00:00 2001 From: YueHaibing Date: Sun, 15 Dec 2019 22:08:03 +0100 -Subject: [PATCH 076/124] wireguard: main: remove unused include +Subject: [PATCH 076/146] wireguard: main: remove unused include commit 43967b6ff91e53bcce5ae08c16a0588a475b53a1 upstream. @@ -59524,7 +59524,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 deletion(-) diff --git a/drivers/net/wireguard/main.c b/drivers/net/wireguard/main.c -index 10c0a40f6a9e5..7a7d5f1a80fc7 100644 +index 10c0a40f6a9e..7a7d5f1a80fc 100644 --- a/drivers/net/wireguard/main.c +++ b/drivers/net/wireguard/main.c @@ -12,7 +12,6 @@ @@ -59539,10 +59539,10 @@ index 10c0a40f6a9e5..7a7d5f1a80fc7 100644 2.18.4 -From 58b3a9e8b9cee3239cd06ef175298547273a4295 Mon Sep 17 00:00:00 2001 +From fbec014627111f4163d1eb9f90693ac7206b7c5f Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Sun, 15 Dec 2019 22:08:04 +0100 -Subject: [PATCH 077/124] wireguard: allowedips: use kfree_rcu() instead of +Subject: [PATCH 077/146] wireguard: allowedips: use kfree_rcu() instead of call_rcu() commit d89ee7d5c73af15c1c6f12b016cdf469742b5726 upstream. @@ -59559,7 +59559,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/wireguard/allowedips.c b/drivers/net/wireguard/allowedips.c -index 72667d5399c34..121d9ea0f1358 100644 +index 72667d5399c3..121d9ea0f135 100644 --- a/drivers/net/wireguard/allowedips.c +++ b/drivers/net/wireguard/allowedips.c @@ -31,11 +31,6 @@ static void copy_and_assign_cidr(struct allowedips_node *node, const u8 *src, @@ -59587,10 +59587,10 @@ index 72667d5399c34..121d9ea0f1358 100644 2.18.4 -From 8d8c7a1f402c98e771c36b235238411395674250 Mon Sep 17 00:00:00 2001 +From 5bc9001421cfab1f6ec96276255e7fc7c2063ff0 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 2 Jan 2020 17:47:49 +0100 -Subject: [PATCH 078/124] wireguard: selftests: remove ancient kernel +Subject: [PATCH 078/146] wireguard: selftests: remove ancient kernel compatibility code commit 9a69a4c8802adf642bc4a13d471b5a86b44ed434 upstream. @@ -59617,7 +59617,7 @@ Signed-off-by: Jason A. Donenfeld 5 files changed, 50 insertions(+), 48 deletions(-) diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh -index e7310d9390f7e..d5c85c7494f2e 100755 +index e7310d9390f7..d5c85c7494f2 100755 --- a/tools/testing/selftests/wireguard/netns.sh +++ b/tools/testing/selftests/wireguard/netns.sh @@ -37,7 +37,7 @@ n2() { pretty 2 "$*"; maybe_exec ip netns exec $netns2 "$@"; } @@ -59646,7 +59646,7 @@ index e7310d9390f7e..d5c85c7494f2e 100755 n0 iptables -t nat -F ip0 link del vethrc diff --git a/tools/testing/selftests/wireguard/qemu/Makefile b/tools/testing/selftests/wireguard/qemu/Makefile -index 6d51bf78eeff4..f10aa3590adc4 100644 +index 6d51bf78eeff..f10aa3590adc 100644 --- a/tools/testing/selftests/wireguard/qemu/Makefile +++ b/tools/testing/selftests/wireguard/qemu/Makefile @@ -5,6 +5,7 @@ @@ -59924,7 +59924,7 @@ index 6d51bf78eeff4..f10aa3590adc4 100644 .PHONY: qemu build clean distclean menuconfig .DELETE_ON_ERROR: diff --git a/tools/testing/selftests/wireguard/qemu/arch/m68k.config b/tools/testing/selftests/wireguard/qemu/arch/m68k.config -index 5381ea10896c3..62a15bdb877e7 100644 +index 5381ea10896c..62a15bdb877e 100644 --- a/tools/testing/selftests/wireguard/qemu/arch/m68k.config +++ b/tools/testing/selftests/wireguard/qemu/arch/m68k.config @@ -1,9 +1,9 @@ @@ -59939,7 +59939,7 @@ index 5381ea10896c3..62a15bdb877e7 100644 CONFIG_CMDLINE="console=ttyS0 wg.success=ttyS1" CONFIG_FRAME_WARN=1024 diff --git a/tools/testing/selftests/wireguard/qemu/init.c b/tools/testing/selftests/wireguard/qemu/init.c -index 51e5ddedee886..90bc9813cadcd 100644 +index 51e5ddedee88..90bc9813cadc 100644 --- a/tools/testing/selftests/wireguard/qemu/init.c +++ b/tools/testing/selftests/wireguard/qemu/init.c @@ -21,6 +21,7 @@ @@ -59951,7 +59951,7 @@ index 51e5ddedee886..90bc9813cadcd 100644 #include diff --git a/tools/testing/selftests/wireguard/qemu/kernel.config b/tools/testing/selftests/wireguard/qemu/kernel.config -index 9cca30206014d..af9323a0b6e09 100644 +index 9cca30206014..af9323a0b6e0 100644 --- a/tools/testing/selftests/wireguard/qemu/kernel.config +++ b/tools/testing/selftests/wireguard/qemu/kernel.config @@ -39,6 +39,7 @@ CONFIG_PRINTK=y @@ -59974,10 +59974,10 @@ index 9cca30206014d..af9323a0b6e09 100644 2.18.4 -From 67d324d88510f1680ff57f141e194031b1a8f541 Mon Sep 17 00:00:00 2001 +From c6bd3435fb2bcdfabf18fc93c9d5659f512c19b0 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 2 Jan 2020 17:47:50 +0100 -Subject: [PATCH 079/124] wireguard: queueing: do not account for pfmemalloc +Subject: [PATCH 079/146] wireguard: queueing: do not account for pfmemalloc when clearing skb header commit 04d2ea92a18417619182cbb79063f154892b0150 upstream. @@ -59998,7 +59998,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 3 deletions(-) diff --git a/drivers/net/wireguard/queueing.h b/drivers/net/wireguard/queueing.h -index 58fdd630b246c..e62c714a548ee 100644 +index 58fdd630b246..e62c714a548e 100644 --- a/drivers/net/wireguard/queueing.h +++ b/drivers/net/wireguard/queueing.h @@ -83,13 +83,10 @@ static inline __be16 wg_skb_examine_untrusted_ip_hdr(struct sk_buff *skb) @@ -60019,10 +60019,10 @@ index 58fdd630b246c..e62c714a548ee 100644 2.18.4 -From dce70ef9a067ea0a0a7d39f299a10a1d83ae4d72 Mon Sep 17 00:00:00 2001 +From 99947c7c1c24de5ad7600121c47d2ca4dc1cdc3d Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 2 Jan 2020 17:47:51 +0100 -Subject: [PATCH 080/124] wireguard: socket: mark skbs as not on list when +Subject: [PATCH 080/146] wireguard: socket: mark skbs as not on list when receiving via gro commit 736775d06bac60d7a353e405398b48b2bd8b1e54 upstream. @@ -60044,7 +60044,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireguard/socket.c b/drivers/net/wireguard/socket.c -index c46256d0d81c1..262f3b5c819d5 100644 +index c46256d0d81c..262f3b5c819d 100644 --- a/drivers/net/wireguard/socket.c +++ b/drivers/net/wireguard/socket.c @@ -333,6 +333,7 @@ static int wg_receive(struct sock *sk, struct sk_buff *skb) @@ -60059,10 +60059,10 @@ index c46256d0d81c1..262f3b5c819d5 100644 2.18.4 -From 93ac00668d7422ef05f04eb7a87e12b8b905184d Mon Sep 17 00:00:00 2001 +From b357591c0be11dfe4f53c02a4cefa16f6e6d0a76 Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Tue, 4 Feb 2020 22:17:25 +0100 -Subject: [PATCH 081/124] wireguard: allowedips: fix use-after-free in +Subject: [PATCH 081/146] wireguard: allowedips: fix use-after-free in root_remove_peer_lists commit 9981159fc3b677b357f84e069a11de5a5ec8a2a8 upstream. @@ -60214,7 +60214,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireguard/allowedips.c b/drivers/net/wireguard/allowedips.c -index 121d9ea0f1358..3725e9cd85f4f 100644 +index 121d9ea0f135..3725e9cd85f4 100644 --- a/drivers/net/wireguard/allowedips.c +++ b/drivers/net/wireguard/allowedips.c @@ -263,6 +263,7 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, @@ -60229,10 +60229,10 @@ index 121d9ea0f1358..3725e9cd85f4f 100644 2.18.4 -From ea5089abc5550726239bc5f36aa77e1322b3066f Mon Sep 17 00:00:00 2001 +From 6d35cfaafb885b297538516632b847519d69c4b8 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 4 Feb 2020 22:17:26 +0100 -Subject: [PATCH 082/124] wireguard: noise: reject peers with low order public +Subject: [PATCH 082/146] wireguard: noise: reject peers with low order public keys commit ec31c2676a10e064878927b243fada8c2fb0c03c upstream. @@ -60422,7 +60422,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireguard/netlink.c b/drivers/net/wireguard/netlink.c -index 0739a2cd19203..45a631e79d7ab 100644 +index 0739a2cd1920..45a631e79d7a 100644 --- a/drivers/net/wireguard/netlink.c +++ b/drivers/net/wireguard/netlink.c @@ -575,10 +575,8 @@ static int wg_set_device(struct sk_buff *skb, struct genl_info *info) @@ -60439,7 +60439,7 @@ index 0739a2cd19203..45a631e79d7ab 100644 wg_cookie_checker_precompute_device_keys(&wg->cookie_checker); up_write(&wg->static_identity.lock); diff --git a/drivers/net/wireguard/noise.c b/drivers/net/wireguard/noise.c -index d71c8db68a8ce..919d9d866446a 100644 +index d71c8db68a8c..919d9d866446 100644 --- a/drivers/net/wireguard/noise.c +++ b/drivers/net/wireguard/noise.c @@ -46,17 +46,21 @@ void __init wg_noise_init(void) @@ -60471,10 +60471,10 @@ index d71c8db68a8ce..919d9d866446a 100644 2.18.4 -From 9c83a9b35c80b73a7ba02b5de86b3fdfa34dc542 Mon Sep 17 00:00:00 2001 +From 7ed62dd8adb7dcb0c4e8baed1798bc7891393e5e Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 4 Feb 2020 22:17:27 +0100 -Subject: [PATCH 083/124] wireguard: selftests: ensure non-addition of peers +Subject: [PATCH 083/146] wireguard: selftests: ensure non-addition of peers with failed precomputation commit f9398acba6a4ae9cb98bfe4d56414d376eff8d57 upstream. @@ -60491,7 +60491,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 6 insertions(+) diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh -index d5c85c7494f2e..b03647d1bbf6c 100755 +index d5c85c7494f2..b03647d1bbf6 100755 --- a/tools/testing/selftests/wireguard/netns.sh +++ b/tools/testing/selftests/wireguard/netns.sh @@ -516,6 +516,12 @@ n0 wg set wg0 peer "$pub2" allowed-ips 0.0.0.0/0,10.0.0.0/8,100.0.0.0/10,172.16. @@ -60511,10 +60511,10 @@ index d5c85c7494f2e..b03647d1bbf6c 100755 2.18.4 -From 28265c2e0e86660f46b8c87c8bc5cf2b6d804e39 Mon Sep 17 00:00:00 2001 +From 71672637ea1ee8fedb2f728091e7c4bc589c55fb Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 4 Feb 2020 22:17:29 +0100 -Subject: [PATCH 084/124] wireguard: selftests: tie socket waiting to target +Subject: [PATCH 084/146] wireguard: selftests: tie socket waiting to target pid commit 88f404a9b1d75388225b1c67b6dd327cb2182777 upstream. @@ -60531,7 +60531,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh -index b03647d1bbf6c..f5ab1cda8bb55 100755 +index b03647d1bbf6..f5ab1cda8bb5 100755 --- a/tools/testing/selftests/wireguard/netns.sh +++ b/tools/testing/selftests/wireguard/netns.sh @@ -38,9 +38,8 @@ ip0() { pretty 0 "ip $*"; ip -n $netns0 "$@"; } @@ -60595,10 +60595,10 @@ index b03647d1bbf6c..f5ab1cda8bb55 100755 2.18.4 -From 257fc449457fcb57f90fd5fd830fa7a764748a92 Mon Sep 17 00:00:00 2001 +From 595b0831e6ecb7b0b02d9937e624155965c72096 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 11 Feb 2020 20:47:08 +0100 -Subject: [PATCH 085/124] wireguard: device: use icmp_ndo_send helper +Subject: [PATCH 085/146] wireguard: device: use icmp_ndo_send helper commit a12d7f3cbdc72c7625881c8dc2660fc2c979fdf2 upstream. @@ -60618,7 +60618,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c -index 16b19824b9ad0..43db442b13730 100644 +index 16b19824b9ad..43db442b1373 100644 --- a/drivers/net/wireguard/device.c +++ b/drivers/net/wireguard/device.c @@ -203,9 +203,9 @@ static netdev_tx_t wg_xmit(struct sk_buff *skb, struct net_device *dev) @@ -60634,7 +60634,7 @@ index 16b19824b9ad0..43db442b13730 100644 return ret; } diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh -index f5ab1cda8bb55..138d46b3f3306 100755 +index f5ab1cda8bb5..138d46b3f330 100755 --- a/tools/testing/selftests/wireguard/netns.sh +++ b/tools/testing/selftests/wireguard/netns.sh @@ -24,6 +24,7 @@ @@ -60667,10 +60667,10 @@ index f5ab1cda8bb55..138d46b3f3306 100755 2.18.4 -From d4425a26a465b9ee5eed488576756173e054ce55 Mon Sep 17 00:00:00 2001 +From f6d3a204774c8d10d5dc11501547b03aecc1accb Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 14 Feb 2020 23:57:20 +0100 -Subject: [PATCH 086/124] wireguard: selftests: reduce complexity and fix make +Subject: [PATCH 086/146] wireguard: selftests: reduce complexity and fix make races commit 04ddf1208f03e1dbc39a4619c40eba640051b950 upstream. @@ -60687,7 +60687,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/tools/testing/selftests/wireguard/qemu/Makefile b/tools/testing/selftests/wireguard/qemu/Makefile -index f10aa3590adc4..28d477683e8ab 100644 +index f10aa3590adc..28d477683e8a 100644 --- a/tools/testing/selftests/wireguard/qemu/Makefile +++ b/tools/testing/selftests/wireguard/qemu/Makefile @@ -38,19 +38,17 @@ endef @@ -60777,10 +60777,10 @@ index f10aa3590adc4..28d477683e8ab 100644 2.18.4 -From 23edd1fd792c68d1e7d65af258ebbb5b29a057a3 Mon Sep 17 00:00:00 2001 +From ad261f9a4067e69f74557aa8dbf72d68ff80c53b Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 14 Feb 2020 23:57:21 +0100 -Subject: [PATCH 087/124] wireguard: receive: reset last_under_load to zero +Subject: [PATCH 087/146] wireguard: receive: reset last_under_load to zero commit 2a8a4df36462aa85b0db87b7c5ea145ba67e34a8 upstream. @@ -60798,7 +60798,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c -index 9c6bab9c981f4..4a153894cee25 100644 +index 9c6bab9c981f..4a153894cee2 100644 --- a/drivers/net/wireguard/receive.c +++ b/drivers/net/wireguard/receive.c @@ -118,10 +118,13 @@ static void wg_receive_handshake_packet(struct wg_device *wg, @@ -60821,10 +60821,10 @@ index 9c6bab9c981f4..4a153894cee25 100644 2.18.4 -From 8be835018687cbcbf5a0fa806280d2dcc170cb84 Mon Sep 17 00:00:00 2001 +From 76d387a113b43142a72f91a3513d5dbfe67e5cca Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 14 Feb 2020 23:57:22 +0100 -Subject: [PATCH 088/124] wireguard: send: account for mtu=0 devices +Subject: [PATCH 088/146] wireguard: send: account for mtu=0 devices commit 175f1ca9a9ed8689d2028da1a7c624bb4fb4ff7e upstream. @@ -60864,7 +60864,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c -index 43db442b13730..cdc96968b0f4b 100644 +index 43db442b1373..cdc96968b0f4 100644 --- a/drivers/net/wireguard/device.c +++ b/drivers/net/wireguard/device.c @@ -258,6 +258,8 @@ static void wg_setup(struct net_device *dev) @@ -60889,7 +60889,7 @@ index 43db442b13730..cdc96968b0f4b 100644 SET_NETDEV_DEVTYPE(dev, &device_type); diff --git a/drivers/net/wireguard/send.c b/drivers/net/wireguard/send.c -index c132605634460..7348c10cbae3d 100644 +index c13260563446..7348c10cbae3 100644 --- a/drivers/net/wireguard/send.c +++ b/drivers/net/wireguard/send.c @@ -143,16 +143,22 @@ static void keep_key_fresh(struct wg_peer *peer) @@ -60924,10 +60924,10 @@ index c132605634460..7348c10cbae3d 100644 2.18.4 -From b36598dacf234f86db04159062b3c2ca7bfe0064 Mon Sep 17 00:00:00 2001 +From b54973b23f586219a575416c7630e8912a825389 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 14 Feb 2020 23:57:23 +0100 -Subject: [PATCH 089/124] wireguard: socket: remove extra call to +Subject: [PATCH 089/146] wireguard: socket: remove extra call to synchronize_net commit 1fbc33b0a7feb6ca72bf7dc8a05d81485ee8ee2e upstream. @@ -60948,7 +60948,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 deletion(-) diff --git a/drivers/net/wireguard/socket.c b/drivers/net/wireguard/socket.c -index 262f3b5c819d5..b0d6541582d31 100644 +index 262f3b5c819d..b0d6541582d3 100644 --- a/drivers/net/wireguard/socket.c +++ b/drivers/net/wireguard/socket.c @@ -432,7 +432,6 @@ void wg_socket_reinit(struct wg_device *wg, struct sock *new4, @@ -60963,10 +60963,10 @@ index 262f3b5c819d5..b0d6541582d31 100644 2.18.4 -From f8faaa48a28d93ede6a6a3c45e87ae52f4048e4c Mon Sep 17 00:00:00 2001 +From 19775bfe3f4a36e08784966bf01d7313a17ecfc2 Mon Sep 17 00:00:00 2001 From: YueHaibing Date: Wed, 18 Mar 2020 18:30:43 -0600 -Subject: [PATCH 090/124] wireguard: selftests: remove duplicated include +Subject: [PATCH 090/146] wireguard: selftests: remove duplicated include commit 166391159c5deb84795d2ff46e95f276177fa5fb upstream. @@ -60982,7 +60982,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/wireguard/qemu/init.c b/tools/testing/selftests/wireguard/qemu/init.c -index 90bc9813cadcd..c9698120ac9d8 100644 +index 90bc9813cadc..c9698120ac9d 100644 --- a/tools/testing/selftests/wireguard/qemu/init.c +++ b/tools/testing/selftests/wireguard/qemu/init.c @@ -13,7 +13,6 @@ @@ -60997,10 +60997,10 @@ index 90bc9813cadcd..c9698120ac9d8 100644 2.18.4 -From 4d4c041de7586df2bf093545fb580b6451b077d4 Mon Sep 17 00:00:00 2001 +From 36d0bdd697643dadee5af609dac7699d46820332 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 18 Mar 2020 18:30:45 -0600 -Subject: [PATCH 091/124] wireguard: queueing: account for skb->protocol==0 +Subject: [PATCH 091/146] wireguard: queueing: account for skb->protocol==0 commit a5588604af448664e796daf3c1d5a4523c60667b upstream. @@ -61043,7 +61043,7 @@ Signed-off-by: Jason A. Donenfeld 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c -index cdc96968b0f4b..3ac3f8570ca1b 100644 +index cdc96968b0f4..3ac3f8570ca1 100644 --- a/drivers/net/wireguard/device.c +++ b/drivers/net/wireguard/device.c @@ -122,7 +122,7 @@ static netdev_tx_t wg_xmit(struct sk_buff *skb, struct net_device *dev) @@ -61056,7 +61056,7 @@ index cdc96968b0f4b..3ac3f8570ca1b 100644 net_dbg_ratelimited("%s: Invalid IP packet\n", dev->name); goto err; diff --git a/drivers/net/wireguard/queueing.h b/drivers/net/wireguard/queueing.h -index e62c714a548ee..3432232afe061 100644 +index e62c714a548e..3432232afe06 100644 --- a/drivers/net/wireguard/queueing.h +++ b/drivers/net/wireguard/queueing.h @@ -66,7 +66,7 @@ struct packet_cb { @@ -61082,7 +61082,7 @@ index e62c714a548ee..3432232afe061 100644 { skb_scrub_packet(skb, true); diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c -index 4a153894cee25..243ed7172dd27 100644 +index 4a153894cee2..243ed7172dd2 100644 --- a/drivers/net/wireguard/receive.c +++ b/drivers/net/wireguard/receive.c @@ -56,7 +56,7 @@ static int prepare_skb_header(struct sk_buff *skb, struct wg_device *wg) @@ -61107,10 +61107,10 @@ index 4a153894cee25..243ed7172dd27 100644 2.18.4 -From db9c9dd5a6d4104ee525eea52b0f51a9729398df Mon Sep 17 00:00:00 2001 +From 692964621a68b7e843070f6aeb3d438a8ac09860 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 18 Mar 2020 18:30:46 -0600 -Subject: [PATCH 092/124] wireguard: receive: remove dead code from default +Subject: [PATCH 092/146] wireguard: receive: remove dead code from default packet type case commit 2b8765c52db24c0fbcc81bac9b5e8390f2c7d3c8 upstream. @@ -61131,7 +61131,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c -index 243ed7172dd27..da3b782ab7d31 100644 +index 243ed7172dd2..da3b782ab7d3 100644 --- a/drivers/net/wireguard/receive.c +++ b/drivers/net/wireguard/receive.c @@ -587,8 +587,7 @@ void wg_packet_receive(struct wg_device *wg, struct sk_buff *skb) @@ -61148,10 +61148,10 @@ index 243ed7172dd27..da3b782ab7d31 100644 2.18.4 -From 0da5b8c1525e4fbf15cd78fa171d73161f7c9ab1 Mon Sep 17 00:00:00 2001 +From f2de11af793fd258048c1aacae79b161667adea5 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 18 Mar 2020 18:30:47 -0600 -Subject: [PATCH 093/124] wireguard: noise: error out precomputed DH during +Subject: [PATCH 093/146] wireguard: noise: error out precomputed DH during handshake rather than config commit 11a7686aa99c7fe4b3f80f6dcccd54129817984d upstream. @@ -61181,7 +61181,7 @@ Signed-off-by: Jason A. Donenfeld 5 files changed, 49 insertions(+), 48 deletions(-) diff --git a/drivers/net/wireguard/netlink.c b/drivers/net/wireguard/netlink.c -index 45a631e79d7ab..ab6cbe95a6527 100644 +index 45a631e79d7a..ab6cbe95a652 100644 --- a/drivers/net/wireguard/netlink.c +++ b/drivers/net/wireguard/netlink.c @@ -417,11 +417,7 @@ static int set_peer(struct wg_device *wg, struct nlattr **attrs) @@ -61207,7 +61207,7 @@ index 45a631e79d7ab..ab6cbe95a6527 100644 } wg_cookie_checker_precompute_device_keys(&wg->cookie_checker); diff --git a/drivers/net/wireguard/noise.c b/drivers/net/wireguard/noise.c -index 919d9d866446a..708dc61c974f7 100644 +index 919d9d866446..708dc61c974f 100644 --- a/drivers/net/wireguard/noise.c +++ b/drivers/net/wireguard/noise.c @@ -44,32 +44,23 @@ void __init wg_noise_init(void) @@ -61309,7 +61309,7 @@ index 919d9d866446a..708dc61c974f7 100644 /* {t} */ if (!message_decrypt(t, src->encrypted_timestamp, diff --git a/drivers/net/wireguard/noise.h b/drivers/net/wireguard/noise.h -index 138a07bb817ce..f532d59d3f19a 100644 +index 138a07bb817c..f532d59d3f19 100644 --- a/drivers/net/wireguard/noise.h +++ b/drivers/net/wireguard/noise.h @@ -94,11 +94,11 @@ struct noise_handshake { @@ -61339,7 +61339,7 @@ index 138a07bb817ce..f532d59d3f19a 100644 bool wg_noise_handshake_create_initiation(struct message_handshake_initiation *dst, diff --git a/drivers/net/wireguard/peer.c b/drivers/net/wireguard/peer.c -index 071eedf33f5aa..1d634bd3038f0 100644 +index 071eedf33f5a..1d634bd3038f 100644 --- a/drivers/net/wireguard/peer.c +++ b/drivers/net/wireguard/peer.c @@ -34,11 +34,8 @@ struct wg_peer *wg_peer_create(struct wg_device *wg, @@ -61357,7 +61357,7 @@ index 071eedf33f5aa..1d634bd3038f0 100644 goto err_1; if (wg_packet_queue_init(&peer->tx_queue, wg_packet_tx_worker, false, diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh -index 138d46b3f3306..936e1ca9410ec 100755 +index 138d46b3f330..936e1ca9410e 100755 --- a/tools/testing/selftests/wireguard/netns.sh +++ b/tools/testing/selftests/wireguard/netns.sh @@ -527,11 +527,16 @@ n0 wg set wg0 peer "$pub2" allowed-ips 0.0.0.0/0 @@ -61386,10 +61386,10 @@ index 138d46b3f3306..936e1ca9410ec 100755 2.18.4 -From 263d41df64cf57a71456e3e75916ce73f8f4561b Mon Sep 17 00:00:00 2001 +From 0d673aee53a99ddbe2613a21c1e65afbfe70167a Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Wed, 29 Apr 2020 14:59:20 -0600 -Subject: [PATCH 094/124] wireguard: send: remove errant newline from +Subject: [PATCH 094/146] wireguard: send: remove errant newline from packet_encrypt_worker commit d6833e42786e050e7522d6a91a9361e54085897d upstream. @@ -61406,7 +61406,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 deletion(-) diff --git a/drivers/net/wireguard/send.c b/drivers/net/wireguard/send.c -index 7348c10cbae3d..3e030d614df5f 100644 +index 7348c10cbae3..3e030d614df5 100644 --- a/drivers/net/wireguard/send.c +++ b/drivers/net/wireguard/send.c @@ -304,7 +304,6 @@ void wg_packet_encrypt_worker(struct work_struct *work) @@ -61421,10 +61421,10 @@ index 7348c10cbae3d..3e030d614df5f 100644 2.18.4 -From fc4615677434ed6c18f3340258512a1f7ea62a0c Mon Sep 17 00:00:00 2001 +From 8b549ac90e24c6fa3cff380f8e9bdd8c9201084c Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 29 Apr 2020 14:59:21 -0600 -Subject: [PATCH 095/124] wireguard: queueing: cleanup ptr_ring in error path +Subject: [PATCH 095/146] wireguard: queueing: cleanup ptr_ring in error path of packet_queue_init commit 130c58606171326c81841a49cc913cd354113dd9 upstream. @@ -61443,7 +61443,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireguard/queueing.c b/drivers/net/wireguard/queueing.c -index 5c964fcb994ec..71b8e80b58e12 100644 +index 5c964fcb994e..71b8e80b58e1 100644 --- a/drivers/net/wireguard/queueing.c +++ b/drivers/net/wireguard/queueing.c @@ -35,8 +35,10 @@ int wg_packet_queue_init(struct crypt_queue *queue, work_func_t function, @@ -61462,10 +61462,10 @@ index 5c964fcb994ec..71b8e80b58e12 100644 2.18.4 -From 15d509fd1173d5101becbf6654a8a188492a7e09 Mon Sep 17 00:00:00 2001 +From 97745881b6edfd4abb24e9962e4f4e32fda3c5b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= Date: Wed, 29 Apr 2020 14:59:22 -0600 -Subject: [PATCH 096/124] wireguard: receive: use tunnel helpers for +Subject: [PATCH 096/146] wireguard: receive: use tunnel helpers for decapsulating ECN markings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -61495,7 +61495,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c -index da3b782ab7d31..267f202f19314 100644 +index da3b782ab7d3..267f202f1931 100644 --- a/drivers/net/wireguard/receive.c +++ b/drivers/net/wireguard/receive.c @@ -393,13 +393,11 @@ static void wg_packet_consume_data_done(struct wg_peer *peer, @@ -61518,10 +61518,10 @@ index da3b782ab7d31..267f202f19314 100644 2.18.4 -From b85452edb946440774b25fac96dbdc7035a37494 Mon Sep 17 00:00:00 2001 +From 30f715992dfcb8e2e26109cb1b6fb023aa8a2f5a Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 6 May 2020 15:33:02 -0600 -Subject: [PATCH 097/124] wireguard: selftests: use normal kernel stack size on +Subject: [PATCH 097/146] wireguard: selftests: use normal kernel stack size on ppc64 commit a0fd7cc87a018df1a17f9d3f0bd994c1f22c6b34 upstream. @@ -61541,7 +61541,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/wireguard/qemu/arch/powerpc64le.config b/tools/testing/selftests/wireguard/qemu/arch/powerpc64le.config -index 990c510a9cfa5..f52f1e2bc7f64 100644 +index 990c510a9cfa..f52f1e2bc7f6 100644 --- a/tools/testing/selftests/wireguard/qemu/arch/powerpc64le.config +++ b/tools/testing/selftests/wireguard/qemu/arch/powerpc64le.config @@ -10,3 +10,4 @@ CONFIG_CMDLINE_BOOL=y @@ -61553,10 +61553,10 @@ index 990c510a9cfa5..f52f1e2bc7f64 100644 2.18.4 -From c293020965048a6331777fea5b46c5aa956b27a9 Mon Sep 17 00:00:00 2001 +From 21b6a9eb21ed7af7f02d28a62f720006195855d8 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 6 May 2020 15:33:03 -0600 -Subject: [PATCH 098/124] wireguard: socket: remove errant restriction on +Subject: [PATCH 098/146] wireguard: socket: remove errant restriction on looping to self commit b673e24aad36981f327a6570412ffa7754de8911 upstream. @@ -61590,7 +61590,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireguard/socket.c b/drivers/net/wireguard/socket.c -index b0d6541582d31..f9018027fc133 100644 +index b0d6541582d3..f9018027fc13 100644 --- a/drivers/net/wireguard/socket.c +++ b/drivers/net/wireguard/socket.c @@ -76,12 +76,6 @@ static int send4(struct wg_device *wg, struct sk_buff *skb, @@ -61620,7 +61620,7 @@ index b0d6541582d31..f9018027fc133 100644 if (cache) dst_cache_set_ip6(cache, dst, &fl.saddr); diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh -index 936e1ca9410ec..17a1f53ceba01 100755 +index 936e1ca9410e..17a1f53ceba0 100755 --- a/tools/testing/selftests/wireguard/netns.sh +++ b/tools/testing/selftests/wireguard/netns.sh @@ -48,8 +48,11 @@ cleanup() { @@ -61723,10 +61723,10 @@ index 936e1ca9410ec..17a1f53ceba01 100755 2.18.4 -From e97fec897d66616d772d8943aab2250efe6b3d2e Mon Sep 17 00:00:00 2001 +From 0745d93390250d0b2300917dfe5c5c07c398d18d Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 6 May 2020 15:33:04 -0600 -Subject: [PATCH 099/124] wireguard: send/receive: cond_resched() when +Subject: [PATCH 099/146] wireguard: send/receive: cond_resched() when processing worker ringbuffers commit 4005f5c3c9d006157ba716594e0d70c88a235c5e upstream. @@ -61751,7 +61751,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 6 insertions(+) diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c -index 267f202f19314..2566e13a292de 100644 +index 267f202f1931..2566e13a292d 100644 --- a/drivers/net/wireguard/receive.c +++ b/drivers/net/wireguard/receive.c @@ -516,6 +516,8 @@ void wg_packet_decrypt_worker(struct work_struct *work) @@ -61764,7 +61764,7 @@ index 267f202f19314..2566e13a292de 100644 } diff --git a/drivers/net/wireguard/send.c b/drivers/net/wireguard/send.c -index 3e030d614df5f..dc3079e17c7fc 100644 +index 3e030d614df5..dc3079e17c7f 100644 --- a/drivers/net/wireguard/send.c +++ b/drivers/net/wireguard/send.c @@ -281,6 +281,8 @@ void wg_packet_tx_worker(struct work_struct *work) @@ -61789,10 +61789,10 @@ index 3e030d614df5f..dc3079e17c7fc 100644 2.18.4 -From 4c198489509519c8882c0e6f4f0e00b7cd9c89cb Mon Sep 17 00:00:00 2001 +From b1e166603525ebbe98cdda4123168084c9c8056a Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 6 May 2020 15:33:05 -0600 -Subject: [PATCH 100/124] wireguard: selftests: initalize ipv6 members to NULL +Subject: [PATCH 100/146] wireguard: selftests: initalize ipv6 members to NULL to squelch clang warning commit 4fed818ef54b08d4b29200e416cce65546ad5312 upstream. @@ -61827,7 +61827,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireguard/selftest/ratelimiter.c b/drivers/net/wireguard/selftest/ratelimiter.c -index bcd6462e45401..007cd4457c5f6 100644 +index bcd6462e4540..007cd4457c5f 100644 --- a/drivers/net/wireguard/selftest/ratelimiter.c +++ b/drivers/net/wireguard/selftest/ratelimiter.c @@ -120,9 +120,9 @@ bool __init wg_ratelimiter_selftest(void) @@ -61846,10 +61846,10 @@ index bcd6462e45401..007cd4457c5f6 100644 2.18.4 -From 411743d6edf826122de2ee4b9351fd336c4b30e8 Mon Sep 17 00:00:00 2001 +From 386aec0aee37daccc14c883920ac9b44b1379059 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 6 May 2020 15:33:06 -0600 -Subject: [PATCH 101/124] wireguard: send/receive: use explicit unlikely branch +Subject: [PATCH 101/146] wireguard: send/receive: use explicit unlikely branch instead of implicit coalescing commit 243f2148937adc72bcaaa590d482d599c936efde upstream. @@ -61876,7 +61876,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c -index 2566e13a292de..3bb5b9ae7cd15 100644 +index 2566e13a292d..3bb5b9ae7cd1 100644 --- a/drivers/net/wireguard/receive.c +++ b/drivers/net/wireguard/receive.c @@ -226,21 +226,20 @@ void wg_packet_handshake_receive_worker(struct work_struct *work) @@ -61908,7 +61908,7 @@ index 2566e13a292de..3bb5b9ae7cd15 100644 wg_packet_send_queued_handshake_initiation(peer, false); } diff --git a/drivers/net/wireguard/send.c b/drivers/net/wireguard/send.c -index dc3079e17c7fc..6687db6998035 100644 +index dc3079e17c7f..6687db699803 100644 --- a/drivers/net/wireguard/send.c +++ b/drivers/net/wireguard/send.c @@ -124,20 +124,17 @@ void wg_packet_send_handshake_cookie(struct wg_device *wg, @@ -61942,10 +61942,10 @@ index dc3079e17c7fc..6687db6998035 100644 2.18.4 -From da23a9d541678b0070011db76eeb5719e3c9629e Mon Sep 17 00:00:00 2001 +From f72e12e8b10e088f955215601f3cf670c6a07456 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 19 May 2020 22:49:27 -0600 -Subject: [PATCH 102/124] wireguard: selftests: use newer iproute2 for gcc-10 +Subject: [PATCH 102/146] wireguard: selftests: use newer iproute2 for gcc-10 commit ee3c1aa3f34b7842c1557cfe5d8c3f7b8c692de8 upstream. @@ -61963,7 +61963,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/wireguard/qemu/Makefile b/tools/testing/selftests/wireguard/qemu/Makefile -index 28d477683e8ab..2dab4f57516dc 100644 +index 28d477683e8a..2dab4f57516d 100644 --- a/tools/testing/selftests/wireguard/qemu/Makefile +++ b/tools/testing/selftests/wireguard/qemu/Makefile @@ -44,7 +44,7 @@ endef @@ -61979,10 +61979,10 @@ index 28d477683e8ab..2dab4f57516dc 100644 2.18.4 -From 0b4c25a6078fefb236ff7f1bb00f8b0964ef80f8 Mon Sep 17 00:00:00 2001 +From 76f29a285a615c813815858f6d0997a609e869a6 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 19 May 2020 22:49:28 -0600 -Subject: [PATCH 103/124] wireguard: noise: read preshared key while taking +Subject: [PATCH 103/146] wireguard: noise: read preshared key while taking lock commit bc67d371256f5c47d824e2eec51e46c8d62d022e upstream. @@ -62006,7 +62006,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireguard/noise.c b/drivers/net/wireguard/noise.c -index 708dc61c974f7..07eb438a6deee 100644 +index 708dc61c974f..07eb438a6dee 100644 --- a/drivers/net/wireguard/noise.c +++ b/drivers/net/wireguard/noise.c @@ -715,6 +715,7 @@ wg_noise_handshake_consume_response(struct message_handshake_response *src, @@ -62047,10 +62047,10 @@ index 708dc61c974f7..07eb438a6deee 100644 2.18.4 -From 927d2a806c92e276c7fe83b8b0a5dd1e8e89c2a0 Mon Sep 17 00:00:00 2001 +From 67c881d3618f6f086da98ba6560a1f564ea130a6 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 19 May 2020 22:49:29 -0600 -Subject: [PATCH 104/124] wireguard: queueing: preserve flow hash across packet +Subject: [PATCH 104/146] wireguard: queueing: preserve flow hash across packet scrubbing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -62095,7 +62095,7 @@ Signed-off-by: Jason A. Donenfeld 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireguard/messages.h b/drivers/net/wireguard/messages.h -index b8a7b9ce32ba7..208da72673fc0 100644 +index b8a7b9ce32ba..208da72673fc 100644 --- a/drivers/net/wireguard/messages.h +++ b/drivers/net/wireguard/messages.h @@ -32,7 +32,7 @@ enum cookie_values { @@ -62108,7 +62108,7 @@ index b8a7b9ce32ba7..208da72673fc0 100644 COUNTER_WINDOW_SIZE = COUNTER_BITS_TOTAL - COUNTER_REDUNDANT_BITS }; diff --git a/drivers/net/wireguard/queueing.h b/drivers/net/wireguard/queueing.h -index 3432232afe061..c58df439dbbe0 100644 +index 3432232afe06..c58df439dbbe 100644 --- a/drivers/net/wireguard/queueing.h +++ b/drivers/net/wireguard/queueing.h @@ -87,12 +87,20 @@ static inline bool wg_check_packet_protocol(struct sk_buff *skb) @@ -62134,7 +62134,7 @@ index 3432232afe061..c58df439dbbe0 100644 skb->nohdr = 0; skb->peeked = 0; diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c -index 3bb5b9ae7cd15..d0eebd90c9d50 100644 +index 3bb5b9ae7cd1..d0eebd90c9d5 100644 --- a/drivers/net/wireguard/receive.c +++ b/drivers/net/wireguard/receive.c @@ -484,7 +484,7 @@ int wg_packet_rx_poll(struct napi_struct *napi, int budget) @@ -62147,7 +62147,7 @@ index 3bb5b9ae7cd15..d0eebd90c9d50 100644 free = false; diff --git a/drivers/net/wireguard/send.c b/drivers/net/wireguard/send.c -index 6687db6998035..2f5119ff93d8f 100644 +index 6687db699803..2f5119ff93d8 100644 --- a/drivers/net/wireguard/send.c +++ b/drivers/net/wireguard/send.c @@ -167,6 +167,11 @@ static bool encrypt_packet(struct sk_buff *skb, struct noise_keypair *keypair) @@ -62175,10 +62175,10 @@ index 6687db6998035..2f5119ff93d8f 100644 2.18.4 -From 4dba24ab2575031dd5b15dfda08481f59d18d017 Mon Sep 17 00:00:00 2001 +From c20ccce6e83b734f51937159295b81350967135c Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 19 May 2020 22:49:30 -0600 -Subject: [PATCH 105/124] wireguard: noise: separate receive counter from send +Subject: [PATCH 105/146] wireguard: noise: separate receive counter from send counter commit a9e90d9931f3a474f04bab782ccd9d77904941e9 upstream. @@ -62227,7 +62227,7 @@ Signed-off-by: Jason A. Donenfeld 5 files changed, 48 insertions(+), 53 deletions(-) diff --git a/drivers/net/wireguard/noise.c b/drivers/net/wireguard/noise.c -index 07eb438a6deee..626433690abb3 100644 +index 07eb438a6dee..626433690abb 100644 --- a/drivers/net/wireguard/noise.c +++ b/drivers/net/wireguard/noise.c @@ -104,6 +104,7 @@ static struct noise_keypair *keypair_create(struct wg_peer *peer) @@ -62268,7 +62268,7 @@ index 07eb438a6deee..626433690abb3 100644 static bool __must_check mix_dh(u8 chaining_key[NOISE_HASH_LEN], diff --git a/drivers/net/wireguard/noise.h b/drivers/net/wireguard/noise.h -index f532d59d3f19a..c527253dba80e 100644 +index f532d59d3f19..c527253dba80 100644 --- a/drivers/net/wireguard/noise.h +++ b/drivers/net/wireguard/noise.h @@ -15,18 +15,14 @@ @@ -62305,7 +62305,7 @@ index f532d59d3f19a..c527253dba80e 100644 bool i_am_the_initiator; struct kref refcount; diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c -index d0eebd90c9d50..91438144e4f7a 100644 +index d0eebd90c9d5..91438144e4f7 100644 --- a/drivers/net/wireguard/receive.c +++ b/drivers/net/wireguard/receive.c @@ -245,20 +245,20 @@ static void keep_key_fresh(struct wg_peer *peer) @@ -62423,7 +62423,7 @@ index d0eebd90c9d50..91438144e4f7a 100644 wg_queue_enqueue_per_peer_napi(skb, state); if (need_resched()) diff --git a/drivers/net/wireguard/selftest/counter.c b/drivers/net/wireguard/selftest/counter.c -index f4fbb9072ed73..ec3c156bf91ba 100644 +index f4fbb9072ed7..ec3c156bf91b 100644 --- a/drivers/net/wireguard/selftest/counter.c +++ b/drivers/net/wireguard/selftest/counter.c @@ -6,18 +6,24 @@ @@ -62465,7 +62465,7 @@ index f4fbb9072ed73..ec3c156bf91ba 100644 } #endif diff --git a/drivers/net/wireguard/send.c b/drivers/net/wireguard/send.c -index 2f5119ff93d8f..f74b9341ab0fe 100644 +index 2f5119ff93d8..f74b9341ab0f 100644 --- a/drivers/net/wireguard/send.c +++ b/drivers/net/wireguard/send.c @@ -129,7 +129,7 @@ static void keep_key_fresh(struct wg_peer *peer) @@ -62520,10 +62520,10 @@ index 2f5119ff93d8f..f74b9341ab0fe 100644 2.18.4 -From 9ea9e1d08e6533e936db42f5409dd06a39776532 Mon Sep 17 00:00:00 2001 +From 5d5ec7df6d25b3b08f402f1b4227ba897530c8fb Mon Sep 17 00:00:00 2001 From: Frank Werner-Krippendorf Date: Tue, 23 Jun 2020 03:59:44 -0600 -Subject: [PATCH 106/124] wireguard: noise: do not assign initiation time in if +Subject: [PATCH 106/146] wireguard: noise: do not assign initiation time in if condition commit 558b353c9c2a717509f291c066c6bd8f5f5e21be upstream. @@ -62541,7 +62541,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireguard/noise.c b/drivers/net/wireguard/noise.c -index 626433690abb3..201a22681945f 100644 +index 626433690abb..201a22681945 100644 --- a/drivers/net/wireguard/noise.c +++ b/drivers/net/wireguard/noise.c @@ -617,8 +617,8 @@ wg_noise_handshake_consume_initiation(struct message_handshake_initiation *src, @@ -62559,10 +62559,10 @@ index 626433690abb3..201a22681945f 100644 2.18.4 -From 1faa4948b0f226d850f1768a6d60a60d505538f0 Mon Sep 17 00:00:00 2001 +From 7b36a13fdea53174b5b8fa4fa5fca9de6ebe6115 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 23 Jun 2020 03:59:45 -0600 -Subject: [PATCH 107/124] wireguard: device: avoid circular netns references +Subject: [PATCH 107/146] wireguard: device: avoid circular netns references commit 900575aa33a3eaaef802b31de187a85c4a4b4bd0 upstream. @@ -62591,7 +62591,7 @@ Signed-off-by: Jason A. Donenfeld 5 files changed, 67 insertions(+), 46 deletions(-) diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c -index 3ac3f8570ca1b..a8f151b1b5fab 100644 +index 3ac3f8570ca1..a8f151b1b5fa 100644 --- a/drivers/net/wireguard/device.c +++ b/drivers/net/wireguard/device.c @@ -45,17 +45,18 @@ static int wg_open(struct net_device *dev) @@ -62727,7 +62727,7 @@ index 3ac3f8570ca1b..a8f151b1b5fab 100644 unregister_pm_notifier(&pm_notifier); #endif diff --git a/drivers/net/wireguard/device.h b/drivers/net/wireguard/device.h -index b15a8be9d8169..4d0144e169478 100644 +index b15a8be9d816..4d0144e16947 100644 --- a/drivers/net/wireguard/device.h +++ b/drivers/net/wireguard/device.h @@ -40,7 +40,7 @@ struct wg_device { @@ -62748,7 +62748,7 @@ index b15a8be9d8169..4d0144e169478 100644 int wg_device_init(void); diff --git a/drivers/net/wireguard/netlink.c b/drivers/net/wireguard/netlink.c -index ab6cbe95a6527..9756239416fde 100644 +index ab6cbe95a652..9756239416fd 100644 --- a/drivers/net/wireguard/netlink.c +++ b/drivers/net/wireguard/netlink.c @@ -517,11 +517,15 @@ static int wg_set_device(struct sk_buff *skb, struct genl_info *info) @@ -62773,7 +62773,7 @@ index ab6cbe95a6527..9756239416fde 100644 ++wg->device_update_gen; diff --git a/drivers/net/wireguard/socket.c b/drivers/net/wireguard/socket.c -index f9018027fc133..c33e2c81635fa 100644 +index f9018027fc13..c33e2c81635f 100644 --- a/drivers/net/wireguard/socket.c +++ b/drivers/net/wireguard/socket.c @@ -347,6 +347,7 @@ static void set_sock_opts(struct socket *sock) @@ -62840,7 +62840,7 @@ index f9018027fc133..c33e2c81635fa 100644 void wg_socket_reinit(struct wg_device *wg, struct sock *new4, diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh -index 17a1f53ceba01..d77f4829f1e07 100755 +index 17a1f53ceba0..d77f4829f1e0 100755 --- a/tools/testing/selftests/wireguard/netns.sh +++ b/tools/testing/selftests/wireguard/netns.sh @@ -587,9 +587,20 @@ ip0 link set wg0 up @@ -62869,10 +62869,10 @@ index 17a1f53ceba01..d77f4829f1e07 100755 2.18.4 -From 58866518bbb42f948f1da51cc4a0443fe84b2f3b Mon Sep 17 00:00:00 2001 +From f7d855949f96869071a7370fd92279480601a95e Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 24 Jun 2020 16:06:03 -0600 -Subject: [PATCH 108/124] wireguard: receive: account for napi_gro_receive +Subject: [PATCH 108/146] wireguard: receive: account for napi_gro_receive never returning GRO_DROP commit df08126e3833e9dca19e2407db5f5860a7c194fb upstream. @@ -62893,7 +62893,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c -index 91438144e4f7a..9b2ab6fc91cdd 100644 +index 91438144e4f7..9b2ab6fc91cd 100644 --- a/drivers/net/wireguard/receive.c +++ b/drivers/net/wireguard/receive.c @@ -414,14 +414,8 @@ static void wg_packet_consume_data_done(struct wg_peer *peer, @@ -62917,10 +62917,10 @@ index 91438144e4f7a..9b2ab6fc91cdd 100644 2.18.4 -From c5b1a54d82cc2bede70d730cf992bea39e17df77 Mon Sep 17 00:00:00 2001 +From 9fe3337b9eac9615783f4940723d4d2c2022d417 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 29 Jun 2020 19:06:18 -0600 -Subject: [PATCH 109/124] net: ip_tunnel: add header_ops for layer 3 devices +Subject: [PATCH 109/146] net: ip_tunnel: add header_ops for layer 3 devices commit 2606aff916854b61234bf85001be9777bab2d5f8 upstream. @@ -62940,7 +62940,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 21 insertions(+) diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h -index 56deb2501e962..8545fa25c7bf4 100644 +index 56deb2501e96..8545fa25c7bf 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h @@ -289,6 +289,9 @@ int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[], @@ -62954,7 +62954,7 @@ index 56deb2501e962..8545fa25c7bf4 100644 size_t (*encap_hlen)(struct ip_tunnel_encap *e); int (*build_header)(struct sk_buff *skb, struct ip_tunnel_encap *e, diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c -index 1452a97914a0d..cfe21c3ddfc24 100644 +index 1452a97914a0..cfe21c3ddfc2 100644 --- a/net/ipv4/ip_tunnel_core.c +++ b/net/ipv4/ip_tunnel_core.c @@ -446,3 +446,21 @@ void ip_tunnel_unneed_metadata(void) @@ -62983,10 +62983,10 @@ index 1452a97914a0d..cfe21c3ddfc24 100644 2.18.4 -From f0414c8f4df62e90c3b0233255881871e666883a Mon Sep 17 00:00:00 2001 +From 28c6197a22eba86ca1c15fd0d19126e75f6651ef Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 29 Jun 2020 19:06:20 -0600 -Subject: [PATCH 110/124] wireguard: implement header_ops->parse_protocol for +Subject: [PATCH 110/146] wireguard: implement header_ops->parse_protocol for AF_PACKET commit 01a4967c71c004f8ecad4ab57021348636502fa9 upstream. @@ -63011,7 +63011,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c -index a8f151b1b5fab..c9f65e96ccb04 100644 +index a8f151b1b5fa..c9f65e96ccb0 100644 --- a/drivers/net/wireguard/device.c +++ b/drivers/net/wireguard/device.c @@ -262,6 +262,7 @@ static void wg_setup(struct net_device *dev) @@ -63026,10 +63026,10 @@ index a8f151b1b5fab..c9f65e96ccb04 100644 2.18.4 -From 843c46e876e7a60f1c996cf4ca86cc9bea82d5b3 Mon Sep 17 00:00:00 2001 +From 551f20a77e0fc9c32c511140fe32f1f1454907e7 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 29 Jun 2020 19:06:21 -0600 -Subject: [PATCH 111/124] wireguard: queueing: make use of +Subject: [PATCH 111/146] wireguard: queueing: make use of ip_tunnel_parse_protocol commit 1a574074ae7d1d745c16f7710655f38a53174c27 upstream. @@ -63048,7 +63048,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/drivers/net/wireguard/queueing.h b/drivers/net/wireguard/queueing.h -index c58df439dbbe0..dfb674e030764 100644 +index c58df439dbbe..dfb674e03076 100644 --- a/drivers/net/wireguard/queueing.h +++ b/drivers/net/wireguard/queueing.h @@ -11,6 +11,7 @@ @@ -63087,7 +63087,7 @@ index c58df439dbbe0..dfb674e030764 100644 } diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c -index 9b2ab6fc91cdd..2c9551ea6dc73 100644 +index 9b2ab6fc91cd..2c9551ea6dc7 100644 --- a/drivers/net/wireguard/receive.c +++ b/drivers/net/wireguard/receive.c @@ -387,7 +387,7 @@ static void wg_packet_consume_data_done(struct wg_peer *peer, @@ -63103,10 +63103,10 @@ index 9b2ab6fc91cdd..2c9551ea6dc73 100644 2.18.4 -From dbd95b2ce81cd5b358ab33c156f6b57f5bb02ba8 Mon Sep 17 00:00:00 2001 +From b3fa4237288687a17e904913dc1967e56ddfe193 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 18 Aug 2020 10:17:31 +0200 -Subject: [PATCH 112/124] netlink: consistently use NLA_POLICY_EXACT_LEN() +Subject: [PATCH 112/146] netlink: consistently use NLA_POLICY_EXACT_LEN() commit 8140860c817f3e9f78bcd1e420b9777ddcbaa629 upstream. @@ -63124,7 +63124,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireguard/netlink.c b/drivers/net/wireguard/netlink.c -index 9756239416fde..2a14f564033a4 100644 +index 9756239416fd..2a14f564033a 100644 --- a/drivers/net/wireguard/netlink.c +++ b/drivers/net/wireguard/netlink.c @@ -22,8 +22,8 @@ static struct genl_family genl_family; @@ -63158,10 +63158,10 @@ index 9756239416fde..2a14f564033a4 100644 2.18.4 -From 210db96a332445b6831498b4f43ba1b2b1dd3667 Mon Sep 17 00:00:00 2001 +From 5ddb31c95167b2e86379316b3c37ff8518edb1e6 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 18 Aug 2020 10:17:32 +0200 -Subject: [PATCH 113/124] netlink: consistently use NLA_POLICY_MIN_LEN() +Subject: [PATCH 113/146] netlink: consistently use NLA_POLICY_MIN_LEN() commit bc0435855041d7fff0b83dd992fc4be34aa11afb upstream. @@ -63178,7 +63178,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireguard/netlink.c b/drivers/net/wireguard/netlink.c -index 2a14f564033a4..1c69eb8735d53 100644 +index 2a14f564033a..1c69eb8735d5 100644 --- a/drivers/net/wireguard/netlink.c +++ b/drivers/net/wireguard/netlink.c @@ -34,7 +34,7 @@ static const struct nla_policy peer_policy[WGPEER_A_MAX + 1] = { @@ -63203,10 +63203,10 @@ index 2a14f564033a4..1c69eb8735d53 100644 2.18.4 -From 301c5d69a417d6a8482e771bb2cfb56a7997003b Mon Sep 17 00:00:00 2001 +From 87d08e004ce39b2e7a01070f05e813365449d2a0 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 9 Sep 2020 13:58:14 +0200 -Subject: [PATCH 114/124] wireguard: noise: take lock when removing handshake +Subject: [PATCH 114/146] wireguard: noise: take lock when removing handshake entry from table commit 9179ba31367bcf481c3c79b5f028c94faad9f30a upstream. @@ -63312,7 +63312,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/wireguard/noise.c b/drivers/net/wireguard/noise.c -index 201a22681945f..27cb5045bed2d 100644 +index 201a22681945..27cb5045bed2 100644 --- a/drivers/net/wireguard/noise.c +++ b/drivers/net/wireguard/noise.c @@ -87,15 +87,12 @@ static void handshake_zero(struct noise_handshake *handshake) @@ -63336,10 +63336,10 @@ index 201a22681945f..27cb5045bed2d 100644 2.18.4 -From 9ffb33ae39c34bca04c8f517a19f4453de856bab Mon Sep 17 00:00:00 2001 +From e1da0d723a656a03b5e73b539143731774580cf2 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 9 Sep 2020 13:58:15 +0200 -Subject: [PATCH 115/124] wireguard: peerlookup: take lock before checking hash +Subject: [PATCH 115/146] wireguard: peerlookup: take lock before checking hash in replace operation commit 6147f7b1e90ff09bd52afc8b9206a7fcd133daf7 upstream. @@ -63370,7 +63370,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireguard/peerlookup.c b/drivers/net/wireguard/peerlookup.c -index e4deb331476b3..f2783aa7a88f1 100644 +index e4deb331476b..f2783aa7a88f 100644 --- a/drivers/net/wireguard/peerlookup.c +++ b/drivers/net/wireguard/peerlookup.c @@ -167,9 +167,13 @@ bool wg_index_hashtable_replace(struct index_hashtable *table, @@ -63404,10 +63404,10 @@ index e4deb331476b3..f2783aa7a88f1 100644 2.18.4 -From 184287bfd7d04d414bd2fa9f2247de401c50dca4 Mon Sep 17 00:00:00 2001 +From 0d789f59134ec40513f36c546378994d7956ea7e Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 29 Oct 2020 03:56:05 +0100 -Subject: [PATCH 116/124] wireguard: selftests: check that route_me_harder +Subject: [PATCH 116/146] wireguard: selftests: check that route_me_harder packets use the right sk commit af8afcf1fdd5f365f70e2386c2d8c7a1abd853d7 upstream. @@ -63429,7 +63429,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 10 insertions(+) diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh -index d77f4829f1e07..74c69b75f6f5a 100755 +index d77f4829f1e0..74c69b75f6f5 100755 --- a/tools/testing/selftests/wireguard/netns.sh +++ b/tools/testing/selftests/wireguard/netns.sh @@ -316,6 +316,14 @@ pp sleep 3 @@ -63448,7 +63448,7 @@ index d77f4829f1e07..74c69b75f6f5a 100755 n1 wg set wg0 peer "$pub3" allowed-ips 192.168.242.2/32 endpoint 192.168.241.2:5 ip1 addr add 192.168.242.1/24 dev wg0 diff --git a/tools/testing/selftests/wireguard/qemu/kernel.config b/tools/testing/selftests/wireguard/qemu/kernel.config -index af9323a0b6e09..9864d106e8189 100644 +index af9323a0b6e0..9864d106e818 100644 --- a/tools/testing/selftests/wireguard/qemu/kernel.config +++ b/tools/testing/selftests/wireguard/qemu/kernel.config @@ -18,10 +18,12 @@ CONFIG_NF_NAT=y @@ -63468,10 +63468,10 @@ index af9323a0b6e09..9864d106e8189 100644 2.18.4 -From 595e6620ab913513312f8f43b6143ab18f170c79 Mon Sep 17 00:00:00 2001 +From 0cae4c4f8f79809eddae5d528ae8bcc5c571312d Mon Sep 17 00:00:00 2001 From: Antonio Quartulli Date: Mon, 22 Feb 2021 17:25:43 +0100 -Subject: [PATCH 117/124] wireguard: avoid double unlikely() notation when +Subject: [PATCH 117/146] wireguard: avoid double unlikely() notation when using IS_ERR() commit 30ac4e2f54ec067b7b9ca0db27e75681581378d6 upstream. @@ -63493,7 +63493,7 @@ Signed-off-by: Jason A. Donenfeld 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c -index c9f65e96ccb04..46ecec72f2143 100644 +index c9f65e96ccb0..46ecec72f214 100644 --- a/drivers/net/wireguard/device.c +++ b/drivers/net/wireguard/device.c @@ -157,7 +157,7 @@ static netdev_tx_t wg_xmit(struct sk_buff *skb, struct net_device *dev) @@ -63506,7 +63506,7 @@ index c9f65e96ccb04..46ecec72f2143 100644 goto err_peer; } diff --git a/drivers/net/wireguard/socket.c b/drivers/net/wireguard/socket.c -index c33e2c81635fa..e9c35130846c7 100644 +index c33e2c81635f..e9c35130846c 100644 --- a/drivers/net/wireguard/socket.c +++ b/drivers/net/wireguard/socket.c @@ -71,7 +71,7 @@ static int send4(struct wg_device *wg, struct sk_buff *skb, @@ -63531,10 +63531,10 @@ index c33e2c81635fa..e9c35130846c7 100644 2.18.4 -From 340ac0965ca42f879f6c59ad3d7e14ecdead688e Mon Sep 17 00:00:00 2001 +From 588becf8771fc06955633fd105d29bdc5c7efa3a Mon Sep 17 00:00:00 2001 From: Jann Horn Date: Mon, 22 Feb 2021 17:25:44 +0100 -Subject: [PATCH 118/124] wireguard: socket: remove bogus __be32 annotation +Subject: [PATCH 118/146] wireguard: socket: remove bogus __be32 annotation commit 7f57bd8dc22de35ddd895294aa554003e4f19a72 upstream. @@ -63564,7 +63564,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireguard/socket.c b/drivers/net/wireguard/socket.c -index e9c35130846c7..e8eceeb0b62a8 100644 +index e9c35130846c..e8eceeb0b62a 100644 --- a/drivers/net/wireguard/socket.c +++ b/drivers/net/wireguard/socket.c @@ -53,7 +53,7 @@ static int send4(struct wg_device *wg, struct sk_buff *skb, @@ -63589,10 +63589,10 @@ index e9c35130846c7..e8eceeb0b62a8 100644 2.18.4 -From 40eb448970b81d5d299331433fc1d27b09abeb95 Mon Sep 17 00:00:00 2001 +From 16920abcea5ff47bd0f69dbc0e4233006813073b Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 22 Feb 2021 17:25:45 +0100 -Subject: [PATCH 119/124] wireguard: selftests: test multiple parallel streams +Subject: [PATCH 119/146] wireguard: selftests: test multiple parallel streams commit d5a49aa6c3e264a93a7d08485d66e346be0969dd upstream. @@ -63611,7 +63611,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh -index 74c69b75f6f5a..7ed7cd95e58fe 100755 +index 74c69b75f6f5..7ed7cd95e58f 100755 --- a/tools/testing/selftests/wireguard/netns.sh +++ b/tools/testing/selftests/wireguard/netns.sh @@ -39,7 +39,7 @@ ip0() { pretty 0 "ip $*"; ip -n $netns0 "$@"; } @@ -63647,10 +63647,10 @@ index 74c69b75f6f5a..7ed7cd95e58fe 100755 2.18.4 -From 1a39a55b7fd51fbedc82104881ae27c45b71721d Mon Sep 17 00:00:00 2001 +From ccd218ae7ef540b39c3fcf6871564c3a00d38fcb Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 22 Feb 2021 17:25:46 +0100 -Subject: [PATCH 120/124] wireguard: peer: put frequently used members above +Subject: [PATCH 120/146] wireguard: peer: put frequently used members above cache lines commit 5a0598695634a6bb4126818902dd9140cd9df8b6 upstream. @@ -63669,7 +63669,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireguard/peer.h b/drivers/net/wireguard/peer.h -index 23af409229972..aaff8de6e34b8 100644 +index 23af40922997..aaff8de6e34b 100644 --- a/drivers/net/wireguard/peer.h +++ b/drivers/net/wireguard/peer.h @@ -39,6 +39,7 @@ struct wg_peer { @@ -63695,10 +63695,10 @@ index 23af409229972..aaff8de6e34b8 100644 2.18.4 -From a4c1e2162a7dfdf4d44768a34d8c76ad0bf957dd Mon Sep 17 00:00:00 2001 +From c2f5b79e650d18974e96b8905dce4892d764ce40 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 22 Feb 2021 17:25:47 +0100 -Subject: [PATCH 121/124] wireguard: device: do not generate ICMP for non-IP +Subject: [PATCH 121/146] wireguard: device: do not generate ICMP for non-IP packets commit 99fff5264e7ab06f45b0ad60243475be0a8d0559 upstream. @@ -63717,7 +63717,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c -index 46ecec72f2143..5aeef63c4393d 100644 +index 46ecec72f214..5aeef63c4393 100644 --- a/drivers/net/wireguard/device.c +++ b/drivers/net/wireguard/device.c @@ -138,7 +138,7 @@ static netdev_tx_t wg_xmit(struct sk_buff *skb, struct net_device *dev) @@ -63749,10 +63749,10 @@ index 46ecec72f2143..5aeef63c4393d 100644 2.18.4 -From 6f1d61b5efc7701727d9a325317bcc345e14a8cd Mon Sep 17 00:00:00 2001 +From 978a8f1dc9eedf327f12933f219871a808824f79 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 22 Feb 2021 17:25:48 +0100 -Subject: [PATCH 122/124] wireguard: queueing: get rid of per-peer ring buffers +Subject: [PATCH 122/146] wireguard: queueing: get rid of per-peer ring buffers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -63828,7 +63828,7 @@ Signed-off-by: Jason A. Donenfeld 8 files changed, 144 insertions(+), 93 deletions(-) diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c -index 5aeef63c4393d..8c7d97f96d567 100644 +index 5aeef63c4393..8c7d97f96d56 100644 --- a/drivers/net/wireguard/device.c +++ b/drivers/net/wireguard/device.c @@ -235,8 +235,8 @@ static void wg_destruct(struct net_device *dev) @@ -63870,7 +63870,7 @@ index 5aeef63c4393d..8c7d97f96d567 100644 destroy_workqueue(wg->packet_crypt_wq); err_destroy_handshake_send: diff --git a/drivers/net/wireguard/device.h b/drivers/net/wireguard/device.h -index 4d0144e169478..854bc3d97150e 100644 +index 4d0144e16947..854bc3d97150 100644 --- a/drivers/net/wireguard/device.h +++ b/drivers/net/wireguard/device.h @@ -27,13 +27,14 @@ struct multicore_worker { @@ -63896,7 +63896,7 @@ index 4d0144e169478..854bc3d97150e 100644 struct wg_device { diff --git a/drivers/net/wireguard/peer.c b/drivers/net/wireguard/peer.c -index 1d634bd3038f0..91310cb053403 100644 +index 1d634bd3038f..91310cb05340 100644 --- a/drivers/net/wireguard/peer.c +++ b/drivers/net/wireguard/peer.c @@ -32,27 +32,22 @@ struct wg_peer *wg_peer_create(struct wg_device *wg, @@ -63958,7 +63958,7 @@ index 1d634bd3038f0..91310cb053403 100644 /* The final zeroing takes care of clearing any remaining handshake key * material and other potentially sensitive information. diff --git a/drivers/net/wireguard/peer.h b/drivers/net/wireguard/peer.h -index aaff8de6e34b8..8d53b687a1d16 100644 +index aaff8de6e34b..8d53b687a1d1 100644 --- a/drivers/net/wireguard/peer.h +++ b/drivers/net/wireguard/peer.h @@ -36,7 +36,7 @@ struct endpoint { @@ -63980,7 +63980,7 @@ index aaff8de6e34b8..8d53b687a1d16 100644 struct hlist_node pubkey_hash; u64 rx_bytes, tx_bytes; diff --git a/drivers/net/wireguard/queueing.c b/drivers/net/wireguard/queueing.c -index 71b8e80b58e12..48e7b982a3073 100644 +index 71b8e80b58e1..48e7b982a307 100644 --- a/drivers/net/wireguard/queueing.c +++ b/drivers/net/wireguard/queueing.c @@ -9,8 +9,7 @@ struct multicore_worker __percpu * @@ -64096,7 +64096,7 @@ index 71b8e80b58e12..48e7b982a3073 100644 +#undef NEXT +#undef STUB diff --git a/drivers/net/wireguard/queueing.h b/drivers/net/wireguard/queueing.h -index dfb674e030764..4ef2944a68bc9 100644 +index dfb674e03076..4ef2944a68bc 100644 --- a/drivers/net/wireguard/queueing.h +++ b/drivers/net/wireguard/queueing.h @@ -17,12 +17,13 @@ struct wg_device; @@ -64189,7 +64189,7 @@ index dfb674e030764..4ef2944a68bc9 100644 /* We take a reference, because as soon as we call atomic_set, the * peer can be freed from below us. diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c -index 2c9551ea6dc73..7dc84bcca2613 100644 +index 2c9551ea6dc7..7dc84bcca261 100644 --- a/drivers/net/wireguard/receive.c +++ b/drivers/net/wireguard/receive.c @@ -444,7 +444,6 @@ static void wg_packet_consume_data_done(struct wg_peer *peer, @@ -64240,7 +64240,7 @@ index 2c9551ea6dc73..7dc84bcca2613 100644 rcu_read_unlock_bh(); return; diff --git a/drivers/net/wireguard/send.c b/drivers/net/wireguard/send.c -index f74b9341ab0fe..5368f7c35b4bf 100644 +index f74b9341ab0f..5368f7c35b4b 100644 --- a/drivers/net/wireguard/send.c +++ b/drivers/net/wireguard/send.c @@ -239,8 +239,7 @@ void wg_packet_send_keepalive(struct wg_peer *peer) @@ -64329,10 +64329,10 @@ index f74b9341ab0fe..5368f7c35b4bf 100644 2.18.4 -From 2a5a32fa1712f51413963214ac8bf0426ce32b4c Mon Sep 17 00:00:00 2001 +From fe887e5277d20d37dc3e5b9cdcbcc233111dd3b5 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 22 Feb 2021 17:25:49 +0100 -Subject: [PATCH 123/124] wireguard: kconfig: use arm chacha even with no neon +Subject: [PATCH 123/146] wireguard: kconfig: use arm chacha even with no neon commit bce2473927af8de12ad131a743f55d69d358c0b9 upstream. @@ -64349,7 +64349,7 @@ Signed-off-by: Jason A. Donenfeld 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig -index 57f1ba924f4ec..4e09901dac5c9 100644 +index 57f1ba924f4e..4e09901dac5c 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -87,7 +87,7 @@ config WIREGUARD @@ -64365,10 +64365,10 @@ index 57f1ba924f4ec..4e09901dac5c9 100644 2.18.4 -From e2c63b986d747340fae6072915d5bc59a0111931 Mon Sep 17 00:00:00 2001 +From 4c0e1c978da13d408cfdbf414642465490f1b3f7 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Thu, 11 Mar 2021 21:50:47 -0700 -Subject: [PATCH 124/124] crypto: mips/poly1305 - enable for all MIPS +Subject: [PATCH 124/146] crypto: mips/poly1305 - enable for all MIPS processors commit 6c810cf20feef0d4338e9b424ab7f2644a8b353e upstream. @@ -64392,7 +64392,7 @@ Signed-off-by: Jason A. Donenfeld 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/mips/crypto/Makefile b/arch/mips/crypto/Makefile -index 8e1deaf00e0c0..5e4105cccf9fa 100644 +index 8e1deaf00e0c..5e4105cccf9f 100644 --- a/arch/mips/crypto/Makefile +++ b/arch/mips/crypto/Makefile @@ -12,8 +12,8 @@ AFLAGS_chacha-core.o += -O2 # needed to fill branch delay slots @@ -64407,7 +64407,7 @@ index 8e1deaf00e0c0..5e4105cccf9fa 100644 quiet_cmd_perlasm = PERLASM $@ cmd_perlasm = $(PERL) $(<) $(perlasm-flavour-y) $(@) diff --git a/crypto/Kconfig b/crypto/Kconfig -index fd5a8724ed385..dff09d1ccf84a 100644 +index eaf21eaca136..e44644fb16d5 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -740,7 +740,7 @@ config CRYPTO_POLY1305_X86_64 @@ -64420,7 +64420,7 @@ index fd5a8724ed385..dff09d1ccf84a 100644 config CRYPTO_MD4 diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig -index 4e09901dac5c9..575b6c28a391e 100644 +index 4e09901dac5c..575b6c28a391 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -92,7 +92,7 @@ config WIREGUARD @@ -64435,3 +64435,3432 @@ index 4e09901dac5c9..575b6c28a391e 100644 -- 2.18.4 + +From d995db1f71307b8449623949093487013c45de26 Mon Sep 17 00:00:00 2001 +From: Ilya Lipnitskiy +Date: Sat, 27 Mar 2021 19:39:43 -0700 +Subject: [PATCH 125/146] crypto: mips: add poly1305-core.S to .gitignore + +commit dc92d0df51dc61de88bf6f4884a17bf73d5c6326 upstream. + +poly1305-core.S is an auto-generated file, so it should be ignored. + +Fixes: a11d055e7a64 ("crypto: mips/poly1305 - incorporate OpenSSL/CRYPTOGAMS optimized implementation") +Signed-off-by: Ilya Lipnitskiy +Cc: Ard Biesheuvel +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Jason A. Donenfeld +--- + arch/mips/crypto/.gitignore | 2 ++ + 1 file changed, 2 insertions(+) + create mode 100644 arch/mips/crypto/.gitignore + +diff --git a/arch/mips/crypto/.gitignore b/arch/mips/crypto/.gitignore +new file mode 100644 +index 000000000000..0d47d4f21c6d +--- /dev/null ++++ b/arch/mips/crypto/.gitignore +@@ -0,0 +1,2 @@ ++# SPDX-License-Identifier: GPL-2.0-only ++poly1305-core.S +-- +2.18.4 + + +From d4b7c031be0dacf6dbef3327c9a22fd530e38172 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Mon, 22 Mar 2021 18:05:15 +0100 +Subject: [PATCH 126/146] crypto: poly1305 - fix poly1305_core_setkey() + declaration +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +commit 8d195e7a8ada68928f2aedb2c18302a4518fe68e upstream. + +gcc-11 points out a mismatch between the declaration and the definition +of poly1305_core_setkey(): + +lib/crypto/poly1305-donna32.c:13:67: error: argument 2 of type ‘const u8[16]’ {aka ‘const unsigned char[16]’} with mismatched bound [-Werror=array-parameter=] + 13 | void poly1305_core_setkey(struct poly1305_core_key *key, const u8 raw_key[16]) + | ~~~~~~~~~^~~~~~~~~~~ +In file included from lib/crypto/poly1305-donna32.c:11: +include/crypto/internal/poly1305.h:21:68: note: previously declared as ‘const u8 *’ {aka ‘const unsigned char *’} + 21 | void poly1305_core_setkey(struct poly1305_core_key *key, const u8 *raw_key); + +This is harmless in principle, as the calling conventions are the same, +but the more specific prototype allows better type checking in the +caller. + +Change the declaration to match the actual function definition. +The poly1305_simd_init() is a bit suspicious here, as it previously +had a 32-byte argument type, but looks like it needs to take the +16-byte POLY1305_BLOCK_SIZE array instead. + +Fixes: 1c08a104360f ("crypto: poly1305 - add new 32 and 64-bit generic versions") +Signed-off-by: Arnd Bergmann +Reviewed-by: Ard Biesheuvel +Reviewed-by: Eric Biggers +Signed-off-by: Herbert Xu +Signed-off-by: Jason A. Donenfeld +--- + arch/arm/crypto/poly1305-glue.c | 2 +- + arch/arm64/crypto/poly1305-glue.c | 2 +- + arch/mips/crypto/poly1305-glue.c | 2 +- + arch/x86/crypto/poly1305_glue.c | 6 +++--- + include/crypto/internal/poly1305.h | 3 ++- + include/crypto/poly1305.h | 6 ++++-- + lib/crypto/poly1305-donna32.c | 3 ++- + lib/crypto/poly1305-donna64.c | 3 ++- + lib/crypto/poly1305.c | 3 ++- + 9 files changed, 18 insertions(+), 12 deletions(-) + +diff --git a/arch/arm/crypto/poly1305-glue.c b/arch/arm/crypto/poly1305-glue.c +index 3023c1acfa19..c31bd8f7c092 100644 +--- a/arch/arm/crypto/poly1305-glue.c ++++ b/arch/arm/crypto/poly1305-glue.c +@@ -29,7 +29,7 @@ void __weak poly1305_blocks_neon(void *state, const u8 *src, u32 len, u32 hibit) + + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_neon); + +-void poly1305_init_arch(struct poly1305_desc_ctx *dctx, const u8 *key) ++void poly1305_init_arch(struct poly1305_desc_ctx *dctx, const u8 key[POLY1305_KEY_SIZE]) + { + poly1305_init_arm(&dctx->h, key); + dctx->s[0] = get_unaligned_le32(key + 16); +diff --git a/arch/arm64/crypto/poly1305-glue.c b/arch/arm64/crypto/poly1305-glue.c +index f33ada70c4ed..01e22fe40823 100644 +--- a/arch/arm64/crypto/poly1305-glue.c ++++ b/arch/arm64/crypto/poly1305-glue.c +@@ -25,7 +25,7 @@ asmlinkage void poly1305_emit(void *state, u8 *digest, const u32 *nonce); + + static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_neon); + +-void poly1305_init_arch(struct poly1305_desc_ctx *dctx, const u8 *key) ++void poly1305_init_arch(struct poly1305_desc_ctx *dctx, const u8 key[POLY1305_KEY_SIZE]) + { + poly1305_init_arm64(&dctx->h, key); + dctx->s[0] = get_unaligned_le32(key + 16); +diff --git a/arch/mips/crypto/poly1305-glue.c b/arch/mips/crypto/poly1305-glue.c +index fc881b46d911..bc6110fb98e0 100644 +--- a/arch/mips/crypto/poly1305-glue.c ++++ b/arch/mips/crypto/poly1305-glue.c +@@ -17,7 +17,7 @@ asmlinkage void poly1305_init_mips(void *state, const u8 *key); + asmlinkage void poly1305_blocks_mips(void *state, const u8 *src, u32 len, u32 hibit); + asmlinkage void poly1305_emit_mips(void *state, u8 *digest, const u32 *nonce); + +-void poly1305_init_arch(struct poly1305_desc_ctx *dctx, const u8 *key) ++void poly1305_init_arch(struct poly1305_desc_ctx *dctx, const u8 key[POLY1305_KEY_SIZE]) + { + poly1305_init_mips(&dctx->h, key); + dctx->s[0] = get_unaligned_le32(key + 16); +diff --git a/arch/x86/crypto/poly1305_glue.c b/arch/x86/crypto/poly1305_glue.c +index b69e362730d0..e6ecff3f5c94 100644 +--- a/arch/x86/crypto/poly1305_glue.c ++++ b/arch/x86/crypto/poly1305_glue.c +@@ -15,7 +15,7 @@ + #include + + asmlinkage void poly1305_init_x86_64(void *ctx, +- const u8 key[POLY1305_KEY_SIZE]); ++ const u8 key[POLY1305_BLOCK_SIZE]); + asmlinkage void poly1305_blocks_x86_64(void *ctx, const u8 *inp, + const size_t len, const u32 padbit); + asmlinkage void poly1305_emit_x86_64(void *ctx, u8 mac[POLY1305_DIGEST_SIZE], +@@ -80,7 +80,7 @@ static void convert_to_base2_64(void *ctx) + state->is_base2_26 = 0; + } + +-static void poly1305_simd_init(void *ctx, const u8 key[POLY1305_KEY_SIZE]) ++static void poly1305_simd_init(void *ctx, const u8 key[POLY1305_BLOCK_SIZE]) + { + poly1305_init_x86_64(ctx, key); + } +@@ -128,7 +128,7 @@ static void poly1305_simd_emit(void *ctx, u8 mac[POLY1305_DIGEST_SIZE], + poly1305_emit_avx(ctx, mac, nonce); + } + +-void poly1305_init_arch(struct poly1305_desc_ctx *dctx, const u8 *key) ++void poly1305_init_arch(struct poly1305_desc_ctx *dctx, const u8 key[POLY1305_KEY_SIZE]) + { + poly1305_simd_init(&dctx->h, key); + dctx->s[0] = get_unaligned_le32(&key[16]); +diff --git a/include/crypto/internal/poly1305.h b/include/crypto/internal/poly1305.h +index 064e52ca5248..196aa769f296 100644 +--- a/include/crypto/internal/poly1305.h ++++ b/include/crypto/internal/poly1305.h +@@ -18,7 +18,8 @@ + * only the ε-almost-∆-universal hash function (not the full MAC) is computed. + */ + +-void poly1305_core_setkey(struct poly1305_core_key *key, const u8 *raw_key); ++void poly1305_core_setkey(struct poly1305_core_key *key, ++ const u8 raw_key[POLY1305_BLOCK_SIZE]); + static inline void poly1305_core_init(struct poly1305_state *state) + { + *state = (struct poly1305_state){}; +diff --git a/include/crypto/poly1305.h b/include/crypto/poly1305.h +index f1f67fc749cf..090692ec3bc7 100644 +--- a/include/crypto/poly1305.h ++++ b/include/crypto/poly1305.h +@@ -58,8 +58,10 @@ struct poly1305_desc_ctx { + }; + }; + +-void poly1305_init_arch(struct poly1305_desc_ctx *desc, const u8 *key); +-void poly1305_init_generic(struct poly1305_desc_ctx *desc, const u8 *key); ++void poly1305_init_arch(struct poly1305_desc_ctx *desc, ++ const u8 key[POLY1305_KEY_SIZE]); ++void poly1305_init_generic(struct poly1305_desc_ctx *desc, ++ const u8 key[POLY1305_KEY_SIZE]); + + static inline void poly1305_init(struct poly1305_desc_ctx *desc, const u8 *key) + { +diff --git a/lib/crypto/poly1305-donna32.c b/lib/crypto/poly1305-donna32.c +index 3cc77d94390b..7fb71845cc84 100644 +--- a/lib/crypto/poly1305-donna32.c ++++ b/lib/crypto/poly1305-donna32.c +@@ -10,7 +10,8 @@ + #include + #include + +-void poly1305_core_setkey(struct poly1305_core_key *key, const u8 raw_key[16]) ++void poly1305_core_setkey(struct poly1305_core_key *key, ++ const u8 raw_key[POLY1305_BLOCK_SIZE]) + { + /* r &= 0xffffffc0ffffffc0ffffffc0fffffff */ + key->key.r[0] = (get_unaligned_le32(&raw_key[0])) & 0x3ffffff; +diff --git a/lib/crypto/poly1305-donna64.c b/lib/crypto/poly1305-donna64.c +index 6ae181bb4345..d34cf4053668 100644 +--- a/lib/crypto/poly1305-donna64.c ++++ b/lib/crypto/poly1305-donna64.c +@@ -12,7 +12,8 @@ + + typedef __uint128_t u128; + +-void poly1305_core_setkey(struct poly1305_core_key *key, const u8 raw_key[16]) ++void poly1305_core_setkey(struct poly1305_core_key *key, ++ const u8 raw_key[POLY1305_BLOCK_SIZE]) + { + u64 t0, t1; + +diff --git a/lib/crypto/poly1305.c b/lib/crypto/poly1305.c +index 9d2d14df0fee..26d87fc3823e 100644 +--- a/lib/crypto/poly1305.c ++++ b/lib/crypto/poly1305.c +@@ -12,7 +12,8 @@ + #include + #include + +-void poly1305_init_generic(struct poly1305_desc_ctx *desc, const u8 *key) ++void poly1305_init_generic(struct poly1305_desc_ctx *desc, ++ const u8 key[POLY1305_KEY_SIZE]) + { + poly1305_core_setkey(&desc->core_r, key); + desc->s[0] = get_unaligned_le32(key + 16); +-- +2.18.4 + + +From 4dbbfdf86aa57ea47eb5e761456bf3c965337f7a Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Fri, 4 Jun 2021 17:17:30 +0200 +Subject: [PATCH 127/146] wireguard: selftests: remove old conntrack kconfig + value + +commit acf2492b51c9a3c4dfb947f4d3477a86d315150f upstream. + +On recent kernels, this config symbol is no longer used. + +Reported-by: Rui Salvaterra +Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") +Cc: stable@vger.kernel.org +Signed-off-by: Jason A. Donenfeld +Signed-off-by: David S. Miller +Signed-off-by: Jason A. Donenfeld +--- + tools/testing/selftests/wireguard/qemu/kernel.config | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/tools/testing/selftests/wireguard/qemu/kernel.config b/tools/testing/selftests/wireguard/qemu/kernel.config +index 9864d106e818..9e413e0ffa3f 100644 +--- a/tools/testing/selftests/wireguard/qemu/kernel.config ++++ b/tools/testing/selftests/wireguard/qemu/kernel.config +@@ -19,7 +19,6 @@ CONFIG_NETFILTER_XTABLES=y + CONFIG_NETFILTER_XT_NAT=y + CONFIG_NETFILTER_XT_MATCH_LENGTH=y + CONFIG_NETFILTER_XT_MARK=y +-CONFIG_NF_CONNTRACK_IPV4=y + CONFIG_NF_NAT_IPV4=y + CONFIG_IP_NF_IPTABLES=y + CONFIG_IP_NF_FILTER=y +-- +2.18.4 + + +From 8d1c54551317144a62ba2d3d7445d8f0ff45379c Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Fri, 4 Jun 2021 17:17:31 +0200 +Subject: [PATCH 128/146] wireguard: selftests: make sure rp_filter is disabled + on vethc + +commit f8873d11d4121aad35024f9379e431e0c83abead upstream. + +Some distros may enable strict rp_filter by default, which will prevent +vethc from receiving the packets with an unrouteable reverse path address. + +Reported-by: Hangbin Liu +Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") +Cc: stable@vger.kernel.org +Signed-off-by: Jason A. Donenfeld +Signed-off-by: David S. Miller +Signed-off-by: Jason A. Donenfeld +--- + tools/testing/selftests/wireguard/netns.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh +index 7ed7cd95e58f..ebc4ee0fe179 100755 +--- a/tools/testing/selftests/wireguard/netns.sh ++++ b/tools/testing/selftests/wireguard/netns.sh +@@ -363,6 +363,7 @@ ip1 -6 rule add table main suppress_prefixlength 0 + ip1 -4 route add default dev wg0 table 51820 + ip1 -4 rule add not fwmark 51820 table 51820 + ip1 -4 rule add table main suppress_prefixlength 0 ++n1 bash -c 'printf 0 > /proc/sys/net/ipv4/conf/vethc/rp_filter' + # Flood the pings instead of sending just one, to trigger routing table reference counting bugs. + n1 ping -W 1 -c 100 -f 192.168.99.7 + n1 ping -W 1 -c 100 -f abab::1111 +-- +2.18.4 + + +From 5ae879da48ce0aed183ecb92b99fd10432f25119 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Fri, 4 Jun 2021 17:17:32 +0200 +Subject: [PATCH 129/146] wireguard: do not use -O3 + +commit cc5060ca0285efe2728bced399a1955a7ce808b2 upstream. + +Apparently, various versions of gcc have O3-related miscompiles. Looking +at the difference between -O2 and -O3 for gcc 11 doesn't indicate +miscompiles, but the difference also doesn't seem so significant for +performance that it's worth risking. + +Link: https://lore.kernel.org/lkml/CAHk-=wjuoGyxDhAF8SsrTkN0-YfCx7E6jUN3ikC_tn2AKWTTsA@mail.gmail.com/ +Link: https://lore.kernel.org/lkml/CAHmME9otB5Wwxp7H8bR_i2uH2esEMvoBMC8uEXBMH9p0q1s6Bw@mail.gmail.com/ +Reported-by: Linus Torvalds +Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") +Cc: stable@vger.kernel.org +Signed-off-by: Jason A. Donenfeld +Signed-off-by: David S. Miller +Signed-off-by: Jason A. Donenfeld +--- + drivers/net/wireguard/Makefile | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/net/wireguard/Makefile b/drivers/net/wireguard/Makefile +index fc52b2cb500b..dbe1f8514efc 100644 +--- a/drivers/net/wireguard/Makefile ++++ b/drivers/net/wireguard/Makefile +@@ -1,5 +1,4 @@ +-ccflags-y := -O3 +-ccflags-y += -D'pr_fmt(fmt)=KBUILD_MODNAME ": " fmt' ++ccflags-y := -D'pr_fmt(fmt)=KBUILD_MODNAME ": " fmt' + ccflags-$(CONFIG_WIREGUARD_DEBUG) += -DDEBUG + wireguard-y := main.o + wireguard-y += noise.o +-- +2.18.4 + + +From 9ab4758c256ec09fe70f4e9ad1367c730837e91c Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Fri, 4 Jun 2021 17:17:33 +0200 +Subject: [PATCH 130/146] wireguard: use synchronize_net rather than + synchronize_rcu + +commit 24b70eeeb4f46c09487f8155239ebfb1f875774a upstream. + +Many of the synchronization points are sometimes called under the rtnl +lock, which means we should use synchronize_net rather than +synchronize_rcu. Under the hood, this expands to using the expedited +flavor of function in the event that rtnl is held, in order to not stall +other concurrent changes. + +This fixes some very, very long delays when removing multiple peers at +once, which would cause some operations to take several minutes. + +Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") +Cc: stable@vger.kernel.org +Signed-off-by: Jason A. Donenfeld +Signed-off-by: David S. Miller +Signed-off-by: Jason A. Donenfeld +--- + drivers/net/wireguard/peer.c | 6 +++--- + drivers/net/wireguard/socket.c | 2 +- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/wireguard/peer.c b/drivers/net/wireguard/peer.c +index 91310cb05340..64462930dc68 100644 +--- a/drivers/net/wireguard/peer.c ++++ b/drivers/net/wireguard/peer.c +@@ -88,7 +88,7 @@ static void peer_make_dead(struct wg_peer *peer) + /* Mark as dead, so that we don't allow jumping contexts after. */ + WRITE_ONCE(peer->is_dead, true); + +- /* The caller must now synchronize_rcu() for this to take effect. */ ++ /* The caller must now synchronize_net() for this to take effect. */ + } + + static void peer_remove_after_dead(struct wg_peer *peer) +@@ -160,7 +160,7 @@ void wg_peer_remove(struct wg_peer *peer) + lockdep_assert_held(&peer->device->device_update_lock); + + peer_make_dead(peer); +- synchronize_rcu(); ++ synchronize_net(); + peer_remove_after_dead(peer); + } + +@@ -178,7 +178,7 @@ void wg_peer_remove_all(struct wg_device *wg) + peer_make_dead(peer); + list_add_tail(&peer->peer_list, &dead_peers); + } +- synchronize_rcu(); ++ synchronize_net(); + list_for_each_entry_safe(peer, temp, &dead_peers, peer_list) + peer_remove_after_dead(peer); + } +diff --git a/drivers/net/wireguard/socket.c b/drivers/net/wireguard/socket.c +index e8eceeb0b62a..04739763e303 100644 +--- a/drivers/net/wireguard/socket.c ++++ b/drivers/net/wireguard/socket.c +@@ -430,7 +430,7 @@ void wg_socket_reinit(struct wg_device *wg, struct sock *new4, + if (new4) + wg->incoming_port = ntohs(inet_sk(new4)->inet_sport); + mutex_unlock(&wg->socket_update_lock); +- synchronize_rcu(); ++ synchronize_net(); + sock_free(old4); + sock_free(old6); + } +-- +2.18.4 + + +From 7f8cfc96f85c5c9a84ecabe0f4d5a0bad95f8773 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Fri, 4 Jun 2021 17:17:34 +0200 +Subject: [PATCH 131/146] wireguard: peer: allocate in kmem_cache + +commit a4e9f8e3287c9eb6bf70df982870980dd3341863 upstream. + +With deployments having upwards of 600k peers now, this somewhat heavy +structure could benefit from more fine-grained allocations. +Specifically, instead of using a 2048-byte slab for a 1544-byte object, +we can now use 1544-byte objects directly, thus saving almost 25% +per-peer, or with 600k peers, that's a savings of 303 MiB. This also +makes wireguard's memory usage more transparent in tools like slabtop +and /proc/slabinfo. + +Fixes: 8b5553ace83c ("wireguard: queueing: get rid of per-peer ring buffers") +Suggested-by: Arnd Bergmann +Suggested-by: Matthew Wilcox +Cc: stable@vger.kernel.org +Signed-off-by: Jason A. Donenfeld +Signed-off-by: David S. Miller +Signed-off-by: Jason A. Donenfeld +--- + drivers/net/wireguard/main.c | 7 +++++++ + drivers/net/wireguard/peer.c | 21 +++++++++++++++++---- + drivers/net/wireguard/peer.h | 3 +++ + 3 files changed, 27 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/wireguard/main.c b/drivers/net/wireguard/main.c +index 7a7d5f1a80fc..0a3ebfdac794 100644 +--- a/drivers/net/wireguard/main.c ++++ b/drivers/net/wireguard/main.c +@@ -28,6 +28,10 @@ static int __init mod_init(void) + #endif + wg_noise_init(); + ++ ret = wg_peer_init(); ++ if (ret < 0) ++ goto err_peer; ++ + ret = wg_device_init(); + if (ret < 0) + goto err_device; +@@ -44,6 +48,8 @@ static int __init mod_init(void) + err_netlink: + wg_device_uninit(); + err_device: ++ wg_peer_uninit(); ++err_peer: + return ret; + } + +@@ -51,6 +57,7 @@ static void __exit mod_exit(void) + { + wg_genetlink_uninit(); + wg_device_uninit(); ++ wg_peer_uninit(); + } + + module_init(mod_init); +diff --git a/drivers/net/wireguard/peer.c b/drivers/net/wireguard/peer.c +index 64462930dc68..1acd00ab2fbc 100644 +--- a/drivers/net/wireguard/peer.c ++++ b/drivers/net/wireguard/peer.c +@@ -15,6 +15,7 @@ + #include + #include + ++static struct kmem_cache *peer_cache; + static atomic64_t peer_counter = ATOMIC64_INIT(0); + + struct wg_peer *wg_peer_create(struct wg_device *wg, +@@ -29,10 +30,10 @@ struct wg_peer *wg_peer_create(struct wg_device *wg, + if (wg->num_peers >= MAX_PEERS_PER_DEVICE) + return ERR_PTR(ret); + +- peer = kzalloc(sizeof(*peer), GFP_KERNEL); ++ peer = kmem_cache_zalloc(peer_cache, GFP_KERNEL); + if (unlikely(!peer)) + return ERR_PTR(ret); +- if (dst_cache_init(&peer->endpoint_cache, GFP_KERNEL)) ++ if (unlikely(dst_cache_init(&peer->endpoint_cache, GFP_KERNEL))) + goto err; + + peer->device = wg; +@@ -64,7 +65,7 @@ struct wg_peer *wg_peer_create(struct wg_device *wg, + return peer; + + err: +- kfree(peer); ++ kmem_cache_free(peer_cache, peer); + return ERR_PTR(ret); + } + +@@ -193,7 +194,8 @@ static void rcu_release(struct rcu_head *rcu) + /* The final zeroing takes care of clearing any remaining handshake key + * material and other potentially sensitive information. + */ +- kzfree(peer); ++ memzero_explicit(peer, sizeof(*peer)); ++ kmem_cache_free(peer_cache, peer); + } + + static void kref_release(struct kref *refcount) +@@ -225,3 +227,14 @@ void wg_peer_put(struct wg_peer *peer) + return; + kref_put(&peer->refcount, kref_release); + } ++ ++int __init wg_peer_init(void) ++{ ++ peer_cache = KMEM_CACHE(wg_peer, 0); ++ return peer_cache ? 0 : -ENOMEM; ++} ++ ++void wg_peer_uninit(void) ++{ ++ kmem_cache_destroy(peer_cache); ++} +diff --git a/drivers/net/wireguard/peer.h b/drivers/net/wireguard/peer.h +index 8d53b687a1d1..76e4d3128ad4 100644 +--- a/drivers/net/wireguard/peer.h ++++ b/drivers/net/wireguard/peer.h +@@ -80,4 +80,7 @@ void wg_peer_put(struct wg_peer *peer); + void wg_peer_remove(struct wg_peer *peer); + void wg_peer_remove_all(struct wg_device *wg); + ++int wg_peer_init(void); ++void wg_peer_uninit(void); ++ + #endif /* _WG_PEER_H */ +-- +2.18.4 + + +From 89c3bc30d7ec5fcedba9a5183a92a0d521873cb0 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Fri, 4 Jun 2021 17:17:35 +0200 +Subject: [PATCH 132/146] wireguard: allowedips: initialize list head in + selftest + +commit 46cfe8eee285cde465b420637507884551f5d7ca upstream. + +The randomized trie tests weren't initializing the dummy peer list head, +resulting in a NULL pointer dereference when used. Fix this by +initializing it in the randomized trie test, just like we do for the +static unit test. + +While we're at it, all of the other strings like this have the word +"self-test", so add it to the missing place here. + +Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") +Cc: stable@vger.kernel.org +Signed-off-by: Jason A. Donenfeld +Signed-off-by: David S. Miller +Signed-off-by: Jason A. Donenfeld +--- + drivers/net/wireguard/selftest/allowedips.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireguard/selftest/allowedips.c b/drivers/net/wireguard/selftest/allowedips.c +index 846db14cb046..0d2a43a2d400 100644 +--- a/drivers/net/wireguard/selftest/allowedips.c ++++ b/drivers/net/wireguard/selftest/allowedips.c +@@ -296,6 +296,7 @@ static __init bool randomized_test(void) + goto free; + } + kref_init(&peers[i]->refcount); ++ INIT_LIST_HEAD(&peers[i]->allowedips_list); + } + + mutex_lock(&mutex); +@@ -333,7 +334,7 @@ static __init bool randomized_test(void) + if (wg_allowedips_insert_v4(&t, + (struct in_addr *)mutated, + cidr, peer, &mutex) < 0) { +- pr_err("allowedips random malloc: FAIL\n"); ++ pr_err("allowedips random self-test malloc: FAIL\n"); + goto free_locked; + } + if (horrible_allowedips_insert_v4(&h, +-- +2.18.4 + + +From 4c5f58b2f387130c463601d6f1d2d5a3440c67dd Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Fri, 4 Jun 2021 17:17:36 +0200 +Subject: [PATCH 133/146] wireguard: allowedips: remove nodes in O(1) + +commit f634f418c227c912e7ea95a3299efdc9b10e4022 upstream. + +Previously, deleting peers would require traversing the entire trie in +order to rebalance nodes and safely free them. This meant that removing +1000 peers from a trie with a half million nodes would take an extremely +long time, during which we're holding the rtnl lock. Large-scale users +were reporting 200ms latencies added to the networking stack as a whole +every time their userspace software would queue up significant removals. +That's a serious situation. + +This commit fixes that by maintaining a double pointer to the parent's +bit pointer for each node, and then using the already existing node list +belonging to each peer to go directly to the node, fix up its pointers, +and free it with RCU. This means removal is O(1) instead of O(n), and we +don't use gobs of stack. + +The removal algorithm has the same downside as the code that it fixes: +it won't collapse needlessly long runs of fillers. We can enhance that +in the future if it ever becomes a problem. This commit documents that +limitation with a TODO comment in code, a small but meaningful +improvement over the prior situation. + +Currently the biggest flaw, which the next commit addresses, is that +because this increases the node size on 64-bit machines from 60 bytes to +68 bytes. 60 rounds up to 64, but 68 rounds up to 128. So we wind up +using twice as much memory per node, because of power-of-two +allocations, which is a big bummer. We'll need to figure something out +there. + +Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") +Cc: stable@vger.kernel.org +Signed-off-by: Jason A. Donenfeld +Signed-off-by: David S. Miller +Signed-off-by: Jason A. Donenfeld +--- + drivers/net/wireguard/allowedips.c | 132 ++++++++++++----------------- + drivers/net/wireguard/allowedips.h | 9 +- + 2 files changed, 57 insertions(+), 84 deletions(-) + +diff --git a/drivers/net/wireguard/allowedips.c b/drivers/net/wireguard/allowedips.c +index 3725e9cd85f4..2785cfd3a221 100644 +--- a/drivers/net/wireguard/allowedips.c ++++ b/drivers/net/wireguard/allowedips.c +@@ -66,60 +66,6 @@ static void root_remove_peer_lists(struct allowedips_node *root) + } + } + +-static void walk_remove_by_peer(struct allowedips_node __rcu **top, +- struct wg_peer *peer, struct mutex *lock) +-{ +-#define REF(p) rcu_access_pointer(p) +-#define DEREF(p) rcu_dereference_protected(*(p), lockdep_is_held(lock)) +-#define PUSH(p) ({ \ +- WARN_ON(IS_ENABLED(DEBUG) && len >= 128); \ +- stack[len++] = p; \ +- }) +- +- struct allowedips_node __rcu **stack[128], **nptr; +- struct allowedips_node *node, *prev; +- unsigned int len; +- +- if (unlikely(!peer || !REF(*top))) +- return; +- +- for (prev = NULL, len = 0, PUSH(top); len > 0; prev = node) { +- nptr = stack[len - 1]; +- node = DEREF(nptr); +- if (!node) { +- --len; +- continue; +- } +- if (!prev || REF(prev->bit[0]) == node || +- REF(prev->bit[1]) == node) { +- if (REF(node->bit[0])) +- PUSH(&node->bit[0]); +- else if (REF(node->bit[1])) +- PUSH(&node->bit[1]); +- } else if (REF(node->bit[0]) == prev) { +- if (REF(node->bit[1])) +- PUSH(&node->bit[1]); +- } else { +- if (rcu_dereference_protected(node->peer, +- lockdep_is_held(lock)) == peer) { +- RCU_INIT_POINTER(node->peer, NULL); +- list_del_init(&node->peer_list); +- if (!node->bit[0] || !node->bit[1]) { +- rcu_assign_pointer(*nptr, DEREF( +- &node->bit[!REF(node->bit[0])])); +- kfree_rcu(node, rcu); +- node = DEREF(nptr); +- } +- } +- --len; +- } +- } +- +-#undef REF +-#undef DEREF +-#undef PUSH +-} +- + static unsigned int fls128(u64 a, u64 b) + { + return a ? fls64(a) + 64U : fls64(b); +@@ -224,6 +170,7 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, + RCU_INIT_POINTER(node->peer, peer); + list_add_tail(&node->peer_list, &peer->allowedips_list); + copy_and_assign_cidr(node, key, cidr, bits); ++ rcu_assign_pointer(node->parent_bit, trie); + rcu_assign_pointer(*trie, node); + return 0; + } +@@ -243,9 +190,9 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, + if (!node) { + down = rcu_dereference_protected(*trie, lockdep_is_held(lock)); + } else { +- down = rcu_dereference_protected(CHOOSE_NODE(node, key), +- lockdep_is_held(lock)); ++ down = rcu_dereference_protected(CHOOSE_NODE(node, key), lockdep_is_held(lock)); + if (!down) { ++ rcu_assign_pointer(newnode->parent_bit, &CHOOSE_NODE(node, key)); + rcu_assign_pointer(CHOOSE_NODE(node, key), newnode); + return 0; + } +@@ -254,29 +201,37 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, + parent = node; + + if (newnode->cidr == cidr) { ++ rcu_assign_pointer(down->parent_bit, &CHOOSE_NODE(newnode, down->bits)); + rcu_assign_pointer(CHOOSE_NODE(newnode, down->bits), down); +- if (!parent) ++ if (!parent) { ++ rcu_assign_pointer(newnode->parent_bit, trie); + rcu_assign_pointer(*trie, newnode); +- else +- rcu_assign_pointer(CHOOSE_NODE(parent, newnode->bits), +- newnode); +- } else { +- node = kzalloc(sizeof(*node), GFP_KERNEL); +- if (unlikely(!node)) { +- list_del(&newnode->peer_list); +- kfree(newnode); +- return -ENOMEM; ++ } else { ++ rcu_assign_pointer(newnode->parent_bit, &CHOOSE_NODE(parent, newnode->bits)); ++ rcu_assign_pointer(CHOOSE_NODE(parent, newnode->bits), newnode); + } +- INIT_LIST_HEAD(&node->peer_list); +- copy_and_assign_cidr(node, newnode->bits, cidr, bits); +- +- rcu_assign_pointer(CHOOSE_NODE(node, down->bits), down); +- rcu_assign_pointer(CHOOSE_NODE(node, newnode->bits), newnode); +- if (!parent) +- rcu_assign_pointer(*trie, node); +- else +- rcu_assign_pointer(CHOOSE_NODE(parent, node->bits), +- node); ++ return 0; ++ } ++ ++ node = kzalloc(sizeof(*node), GFP_KERNEL); ++ if (unlikely(!node)) { ++ list_del(&newnode->peer_list); ++ kfree(newnode); ++ return -ENOMEM; ++ } ++ INIT_LIST_HEAD(&node->peer_list); ++ copy_and_assign_cidr(node, newnode->bits, cidr, bits); ++ ++ rcu_assign_pointer(down->parent_bit, &CHOOSE_NODE(node, down->bits)); ++ rcu_assign_pointer(CHOOSE_NODE(node, down->bits), down); ++ rcu_assign_pointer(newnode->parent_bit, &CHOOSE_NODE(node, newnode->bits)); ++ rcu_assign_pointer(CHOOSE_NODE(node, newnode->bits), newnode); ++ if (!parent) { ++ rcu_assign_pointer(node->parent_bit, trie); ++ rcu_assign_pointer(*trie, node); ++ } else { ++ rcu_assign_pointer(node->parent_bit, &CHOOSE_NODE(parent, node->bits)); ++ rcu_assign_pointer(CHOOSE_NODE(parent, node->bits), node); + } + return 0; + } +@@ -335,9 +290,30 @@ int wg_allowedips_insert_v6(struct allowedips *table, const struct in6_addr *ip, + void wg_allowedips_remove_by_peer(struct allowedips *table, + struct wg_peer *peer, struct mutex *lock) + { ++ struct allowedips_node *node, *child, *tmp; ++ ++ if (list_empty(&peer->allowedips_list)) ++ return; + ++table->seq; +- walk_remove_by_peer(&table->root4, peer, lock); +- walk_remove_by_peer(&table->root6, peer, lock); ++ list_for_each_entry_safe(node, tmp, &peer->allowedips_list, peer_list) { ++ list_del_init(&node->peer_list); ++ RCU_INIT_POINTER(node->peer, NULL); ++ if (node->bit[0] && node->bit[1]) ++ continue; ++ child = rcu_dereference_protected( ++ node->bit[!rcu_access_pointer(node->bit[0])], ++ lockdep_is_held(lock)); ++ if (child) ++ child->parent_bit = node->parent_bit; ++ *rcu_dereference_protected(node->parent_bit, lockdep_is_held(lock)) = child; ++ kfree_rcu(node, rcu); ++ ++ /* TODO: Note that we currently don't walk up and down in order to ++ * free any potential filler nodes. This means that this function ++ * doesn't free up as much as it could, which could be revisited ++ * at some point. ++ */ ++ } + } + + int wg_allowedips_read_node(struct allowedips_node *node, u8 ip[16], u8 *cidr) +diff --git a/drivers/net/wireguard/allowedips.h b/drivers/net/wireguard/allowedips.h +index e5c83cafcef4..f08f552e6852 100644 +--- a/drivers/net/wireguard/allowedips.h ++++ b/drivers/net/wireguard/allowedips.h +@@ -15,14 +15,11 @@ struct wg_peer; + struct allowedips_node { + struct wg_peer __rcu *peer; + struct allowedips_node __rcu *bit[2]; +- /* While it may seem scandalous that we waste space for v4, +- * we're alloc'ing to the nearest power of 2 anyway, so this +- * doesn't actually make a difference. +- */ +- u8 bits[16] __aligned(__alignof(u64)); + u8 cidr, bit_at_a, bit_at_b, bitlen; ++ u8 bits[16] __aligned(__alignof(u64)); + +- /* Keep rarely used list at bottom to be beyond cache line. */ ++ /* Keep rarely used members at bottom to be beyond cache line. */ ++ struct allowedips_node *__rcu *parent_bit; /* XXX: this puts us at 68->128 bytes instead of 60->64 bytes!! */ + union { + struct list_head peer_list; + struct rcu_head rcu; +-- +2.18.4 + + +From 46b91781e91d1df1e905c4204da0204e1fe7cb3a Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Fri, 4 Jun 2021 17:17:37 +0200 +Subject: [PATCH 134/146] wireguard: allowedips: allocate nodes in kmem_cache + +commit dc680de28ca849dfe589dc15ac56d22505f0ef11 upstream. + +The previous commit moved from O(n) to O(1) for removal, but in the +process introduced an additional pointer member to a struct that +increased the size from 60 to 68 bytes, putting nodes in the 128-byte +slab. With deployed systems having as many as 2 million nodes, this +represents a significant doubling in memory usage (128 MiB -> 256 MiB). +Fix this by using our own kmem_cache, that's sized exactly right. This +also makes wireguard's memory usage more transparent in tools like +slabtop and /proc/slabinfo. + +Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") +Suggested-by: Arnd Bergmann +Suggested-by: Matthew Wilcox +Cc: stable@vger.kernel.org +Signed-off-by: Jason A. Donenfeld +Signed-off-by: David S. Miller +Signed-off-by: Jason A. Donenfeld +--- + drivers/net/wireguard/allowedips.c | 31 ++++++++++++++++++++++++------ + drivers/net/wireguard/allowedips.h | 5 ++++- + drivers/net/wireguard/main.c | 10 +++++++++- + 3 files changed, 38 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/wireguard/allowedips.c b/drivers/net/wireguard/allowedips.c +index 2785cfd3a221..c540dce8d224 100644 +--- a/drivers/net/wireguard/allowedips.c ++++ b/drivers/net/wireguard/allowedips.c +@@ -6,6 +6,8 @@ + #include "allowedips.h" + #include "peer.h" + ++static struct kmem_cache *node_cache; ++ + static void swap_endian(u8 *dst, const u8 *src, u8 bits) + { + if (bits == 32) { +@@ -40,6 +42,11 @@ static void push_rcu(struct allowedips_node **stack, + } + } + ++static void node_free_rcu(struct rcu_head *rcu) ++{ ++ kmem_cache_free(node_cache, container_of(rcu, struct allowedips_node, rcu)); ++} ++ + static void root_free_rcu(struct rcu_head *rcu) + { + struct allowedips_node *node, *stack[128] = { +@@ -49,7 +56,7 @@ static void root_free_rcu(struct rcu_head *rcu) + while (len > 0 && (node = stack[--len])) { + push_rcu(stack, node->bit[0], &len); + push_rcu(stack, node->bit[1], &len); +- kfree(node); ++ kmem_cache_free(node_cache, node); + } + } + +@@ -164,7 +171,7 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, + return -EINVAL; + + if (!rcu_access_pointer(*trie)) { +- node = kzalloc(sizeof(*node), GFP_KERNEL); ++ node = kmem_cache_zalloc(node_cache, GFP_KERNEL); + if (unlikely(!node)) + return -ENOMEM; + RCU_INIT_POINTER(node->peer, peer); +@@ -180,7 +187,7 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, + return 0; + } + +- newnode = kzalloc(sizeof(*newnode), GFP_KERNEL); ++ newnode = kmem_cache_zalloc(node_cache, GFP_KERNEL); + if (unlikely(!newnode)) + return -ENOMEM; + RCU_INIT_POINTER(newnode->peer, peer); +@@ -213,10 +220,10 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, + return 0; + } + +- node = kzalloc(sizeof(*node), GFP_KERNEL); ++ node = kmem_cache_zalloc(node_cache, GFP_KERNEL); + if (unlikely(!node)) { + list_del(&newnode->peer_list); +- kfree(newnode); ++ kmem_cache_free(node_cache, newnode); + return -ENOMEM; + } + INIT_LIST_HEAD(&node->peer_list); +@@ -306,7 +313,7 @@ void wg_allowedips_remove_by_peer(struct allowedips *table, + if (child) + child->parent_bit = node->parent_bit; + *rcu_dereference_protected(node->parent_bit, lockdep_is_held(lock)) = child; +- kfree_rcu(node, rcu); ++ call_rcu(&node->rcu, node_free_rcu); + + /* TODO: Note that we currently don't walk up and down in order to + * free any potential filler nodes. This means that this function +@@ -350,4 +357,16 @@ struct wg_peer *wg_allowedips_lookup_src(struct allowedips *table, + return NULL; + } + ++int __init wg_allowedips_slab_init(void) ++{ ++ node_cache = KMEM_CACHE(allowedips_node, 0); ++ return node_cache ? 0 : -ENOMEM; ++} ++ ++void wg_allowedips_slab_uninit(void) ++{ ++ rcu_barrier(); ++ kmem_cache_destroy(node_cache); ++} ++ + #include "selftest/allowedips.c" +diff --git a/drivers/net/wireguard/allowedips.h b/drivers/net/wireguard/allowedips.h +index f08f552e6852..32d611aaf3cc 100644 +--- a/drivers/net/wireguard/allowedips.h ++++ b/drivers/net/wireguard/allowedips.h +@@ -19,7 +19,7 @@ struct allowedips_node { + u8 bits[16] __aligned(__alignof(u64)); + + /* Keep rarely used members at bottom to be beyond cache line. */ +- struct allowedips_node *__rcu *parent_bit; /* XXX: this puts us at 68->128 bytes instead of 60->64 bytes!! */ ++ struct allowedips_node *__rcu *parent_bit; + union { + struct list_head peer_list; + struct rcu_head rcu; +@@ -53,4 +53,7 @@ struct wg_peer *wg_allowedips_lookup_src(struct allowedips *table, + bool wg_allowedips_selftest(void); + #endif + ++int wg_allowedips_slab_init(void); ++void wg_allowedips_slab_uninit(void); ++ + #endif /* _WG_ALLOWEDIPS_H */ +diff --git a/drivers/net/wireguard/main.c b/drivers/net/wireguard/main.c +index 0a3ebfdac794..75dbe77b0b4b 100644 +--- a/drivers/net/wireguard/main.c ++++ b/drivers/net/wireguard/main.c +@@ -21,10 +21,15 @@ static int __init mod_init(void) + { + int ret; + ++ ret = wg_allowedips_slab_init(); ++ if (ret < 0) ++ goto err_allowedips; ++ + #ifdef DEBUG ++ ret = -ENOTRECOVERABLE; + if (!wg_allowedips_selftest() || !wg_packet_counter_selftest() || + !wg_ratelimiter_selftest()) +- return -ENOTRECOVERABLE; ++ goto err_peer; + #endif + wg_noise_init(); + +@@ -50,6 +55,8 @@ static int __init mod_init(void) + err_device: + wg_peer_uninit(); + err_peer: ++ wg_allowedips_slab_uninit(); ++err_allowedips: + return ret; + } + +@@ -58,6 +65,7 @@ static void __exit mod_exit(void) + wg_genetlink_uninit(); + wg_device_uninit(); + wg_peer_uninit(); ++ wg_allowedips_slab_uninit(); + } + + module_init(mod_init); +-- +2.18.4 + + +From b5f977573baf30e365cf7579e51e0d7c3228ff8a Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Fri, 4 Jun 2021 17:17:38 +0200 +Subject: [PATCH 135/146] wireguard: allowedips: free empty intermediate nodes + when removing single node + +commit bf7b042dc62a31f66d3a41dd4dfc7806f267b307 upstream. + +When removing single nodes, it's possible that that node's parent is an +empty intermediate node, in which case, it too should be removed. +Otherwise the trie fills up and never is fully emptied, leading to +gradual memory leaks over time for tries that are modified often. There +was originally code to do this, but was removed during refactoring in +2016 and never reworked. Now that we have proper parent pointers from +the previous commits, we can implement this properly. + +In order to reduce branching and expensive comparisons, we want to keep +the double pointer for parent assignment (which lets us easily chain up +to the root), but we still need to actually get the parent's base +address. So encode the bit number into the last two bits of the pointer, +and pack and unpack it as needed. This is a little bit clumsy but is the +fastest and less memory wasteful of the compromises. Note that we align +the root struct here to a minimum of 4, because it's embedded into a +larger struct, and we're relying on having the bottom two bits for our +flag, which would only be 16-bit aligned on m68k. + +The existing macro-based helpers were a bit unwieldy for adding the bit +packing to, so this commit replaces them with safer and clearer ordinary +functions. + +We add a test to the randomized/fuzzer part of the selftests, to free +the randomized tries by-peer, refuzz it, and repeat, until it's supposed +to be empty, and then then see if that actually resulted in the whole +thing being emptied. That combined with kmemcheck should hopefully make +sure this commit is doing what it should. Along the way this resulted in +various other cleanups of the tests and fixes for recent graphviz. + +Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") +Cc: stable@vger.kernel.org +Signed-off-by: Jason A. Donenfeld +Signed-off-by: David S. Miller +Signed-off-by: Jason A. Donenfeld +--- + drivers/net/wireguard/allowedips.c | 102 ++++++------ + drivers/net/wireguard/allowedips.h | 4 +- + drivers/net/wireguard/selftest/allowedips.c | 162 ++++++++++---------- + 3 files changed, 137 insertions(+), 131 deletions(-) + +diff --git a/drivers/net/wireguard/allowedips.c b/drivers/net/wireguard/allowedips.c +index c540dce8d224..b7197e80f226 100644 +--- a/drivers/net/wireguard/allowedips.c ++++ b/drivers/net/wireguard/allowedips.c +@@ -30,8 +30,11 @@ static void copy_and_assign_cidr(struct allowedips_node *node, const u8 *src, + node->bitlen = bits; + memcpy(node->bits, src, bits / 8U); + } +-#define CHOOSE_NODE(parent, key) \ +- parent->bit[(key[parent->bit_at_a] >> parent->bit_at_b) & 1] ++ ++static inline u8 choose(struct allowedips_node *node, const u8 *key) ++{ ++ return (key[node->bit_at_a] >> node->bit_at_b) & 1; ++} + + static void push_rcu(struct allowedips_node **stack, + struct allowedips_node __rcu *p, unsigned int *len) +@@ -112,7 +115,7 @@ static struct allowedips_node *find_node(struct allowedips_node *trie, u8 bits, + found = node; + if (node->cidr == bits) + break; +- node = rcu_dereference_bh(CHOOSE_NODE(node, key)); ++ node = rcu_dereference_bh(node->bit[choose(node, key)]); + } + return found; + } +@@ -144,8 +147,7 @@ static bool node_placement(struct allowedips_node __rcu *trie, const u8 *key, + u8 cidr, u8 bits, struct allowedips_node **rnode, + struct mutex *lock) + { +- struct allowedips_node *node = rcu_dereference_protected(trie, +- lockdep_is_held(lock)); ++ struct allowedips_node *node = rcu_dereference_protected(trie, lockdep_is_held(lock)); + struct allowedips_node *parent = NULL; + bool exact = false; + +@@ -155,13 +157,24 @@ static bool node_placement(struct allowedips_node __rcu *trie, const u8 *key, + exact = true; + break; + } +- node = rcu_dereference_protected(CHOOSE_NODE(parent, key), +- lockdep_is_held(lock)); ++ node = rcu_dereference_protected(parent->bit[choose(parent, key)], lockdep_is_held(lock)); + } + *rnode = parent; + return exact; + } + ++static inline void connect_node(struct allowedips_node **parent, u8 bit, struct allowedips_node *node) ++{ ++ node->parent_bit_packed = (unsigned long)parent | bit; ++ rcu_assign_pointer(*parent, node); ++} ++ ++static inline void choose_and_connect_node(struct allowedips_node *parent, struct allowedips_node *node) ++{ ++ u8 bit = choose(parent, node->bits); ++ connect_node(&parent->bit[bit], bit, node); ++} ++ + static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, + u8 cidr, struct wg_peer *peer, struct mutex *lock) + { +@@ -177,8 +190,7 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, + RCU_INIT_POINTER(node->peer, peer); + list_add_tail(&node->peer_list, &peer->allowedips_list); + copy_and_assign_cidr(node, key, cidr, bits); +- rcu_assign_pointer(node->parent_bit, trie); +- rcu_assign_pointer(*trie, node); ++ connect_node(trie, 2, node); + return 0; + } + if (node_placement(*trie, key, cidr, bits, &node, lock)) { +@@ -197,10 +209,10 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, + if (!node) { + down = rcu_dereference_protected(*trie, lockdep_is_held(lock)); + } else { +- down = rcu_dereference_protected(CHOOSE_NODE(node, key), lockdep_is_held(lock)); ++ const u8 bit = choose(node, key); ++ down = rcu_dereference_protected(node->bit[bit], lockdep_is_held(lock)); + if (!down) { +- rcu_assign_pointer(newnode->parent_bit, &CHOOSE_NODE(node, key)); +- rcu_assign_pointer(CHOOSE_NODE(node, key), newnode); ++ connect_node(&node->bit[bit], bit, newnode); + return 0; + } + } +@@ -208,15 +220,11 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, + parent = node; + + if (newnode->cidr == cidr) { +- rcu_assign_pointer(down->parent_bit, &CHOOSE_NODE(newnode, down->bits)); +- rcu_assign_pointer(CHOOSE_NODE(newnode, down->bits), down); +- if (!parent) { +- rcu_assign_pointer(newnode->parent_bit, trie); +- rcu_assign_pointer(*trie, newnode); +- } else { +- rcu_assign_pointer(newnode->parent_bit, &CHOOSE_NODE(parent, newnode->bits)); +- rcu_assign_pointer(CHOOSE_NODE(parent, newnode->bits), newnode); +- } ++ choose_and_connect_node(newnode, down); ++ if (!parent) ++ connect_node(trie, 2, newnode); ++ else ++ choose_and_connect_node(parent, newnode); + return 0; + } + +@@ -229,17 +237,12 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, + INIT_LIST_HEAD(&node->peer_list); + copy_and_assign_cidr(node, newnode->bits, cidr, bits); + +- rcu_assign_pointer(down->parent_bit, &CHOOSE_NODE(node, down->bits)); +- rcu_assign_pointer(CHOOSE_NODE(node, down->bits), down); +- rcu_assign_pointer(newnode->parent_bit, &CHOOSE_NODE(node, newnode->bits)); +- rcu_assign_pointer(CHOOSE_NODE(node, newnode->bits), newnode); +- if (!parent) { +- rcu_assign_pointer(node->parent_bit, trie); +- rcu_assign_pointer(*trie, node); +- } else { +- rcu_assign_pointer(node->parent_bit, &CHOOSE_NODE(parent, node->bits)); +- rcu_assign_pointer(CHOOSE_NODE(parent, node->bits), node); +- } ++ choose_and_connect_node(node, down); ++ choose_and_connect_node(node, newnode); ++ if (!parent) ++ connect_node(trie, 2, node); ++ else ++ choose_and_connect_node(parent, node); + return 0; + } + +@@ -297,7 +300,8 @@ int wg_allowedips_insert_v6(struct allowedips *table, const struct in6_addr *ip, + void wg_allowedips_remove_by_peer(struct allowedips *table, + struct wg_peer *peer, struct mutex *lock) + { +- struct allowedips_node *node, *child, *tmp; ++ struct allowedips_node *node, *child, **parent_bit, *parent, *tmp; ++ bool free_parent; + + if (list_empty(&peer->allowedips_list)) + return; +@@ -307,19 +311,29 @@ void wg_allowedips_remove_by_peer(struct allowedips *table, + RCU_INIT_POINTER(node->peer, NULL); + if (node->bit[0] && node->bit[1]) + continue; +- child = rcu_dereference_protected( +- node->bit[!rcu_access_pointer(node->bit[0])], +- lockdep_is_held(lock)); ++ child = rcu_dereference_protected(node->bit[!rcu_access_pointer(node->bit[0])], ++ lockdep_is_held(lock)); + if (child) +- child->parent_bit = node->parent_bit; +- *rcu_dereference_protected(node->parent_bit, lockdep_is_held(lock)) = child; ++ child->parent_bit_packed = node->parent_bit_packed; ++ parent_bit = (struct allowedips_node **)(node->parent_bit_packed & ~3UL); ++ *parent_bit = child; ++ parent = (void *)parent_bit - ++ offsetof(struct allowedips_node, bit[node->parent_bit_packed & 1]); ++ free_parent = !rcu_access_pointer(node->bit[0]) && ++ !rcu_access_pointer(node->bit[1]) && ++ (node->parent_bit_packed & 3) <= 1 && ++ !rcu_access_pointer(parent->peer); ++ if (free_parent) ++ child = rcu_dereference_protected( ++ parent->bit[!(node->parent_bit_packed & 1)], ++ lockdep_is_held(lock)); + call_rcu(&node->rcu, node_free_rcu); +- +- /* TODO: Note that we currently don't walk up and down in order to +- * free any potential filler nodes. This means that this function +- * doesn't free up as much as it could, which could be revisited +- * at some point. +- */ ++ if (!free_parent) ++ continue; ++ if (child) ++ child->parent_bit_packed = parent->parent_bit_packed; ++ *(struct allowedips_node **)(parent->parent_bit_packed & ~3UL) = child; ++ call_rcu(&parent->rcu, node_free_rcu); + } + } + +diff --git a/drivers/net/wireguard/allowedips.h b/drivers/net/wireguard/allowedips.h +index 32d611aaf3cc..2346c797eb4d 100644 +--- a/drivers/net/wireguard/allowedips.h ++++ b/drivers/net/wireguard/allowedips.h +@@ -19,7 +19,7 @@ struct allowedips_node { + u8 bits[16] __aligned(__alignof(u64)); + + /* Keep rarely used members at bottom to be beyond cache line. */ +- struct allowedips_node *__rcu *parent_bit; ++ unsigned long parent_bit_packed; + union { + struct list_head peer_list; + struct rcu_head rcu; +@@ -30,7 +30,7 @@ struct allowedips { + struct allowedips_node __rcu *root4; + struct allowedips_node __rcu *root6; + u64 seq; +-}; ++} __aligned(4); /* We pack the lower 2 bits of &root, but m68k only gives 16-bit alignment. */ + + void wg_allowedips_init(struct allowedips *table); + void wg_allowedips_free(struct allowedips *table, struct mutex *mutex); +diff --git a/drivers/net/wireguard/selftest/allowedips.c b/drivers/net/wireguard/selftest/allowedips.c +index 0d2a43a2d400..e173204ae7d7 100644 +--- a/drivers/net/wireguard/selftest/allowedips.c ++++ b/drivers/net/wireguard/selftest/allowedips.c +@@ -19,32 +19,22 @@ + + #include + +-static __init void swap_endian_and_apply_cidr(u8 *dst, const u8 *src, u8 bits, +- u8 cidr) +-{ +- swap_endian(dst, src, bits); +- memset(dst + (cidr + 7) / 8, 0, bits / 8 - (cidr + 7) / 8); +- if (cidr) +- dst[(cidr + 7) / 8 - 1] &= ~0U << ((8 - (cidr % 8)) % 8); +-} +- + static __init void print_node(struct allowedips_node *node, u8 bits) + { + char *fmt_connection = KERN_DEBUG "\t\"%p/%d\" -> \"%p/%d\";\n"; +- char *fmt_declaration = KERN_DEBUG +- "\t\"%p/%d\"[style=%s, color=\"#%06x\"];\n"; ++ char *fmt_declaration = KERN_DEBUG "\t\"%p/%d\"[style=%s, color=\"#%06x\"];\n"; ++ u8 ip1[16], ip2[16], cidr1, cidr2; + char *style = "dotted"; +- u8 ip1[16], ip2[16]; + u32 color = 0; + ++ if (node == NULL) ++ return; + if (bits == 32) { + fmt_connection = KERN_DEBUG "\t\"%pI4/%d\" -> \"%pI4/%d\";\n"; +- fmt_declaration = KERN_DEBUG +- "\t\"%pI4/%d\"[style=%s, color=\"#%06x\"];\n"; ++ fmt_declaration = KERN_DEBUG "\t\"%pI4/%d\"[style=%s, color=\"#%06x\"];\n"; + } else if (bits == 128) { + fmt_connection = KERN_DEBUG "\t\"%pI6/%d\" -> \"%pI6/%d\";\n"; +- fmt_declaration = KERN_DEBUG +- "\t\"%pI6/%d\"[style=%s, color=\"#%06x\"];\n"; ++ fmt_declaration = KERN_DEBUG "\t\"%pI6/%d\"[style=%s, color=\"#%06x\"];\n"; + } + if (node->peer) { + hsiphash_key_t key = { { 0 } }; +@@ -55,24 +45,20 @@ static __init void print_node(struct allowedips_node *node, u8 bits) + hsiphash_1u32(0xabad1dea, &key) % 200; + style = "bold"; + } +- swap_endian_and_apply_cidr(ip1, node->bits, bits, node->cidr); +- printk(fmt_declaration, ip1, node->cidr, style, color); ++ wg_allowedips_read_node(node, ip1, &cidr1); ++ printk(fmt_declaration, ip1, cidr1, style, color); + if (node->bit[0]) { +- swap_endian_and_apply_cidr(ip2, +- rcu_dereference_raw(node->bit[0])->bits, bits, +- node->cidr); +- printk(fmt_connection, ip1, node->cidr, ip2, +- rcu_dereference_raw(node->bit[0])->cidr); +- print_node(rcu_dereference_raw(node->bit[0]), bits); ++ wg_allowedips_read_node(rcu_dereference_raw(node->bit[0]), ip2, &cidr2); ++ printk(fmt_connection, ip1, cidr1, ip2, cidr2); + } + if (node->bit[1]) { +- swap_endian_and_apply_cidr(ip2, +- rcu_dereference_raw(node->bit[1])->bits, +- bits, node->cidr); +- printk(fmt_connection, ip1, node->cidr, ip2, +- rcu_dereference_raw(node->bit[1])->cidr); +- print_node(rcu_dereference_raw(node->bit[1]), bits); ++ wg_allowedips_read_node(rcu_dereference_raw(node->bit[1]), ip2, &cidr2); ++ printk(fmt_connection, ip1, cidr1, ip2, cidr2); + } ++ if (node->bit[0]) ++ print_node(rcu_dereference_raw(node->bit[0]), bits); ++ if (node->bit[1]) ++ print_node(rcu_dereference_raw(node->bit[1]), bits); + } + + static __init void print_tree(struct allowedips_node __rcu *top, u8 bits) +@@ -121,8 +107,8 @@ static __init inline union nf_inet_addr horrible_cidr_to_mask(u8 cidr) + { + union nf_inet_addr mask; + +- memset(&mask, 0x00, 128 / 8); +- memset(&mask, 0xff, cidr / 8); ++ memset(&mask, 0, sizeof(mask)); ++ memset(&mask.all, 0xff, cidr / 8); + if (cidr % 32) + mask.all[cidr / 32] = (__force u32)htonl( + (0xFFFFFFFFUL << (32 - (cidr % 32))) & 0xFFFFFFFFUL); +@@ -149,42 +135,36 @@ horrible_mask_self(struct horrible_allowedips_node *node) + } + + static __init inline bool +-horrible_match_v4(const struct horrible_allowedips_node *node, +- struct in_addr *ip) ++horrible_match_v4(const struct horrible_allowedips_node *node, struct in_addr *ip) + { + return (ip->s_addr & node->mask.ip) == node->ip.ip; + } + + static __init inline bool +-horrible_match_v6(const struct horrible_allowedips_node *node, +- struct in6_addr *ip) ++horrible_match_v6(const struct horrible_allowedips_node *node, struct in6_addr *ip) + { +- return (ip->in6_u.u6_addr32[0] & node->mask.ip6[0]) == +- node->ip.ip6[0] && +- (ip->in6_u.u6_addr32[1] & node->mask.ip6[1]) == +- node->ip.ip6[1] && +- (ip->in6_u.u6_addr32[2] & node->mask.ip6[2]) == +- node->ip.ip6[2] && ++ return (ip->in6_u.u6_addr32[0] & node->mask.ip6[0]) == node->ip.ip6[0] && ++ (ip->in6_u.u6_addr32[1] & node->mask.ip6[1]) == node->ip.ip6[1] && ++ (ip->in6_u.u6_addr32[2] & node->mask.ip6[2]) == node->ip.ip6[2] && + (ip->in6_u.u6_addr32[3] & node->mask.ip6[3]) == node->ip.ip6[3]; + } + + static __init void +-horrible_insert_ordered(struct horrible_allowedips *table, +- struct horrible_allowedips_node *node) ++horrible_insert_ordered(struct horrible_allowedips *table, struct horrible_allowedips_node *node) + { + struct horrible_allowedips_node *other = NULL, *where = NULL; + u8 my_cidr = horrible_mask_to_cidr(node->mask); + + hlist_for_each_entry(other, &table->head, table) { +- if (!memcmp(&other->mask, &node->mask, +- sizeof(union nf_inet_addr)) && +- !memcmp(&other->ip, &node->ip, +- sizeof(union nf_inet_addr)) && +- other->ip_version == node->ip_version) { ++ if (other->ip_version == node->ip_version && ++ !memcmp(&other->mask, &node->mask, sizeof(union nf_inet_addr)) && ++ !memcmp(&other->ip, &node->ip, sizeof(union nf_inet_addr))) { + other->value = node->value; + kfree(node); + return; + } ++ } ++ hlist_for_each_entry(other, &table->head, table) { + where = other; + if (horrible_mask_to_cidr(other->mask) <= my_cidr) + break; +@@ -201,8 +181,7 @@ static __init int + horrible_allowedips_insert_v4(struct horrible_allowedips *table, + struct in_addr *ip, u8 cidr, void *value) + { +- struct horrible_allowedips_node *node = kzalloc(sizeof(*node), +- GFP_KERNEL); ++ struct horrible_allowedips_node *node = kzalloc(sizeof(*node), GFP_KERNEL); + + if (unlikely(!node)) + return -ENOMEM; +@@ -219,8 +198,7 @@ static __init int + horrible_allowedips_insert_v6(struct horrible_allowedips *table, + struct in6_addr *ip, u8 cidr, void *value) + { +- struct horrible_allowedips_node *node = kzalloc(sizeof(*node), +- GFP_KERNEL); ++ struct horrible_allowedips_node *node = kzalloc(sizeof(*node), GFP_KERNEL); + + if (unlikely(!node)) + return -ENOMEM; +@@ -234,39 +212,43 @@ horrible_allowedips_insert_v6(struct horrible_allowedips *table, + } + + static __init void * +-horrible_allowedips_lookup_v4(struct horrible_allowedips *table, +- struct in_addr *ip) ++horrible_allowedips_lookup_v4(struct horrible_allowedips *table, struct in_addr *ip) + { + struct horrible_allowedips_node *node; +- void *ret = NULL; + + hlist_for_each_entry(node, &table->head, table) { +- if (node->ip_version != 4) +- continue; +- if (horrible_match_v4(node, ip)) { +- ret = node->value; +- break; +- } ++ if (node->ip_version == 4 && horrible_match_v4(node, ip)) ++ return node->value; + } +- return ret; ++ return NULL; + } + + static __init void * +-horrible_allowedips_lookup_v6(struct horrible_allowedips *table, +- struct in6_addr *ip) ++horrible_allowedips_lookup_v6(struct horrible_allowedips *table, struct in6_addr *ip) + { + struct horrible_allowedips_node *node; +- void *ret = NULL; + + hlist_for_each_entry(node, &table->head, table) { +- if (node->ip_version != 6) ++ if (node->ip_version == 6 && horrible_match_v6(node, ip)) ++ return node->value; ++ } ++ return NULL; ++} ++ ++ ++static __init void ++horrible_allowedips_remove_by_value(struct horrible_allowedips *table, void *value) ++{ ++ struct horrible_allowedips_node *node; ++ struct hlist_node *h; ++ ++ hlist_for_each_entry_safe(node, h, &table->head, table) { ++ if (node->value != value) + continue; +- if (horrible_match_v6(node, ip)) { +- ret = node->value; +- break; +- } ++ hlist_del(&node->table); ++ kfree(node); + } +- return ret; ++ + } + + static __init bool randomized_test(void) +@@ -397,23 +379,33 @@ static __init bool randomized_test(void) + print_tree(t.root6, 128); + } + +- for (i = 0; i < NUM_QUERIES; ++i) { +- prandom_bytes(ip, 4); +- if (lookup(t.root4, 32, ip) != +- horrible_allowedips_lookup_v4(&h, (struct in_addr *)ip)) { +- pr_err("allowedips random self-test: FAIL\n"); +- goto free; ++ for (j = 0;; ++j) { ++ for (i = 0; i < NUM_QUERIES; ++i) { ++ prandom_bytes(ip, 4); ++ if (lookup(t.root4, 32, ip) != horrible_allowedips_lookup_v4(&h, (struct in_addr *)ip)) { ++ horrible_allowedips_lookup_v4(&h, (struct in_addr *)ip); ++ pr_err("allowedips random v4 self-test: FAIL\n"); ++ goto free; ++ } ++ prandom_bytes(ip, 16); ++ if (lookup(t.root6, 128, ip) != horrible_allowedips_lookup_v6(&h, (struct in6_addr *)ip)) { ++ pr_err("allowedips random v6 self-test: FAIL\n"); ++ goto free; ++ } + } ++ if (j >= NUM_PEERS) ++ break; ++ mutex_lock(&mutex); ++ wg_allowedips_remove_by_peer(&t, peers[j], &mutex); ++ mutex_unlock(&mutex); ++ horrible_allowedips_remove_by_value(&h, peers[j]); + } + +- for (i = 0; i < NUM_QUERIES; ++i) { +- prandom_bytes(ip, 16); +- if (lookup(t.root6, 128, ip) != +- horrible_allowedips_lookup_v6(&h, (struct in6_addr *)ip)) { +- pr_err("allowedips random self-test: FAIL\n"); +- goto free; +- } ++ if (t.root4 || t.root6) { ++ pr_err("allowedips random self-test removal: FAIL\n"); ++ goto free; + } ++ + ret = true; + + free: +-- +2.18.4 + + +From abe8c3296a93f5febd5f2f2ea1e1fbcba4d58240 Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Thu, 3 Jun 2021 01:53:40 -0400 +Subject: [PATCH 136/146] crypto: x86/curve25519 - fix cpu feature checking + logic in mod_exit + +commit 1b82435d17774f3eaab35dce239d354548aa9da2 upstream. + +In curve25519_mod_init() the curve25519_alg will be registered only when +(X86_FEATURE_BMI2 && X86_FEATURE_ADX). But in curve25519_mod_exit() +it still checks (X86_FEATURE_BMI2 || X86_FEATURE_ADX) when do crypto +unregister. This will trigger a BUG_ON in crypto_unregister_alg() as +alg->cra_refcnt is 0 if the cpu only supports one of X86_FEATURE_BMI2 +and X86_FEATURE_ADX. + +Fixes: 07b586fe0662 ("crypto: x86/curve25519 - replace with formally verified implementation") +Signed-off-by: Hangbin Liu +Reviewed-by: Jason A. Donenfeld +Signed-off-by: Herbert Xu +Signed-off-by: Jason A. Donenfeld +--- + arch/x86/crypto/curve25519-x86_64.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/x86/crypto/curve25519-x86_64.c b/arch/x86/crypto/curve25519-x86_64.c +index a9edb6f8a0ba..3fcbe873f2f5 100644 +--- a/arch/x86/crypto/curve25519-x86_64.c ++++ b/arch/x86/crypto/curve25519-x86_64.c +@@ -1499,7 +1499,7 @@ static int __init curve25519_mod_init(void) + static void __exit curve25519_mod_exit(void) + { + if (IS_REACHABLE(CONFIG_CRYPTO_KPP) && +- (boot_cpu_has(X86_FEATURE_BMI2) || boot_cpu_has(X86_FEATURE_ADX))) ++ static_branch_likely(&curve25519_use_bmi2_adx)) + crypto_unregister_kpp(&curve25519_alg); + } + +-- +2.18.4 + + +From 6e48fb63d3b17191a78e7415a23be59bd2caf912 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Mon, 29 Nov 2021 10:39:20 -0500 +Subject: [PATCH 137/146] wireguard: allowedips: add missing __rcu annotation + to satisfy sparse + +commit ae9287811ba75571cd69505d50ab0e612ace8572 upstream. + +A __rcu annotation got lost during refactoring, which caused sparse to +become enraged. + +Fixes: bf7b042dc62a ("wireguard: allowedips: free empty intermediate nodes when removing single node") +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Jakub Kicinski +Signed-off-by: Jason A. Donenfeld +--- + drivers/net/wireguard/allowedips.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireguard/allowedips.c b/drivers/net/wireguard/allowedips.c +index b7197e80f226..9a4c8ff32d9d 100644 +--- a/drivers/net/wireguard/allowedips.c ++++ b/drivers/net/wireguard/allowedips.c +@@ -163,7 +163,7 @@ static bool node_placement(struct allowedips_node __rcu *trie, const u8 *key, + return exact; + } + +-static inline void connect_node(struct allowedips_node **parent, u8 bit, struct allowedips_node *node) ++static inline void connect_node(struct allowedips_node __rcu **parent, u8 bit, struct allowedips_node *node) + { + node->parent_bit_packed = (unsigned long)parent | bit; + rcu_assign_pointer(*parent, node); +-- +2.18.4 + + +From 07ded340488b75b883d07c75364c2d4690c89a7e Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Mon, 29 Nov 2021 10:39:21 -0500 +Subject: [PATCH 138/146] wireguard: selftests: increase default dmesg log size + +commit 03ff1b1def73f817e196bf96ab36ac259490bd7c upstream. + +The selftests currently parse the kernel log at the end to track +potential memory leaks. With these tests now reading off the end of the +buffer, due to recent optimizations, some creation messages were lost, +making the tests think that there was a free without an alloc. Fix this +by increasing the kernel log size. + +Fixes: 24b70eeeb4f4 ("wireguard: use synchronize_net rather than synchronize_rcu") +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Jakub Kicinski +Signed-off-by: Jason A. Donenfeld +--- + tools/testing/selftests/wireguard/qemu/kernel.config | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/testing/selftests/wireguard/qemu/kernel.config b/tools/testing/selftests/wireguard/qemu/kernel.config +index 9e413e0ffa3f..30925b799b77 100644 +--- a/tools/testing/selftests/wireguard/qemu/kernel.config ++++ b/tools/testing/selftests/wireguard/qemu/kernel.config +@@ -67,6 +67,7 @@ CONFIG_PROC_SYSCTL=y + CONFIG_SYSFS=y + CONFIG_TMPFS=y + CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15 ++CONFIG_LOG_BUF_SHIFT=18 + CONFIG_PRINTK_TIME=y + CONFIG_BLK_DEV_INITRD=y + CONFIG_LEGACY_VSYSCALL_NONE=y +-- +2.18.4 + + +From 34d079bb1522181d4aaf388f73fe2555bdb95652 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Mon, 29 Nov 2021 10:39:22 -0500 +Subject: [PATCH 139/146] wireguard: selftests: actually test for routing loops + +commit 782c72af567fc2ef09bd7615d0307f24de72c7e0 upstream. + +We previously removed the restriction on looping to self, and then added +a test to make sure the kernel didn't blow up during a routing loop. The +kernel didn't blow up, thankfully, but on certain architectures where +skb fragmentation is easier, such as ppc64, the skbs weren't actually +being discarded after a few rounds through. But the test wasn't catching +this. So actually test explicitly for massive increases in tx to see if +we have a routing loop. Note that the actual loop problem will need to +be addressed in a different commit. + +Fixes: b673e24aad36 ("wireguard: socket: remove errant restriction on looping to self") +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Jakub Kicinski +Signed-off-by: Jason A. Donenfeld +--- + tools/testing/selftests/wireguard/netns.sh | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh +index ebc4ee0fe179..2e5c1630885e 100755 +--- a/tools/testing/selftests/wireguard/netns.sh ++++ b/tools/testing/selftests/wireguard/netns.sh +@@ -276,7 +276,11 @@ n0 ping -W 1 -c 1 192.168.241.2 + n1 wg set wg0 peer "$pub2" endpoint 192.168.241.2:7 + ip2 link del wg0 + ip2 link del wg1 +-! n0 ping -W 1 -c 10 -f 192.168.241.2 || false # Should not crash kernel ++read _ _ tx_bytes_before < <(n0 wg show wg1 transfer) ++! n0 ping -W 1 -c 10 -f 192.168.241.2 || false ++sleep 1 ++read _ _ tx_bytes_after < <(n0 wg show wg1 transfer) ++(( tx_bytes_after - tx_bytes_before < 70000 )) + + ip0 link del wg1 + ip1 link del wg0 +-- +2.18.4 + + +From ec894d951dce08f299ca7ba8ee780ac63c32f90f Mon Sep 17 00:00:00 2001 +From: Randy Dunlap +Date: Mon, 29 Nov 2021 10:39:23 -0500 +Subject: [PATCH 140/146] wireguard: main: rename 'mod_init' & 'mod_exit' + functions to be module-specific + +commit b251b711a92189d558b07fde5a7ccd5a7915ebdd upstream. + +Rename module_init & module_exit functions that are named +"mod_init" and "mod_exit" so that they are unique in both the +System.map file and in initcall_debug output instead of showing +up as almost anonymous "mod_init". + +This is helpful for debugging and in determining how long certain +module_init calls take to execute. + +Signed-off-by: Randy Dunlap +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Jakub Kicinski +Signed-off-by: Jason A. Donenfeld +--- + drivers/net/wireguard/main.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/wireguard/main.c b/drivers/net/wireguard/main.c +index 75dbe77b0b4b..ee4da9ab8013 100644 +--- a/drivers/net/wireguard/main.c ++++ b/drivers/net/wireguard/main.c +@@ -17,7 +17,7 @@ + #include + #include + +-static int __init mod_init(void) ++static int __init wg_mod_init(void) + { + int ret; + +@@ -60,7 +60,7 @@ static int __init mod_init(void) + return ret; + } + +-static void __exit mod_exit(void) ++static void __exit wg_mod_exit(void) + { + wg_genetlink_uninit(); + wg_device_uninit(); +@@ -68,8 +68,8 @@ static void __exit mod_exit(void) + wg_allowedips_slab_uninit(); + } + +-module_init(mod_init); +-module_exit(mod_exit); ++module_init(wg_mod_init); ++module_exit(wg_mod_exit); + MODULE_LICENSE("GPL v2"); + MODULE_DESCRIPTION("WireGuard secure network tunnel"); + MODULE_AUTHOR("Jason A. Donenfeld "); +-- +2.18.4 + + +From 744b24739439cc8713e476db1540021add2cdbad Mon Sep 17 00:00:00 2001 +From: Li Zhijian +Date: Mon, 29 Nov 2021 10:39:24 -0500 +Subject: [PATCH 141/146] wireguard: selftests: rename DEBUG_PI_LIST to + DEBUG_PLIST + +commit 7e938beb8321d34f040557b8915b228af125f73c upstream. + +DEBUG_PI_LIST was renamed to DEBUG_PLIST since 8e18faeac3 ("lib/plist: +rename DEBUG_PI_LIST to DEBUG_PLIST"). + +Signed-off-by: Li Zhijian +Fixes: 8e18faeac3e4 ("lib/plist: rename DEBUG_PI_LIST to DEBUG_PLIST") +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Jakub Kicinski +Signed-off-by: Jason A. Donenfeld +--- + tools/testing/selftests/wireguard/qemu/debug.config | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/testing/selftests/wireguard/qemu/debug.config b/tools/testing/selftests/wireguard/qemu/debug.config +index b9c72706fe4d..80501d4e6ae3 100644 +--- a/tools/testing/selftests/wireguard/qemu/debug.config ++++ b/tools/testing/selftests/wireguard/qemu/debug.config +@@ -50,7 +50,7 @@ CONFIG_DEBUG_ATOMIC_SLEEP=y + CONFIG_TRACE_IRQFLAGS=y + CONFIG_DEBUG_BUGVERBOSE=y + CONFIG_DEBUG_LIST=y +-CONFIG_DEBUG_PI_LIST=y ++CONFIG_DEBUG_PLIST=y + CONFIG_PROVE_RCU=y + CONFIG_SPARSE_RCU_POINTER=y + CONFIG_RCU_CPU_STALL_TIMEOUT=21 +-- +2.18.4 + + +From c9ea3aec0ff22a55e4383728be23417ffa7cfe97 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Mon, 29 Nov 2021 10:39:25 -0500 +Subject: [PATCH 142/146] wireguard: device: reset peer src endpoint when netns + exits +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +commit 20ae1d6aa159eb91a9bf09ff92ccaa94dbea92c2 upstream. + +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. + +Tested-by: Hangbin Liu +Reported-by: Xiumei Mu +Cc: Toke Høiland-Jørgensen +Cc: Paolo Abeni +Fixes: 900575aa33a3 ("wireguard: device: avoid circular netns references") +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Jakub Kicinski +Signed-off-by: Jason A. Donenfeld +--- + drivers/net/wireguard/device.c | 3 +++ + drivers/net/wireguard/socket.c | 2 +- + include/net/dst_cache.h | 11 ++++++++++ + net/core/dst_cache.c | 19 +++++++++++++++++ + tools/testing/selftests/wireguard/netns.sh | 24 +++++++++++++++++++++- + 5 files changed, 57 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c +index 8c7d97f96d56..ed06a64f4716 100644 +--- a/drivers/net/wireguard/device.c ++++ b/drivers/net/wireguard/device.c +@@ -398,6 +398,7 @@ static struct rtnl_link_ops link_ops __read_mostly = { + static void wg_netns_pre_exit(struct net *net) + { + struct wg_device *wg; ++ struct wg_peer *peer; + + rtnl_lock(); + list_for_each_entry(wg, &device_list, device_list) { +@@ -407,6 +408,8 @@ static void wg_netns_pre_exit(struct net *net) + mutex_lock(&wg->device_update_lock); + rcu_assign_pointer(wg->creating_net, NULL); + wg_socket_reinit(wg, NULL, NULL); ++ list_for_each_entry(peer, &wg->peer_list, peer_list) ++ wg_socket_clear_peer_endpoint_src(peer); + mutex_unlock(&wg->device_update_lock); + } + } +diff --git a/drivers/net/wireguard/socket.c b/drivers/net/wireguard/socket.c +index 04739763e303..bd887f33a3a8 100644 +--- a/drivers/net/wireguard/socket.c ++++ b/drivers/net/wireguard/socket.c +@@ -308,7 +308,7 @@ void wg_socket_clear_peer_endpoint_src(struct wg_peer *peer) + { + write_lock_bh(&peer->endpoint_lock); + memset(&peer->endpoint.src6, 0, sizeof(peer->endpoint.src6)); +- dst_cache_reset(&peer->endpoint_cache); ++ dst_cache_reset_now(&peer->endpoint_cache); + write_unlock_bh(&peer->endpoint_lock); + } + +diff --git a/include/net/dst_cache.h b/include/net/dst_cache.h +index 67634675e919..df6622a5fe98 100644 +--- a/include/net/dst_cache.h ++++ b/include/net/dst_cache.h +@@ -79,6 +79,17 @@ static inline void dst_cache_reset(struct dst_cache *dst_cache) + dst_cache->reset_ts = jiffies; + } + ++/** ++ * dst_cache_reset_now - invalidate the cache contents immediately ++ * @dst_cache: the cache ++ * ++ * The caller must be sure there are no concurrent users, as this frees ++ * all dst_cache users immediately, rather than waiting for the next ++ * per-cpu usage like dst_cache_reset does. Most callers should use the ++ * higher speed lazily-freed dst_cache_reset function instead. ++ */ ++void dst_cache_reset_now(struct dst_cache *dst_cache); ++ + /** + * dst_cache_init - initialize the cache, allocating the required storage + * @dst_cache: the cache +diff --git a/net/core/dst_cache.c b/net/core/dst_cache.c +index be74ab4551c2..0ccfd5fa5cb9 100644 +--- a/net/core/dst_cache.c ++++ b/net/core/dst_cache.c +@@ -162,3 +162,22 @@ void dst_cache_destroy(struct dst_cache *dst_cache) + free_percpu(dst_cache->cache); + } + EXPORT_SYMBOL_GPL(dst_cache_destroy); ++ ++void dst_cache_reset_now(struct dst_cache *dst_cache) ++{ ++ int i; ++ ++ if (!dst_cache->cache) ++ return; ++ ++ dst_cache->reset_ts = jiffies; ++ for_each_possible_cpu(i) { ++ struct dst_cache_pcpu *idst = per_cpu_ptr(dst_cache->cache, i); ++ struct dst_entry *dst = idst->dst; ++ ++ idst->cookie = 0; ++ idst->dst = NULL; ++ dst_release(dst); ++ } ++} ++EXPORT_SYMBOL_GPL(dst_cache_reset_now); +diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh +index 2e5c1630885e..8a9461aa0878 100755 +--- a/tools/testing/selftests/wireguard/netns.sh ++++ b/tools/testing/selftests/wireguard/netns.sh +@@ -613,6 +613,28 @@ ip0 link set wg0 up + kill $ncat_pid + ip0 link del wg0 + ++# Ensure that dst_cache references don't outlive netns lifetime ++ip1 link add dev wg0 type wireguard ++ip2 link add dev wg0 type wireguard ++configure_peers ++ip1 link add veth1 type veth peer name veth2 ++ip1 link set veth2 netns $netns2 ++ip1 addr add fd00:aa::1/64 dev veth1 ++ip2 addr add fd00:aa::2/64 dev veth2 ++ip1 link set veth1 up ++ip2 link set veth2 up ++waitiface $netns1 veth1 ++waitiface $netns2 veth2 ++ip1 -6 route add default dev veth1 via fd00:aa::2 ++ip2 -6 route add default dev veth2 via fd00:aa::1 ++n1 wg set wg0 peer "$pub2" endpoint [fd00:aa::2]:2 ++n2 wg set wg0 peer "$pub1" endpoint [fd00:aa::1]:1 ++n1 ping6 -c 1 fd00::2 ++pp ip netns delete $netns1 ++pp ip netns delete $netns2 ++pp ip netns add $netns1 ++pp ip netns add $netns2 ++ + # Ensure there aren't circular reference loops + ip1 link add wg1 type wireguard + ip2 link add wg2 type wireguard +@@ -631,7 +653,7 @@ while read -t 0.1 -r line 2>/dev/null || [[ $? -ne 142 ]]; do + done < /dev/kmsg + alldeleted=1 + for object in "${!objects[@]}"; do +- if [[ ${objects["$object"]} != *createddestroyed ]]; then ++ if [[ ${objects["$object"]} != *createddestroyed && ${objects["$object"]} != *createdcreateddestroyeddestroyed ]]; then + echo "Error: $object: merely ${objects["$object"]}" >&3 + alldeleted=0 + fi +-- +2.18.4 + + +From a995aa622a99a2d861381dfb628d5a14f5d25f35 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Mon, 29 Nov 2021 10:39:26 -0500 +Subject: [PATCH 143/146] wireguard: receive: use ring buffer for incoming + handshakes + +commit 886fcee939adb5e2af92741b90643a59f2b54f97 upstream. + +Apparently the spinlock on incoming_handshake's skb_queue is highly +contended, and a torrent of handshake or cookie packets can bring the +data plane to its knees, simply by virtue of enqueueing the handshake +packets to be processed asynchronously. So, we try switching this to a +ring buffer to hopefully have less lock contention. This alleviates the +problem somewhat, though it still isn't perfect, so future patches will +have to improve this further. However, it at least doesn't completely +diminish the data plane. + +Reported-by: Streun Fabio +Reported-by: Joel Wanner +Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Jakub Kicinski +Signed-off-by: Jason A. Donenfeld +--- + drivers/net/wireguard/device.c | 36 ++++++++++++++++---------------- + drivers/net/wireguard/device.h | 9 +++----- + drivers/net/wireguard/queueing.c | 6 +++--- + drivers/net/wireguard/queueing.h | 2 +- + drivers/net/wireguard/receive.c | 27 +++++++++++------------- + 5 files changed, 37 insertions(+), 43 deletions(-) + +diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c +index ed06a64f4716..efe5ace9d340 100644 +--- a/drivers/net/wireguard/device.c ++++ b/drivers/net/wireguard/device.c +@@ -98,6 +98,7 @@ static int wg_stop(struct net_device *dev) + { + struct wg_device *wg = netdev_priv(dev); + struct wg_peer *peer; ++ struct sk_buff *skb; + + mutex_lock(&wg->device_update_lock); + list_for_each_entry(peer, &wg->peer_list, peer_list) { +@@ -108,7 +109,9 @@ static int wg_stop(struct net_device *dev) + wg_noise_reset_last_sent_handshake(&peer->last_sent_handshake); + } + mutex_unlock(&wg->device_update_lock); +- skb_queue_purge(&wg->incoming_handshakes); ++ while ((skb = ptr_ring_consume(&wg->handshake_queue.ring)) != NULL) ++ kfree_skb(skb); ++ atomic_set(&wg->handshake_queue_len, 0); + wg_socket_reinit(wg, NULL, NULL); + return 0; + } +@@ -235,14 +238,13 @@ static void wg_destruct(struct net_device *dev) + destroy_workqueue(wg->handshake_receive_wq); + destroy_workqueue(wg->handshake_send_wq); + destroy_workqueue(wg->packet_crypt_wq); +- wg_packet_queue_free(&wg->decrypt_queue); +- wg_packet_queue_free(&wg->encrypt_queue); ++ wg_packet_queue_free(&wg->handshake_queue, true); ++ wg_packet_queue_free(&wg->decrypt_queue, false); ++ wg_packet_queue_free(&wg->encrypt_queue, false); + rcu_barrier(); /* Wait for all the peers to be actually freed. */ + wg_ratelimiter_uninit(); + memzero_explicit(&wg->static_identity, sizeof(wg->static_identity)); +- skb_queue_purge(&wg->incoming_handshakes); + free_percpu(dev->tstats); +- free_percpu(wg->incoming_handshakes_worker); + kvfree(wg->index_hashtable); + kvfree(wg->peer_hashtable); + mutex_unlock(&wg->device_update_lock); +@@ -298,7 +300,6 @@ static int wg_newlink(struct net *src_net, struct net_device *dev, + init_rwsem(&wg->static_identity.lock); + mutex_init(&wg->socket_update_lock); + mutex_init(&wg->device_update_lock); +- skb_queue_head_init(&wg->incoming_handshakes); + wg_allowedips_init(&wg->peer_allowedips); + wg_cookie_checker_init(&wg->cookie_checker, wg); + INIT_LIST_HEAD(&wg->peer_list); +@@ -316,16 +317,10 @@ static int wg_newlink(struct net *src_net, struct net_device *dev, + if (!dev->tstats) + goto err_free_index_hashtable; + +- wg->incoming_handshakes_worker = +- wg_packet_percpu_multicore_worker_alloc( +- wg_packet_handshake_receive_worker, wg); +- if (!wg->incoming_handshakes_worker) +- goto err_free_tstats; +- + wg->handshake_receive_wq = alloc_workqueue("wg-kex-%s", + WQ_CPU_INTENSIVE | WQ_FREEZABLE, 0, dev->name); + if (!wg->handshake_receive_wq) +- goto err_free_incoming_handshakes; ++ goto err_free_tstats; + + wg->handshake_send_wq = alloc_workqueue("wg-kex-%s", + WQ_UNBOUND | WQ_FREEZABLE, 0, dev->name); +@@ -347,10 +342,15 @@ static int wg_newlink(struct net *src_net, struct net_device *dev, + if (ret < 0) + goto err_free_encrypt_queue; + +- ret = wg_ratelimiter_init(); ++ ret = wg_packet_queue_init(&wg->handshake_queue, wg_packet_handshake_receive_worker, ++ MAX_QUEUED_INCOMING_HANDSHAKES); + if (ret < 0) + goto err_free_decrypt_queue; + ++ ret = wg_ratelimiter_init(); ++ if (ret < 0) ++ goto err_free_handshake_queue; ++ + ret = register_netdevice(dev); + if (ret < 0) + goto err_uninit_ratelimiter; +@@ -367,18 +367,18 @@ static int wg_newlink(struct net *src_net, struct net_device *dev, + + err_uninit_ratelimiter: + wg_ratelimiter_uninit(); ++err_free_handshake_queue: ++ wg_packet_queue_free(&wg->handshake_queue, false); + err_free_decrypt_queue: +- wg_packet_queue_free(&wg->decrypt_queue); ++ wg_packet_queue_free(&wg->decrypt_queue, false); + err_free_encrypt_queue: +- wg_packet_queue_free(&wg->encrypt_queue); ++ wg_packet_queue_free(&wg->encrypt_queue, false); + err_destroy_packet_crypt: + destroy_workqueue(wg->packet_crypt_wq); + err_destroy_handshake_send: + destroy_workqueue(wg->handshake_send_wq); + err_destroy_handshake_receive: + destroy_workqueue(wg->handshake_receive_wq); +-err_free_incoming_handshakes: +- free_percpu(wg->incoming_handshakes_worker); + err_free_tstats: + free_percpu(dev->tstats); + err_free_index_hashtable: +diff --git a/drivers/net/wireguard/device.h b/drivers/net/wireguard/device.h +index 854bc3d97150..43c7cebbf50b 100644 +--- a/drivers/net/wireguard/device.h ++++ b/drivers/net/wireguard/device.h +@@ -39,21 +39,18 @@ struct prev_queue { + + struct wg_device { + struct net_device *dev; +- struct crypt_queue encrypt_queue, decrypt_queue; ++ struct crypt_queue encrypt_queue, decrypt_queue, handshake_queue; + struct sock __rcu *sock4, *sock6; + struct net __rcu *creating_net; + struct noise_static_identity static_identity; +- struct workqueue_struct *handshake_receive_wq, *handshake_send_wq; +- struct workqueue_struct *packet_crypt_wq; +- struct sk_buff_head incoming_handshakes; +- int incoming_handshake_cpu; +- struct multicore_worker __percpu *incoming_handshakes_worker; ++ struct workqueue_struct *packet_crypt_wq,*handshake_receive_wq, *handshake_send_wq; + struct cookie_checker cookie_checker; + struct pubkey_hashtable *peer_hashtable; + struct index_hashtable *index_hashtable; + struct allowedips peer_allowedips; + struct mutex device_update_lock, socket_update_lock; + struct list_head device_list, peer_list; ++ atomic_t handshake_queue_len; + unsigned int num_peers, device_update_gen; + u32 fwmark; + u16 incoming_port; +diff --git a/drivers/net/wireguard/queueing.c b/drivers/net/wireguard/queueing.c +index 48e7b982a307..1de413b19e34 100644 +--- a/drivers/net/wireguard/queueing.c ++++ b/drivers/net/wireguard/queueing.c +@@ -38,11 +38,11 @@ int wg_packet_queue_init(struct crypt_queue *queue, work_func_t function, + return 0; + } + +-void wg_packet_queue_free(struct crypt_queue *queue) ++void wg_packet_queue_free(struct crypt_queue *queue, bool purge) + { + free_percpu(queue->worker); +- WARN_ON(!__ptr_ring_empty(&queue->ring)); +- ptr_ring_cleanup(&queue->ring, NULL); ++ WARN_ON(!purge && !__ptr_ring_empty(&queue->ring)); ++ ptr_ring_cleanup(&queue->ring, purge ? (void(*)(void*))kfree_skb : NULL); + } + + #define NEXT(skb) ((skb)->prev) +diff --git a/drivers/net/wireguard/queueing.h b/drivers/net/wireguard/queueing.h +index 4ef2944a68bc..e2388107f7fd 100644 +--- a/drivers/net/wireguard/queueing.h ++++ b/drivers/net/wireguard/queueing.h +@@ -23,7 +23,7 @@ struct sk_buff; + /* queueing.c APIs: */ + int wg_packet_queue_init(struct crypt_queue *queue, work_func_t function, + unsigned int len); +-void wg_packet_queue_free(struct crypt_queue *queue); ++void wg_packet_queue_free(struct crypt_queue *queue, bool purge); + struct multicore_worker __percpu * + wg_packet_percpu_multicore_worker_alloc(work_func_t function, void *ptr); + +diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c +index 7dc84bcca261..f4e537e3e8ec 100644 +--- a/drivers/net/wireguard/receive.c ++++ b/drivers/net/wireguard/receive.c +@@ -116,8 +116,8 @@ static void wg_receive_handshake_packet(struct wg_device *wg, + return; + } + +- under_load = skb_queue_len(&wg->incoming_handshakes) >= +- MAX_QUEUED_INCOMING_HANDSHAKES / 8; ++ under_load = atomic_read(&wg->handshake_queue_len) >= ++ MAX_QUEUED_INCOMING_HANDSHAKES / 8; + if (under_load) { + last_under_load = ktime_get_coarse_boottime_ns(); + } else if (last_under_load) { +@@ -212,13 +212,14 @@ static void wg_receive_handshake_packet(struct wg_device *wg, + + void wg_packet_handshake_receive_worker(struct work_struct *work) + { +- struct wg_device *wg = container_of(work, struct multicore_worker, +- work)->ptr; ++ struct crypt_queue *queue = container_of(work, struct multicore_worker, work)->ptr; ++ struct wg_device *wg = container_of(queue, struct wg_device, handshake_queue); + struct sk_buff *skb; + +- while ((skb = skb_dequeue(&wg->incoming_handshakes)) != NULL) { ++ while ((skb = ptr_ring_consume_bh(&queue->ring)) != NULL) { + wg_receive_handshake_packet(wg, skb); + dev_kfree_skb(skb); ++ atomic_dec(&wg->handshake_queue_len); + cond_resched(); + } + } +@@ -554,21 +555,17 @@ void wg_packet_receive(struct wg_device *wg, struct sk_buff *skb) + case cpu_to_le32(MESSAGE_HANDSHAKE_RESPONSE): + case cpu_to_le32(MESSAGE_HANDSHAKE_COOKIE): { + int cpu; +- +- if (skb_queue_len(&wg->incoming_handshakes) > +- MAX_QUEUED_INCOMING_HANDSHAKES || +- unlikely(!rng_is_initialized())) { ++ if (unlikely(!rng_is_initialized() || ++ ptr_ring_produce_bh(&wg->handshake_queue.ring, skb))) { + net_dbg_skb_ratelimited("%s: Dropping handshake packet from %pISpfsc\n", + wg->dev->name, skb); + goto err; + } +- skb_queue_tail(&wg->incoming_handshakes, skb); +- /* Queues up a call to packet_process_queued_handshake_ +- * packets(skb): +- */ +- cpu = wg_cpumask_next_online(&wg->incoming_handshake_cpu); ++ atomic_inc(&wg->handshake_queue_len); ++ cpu = wg_cpumask_next_online(&wg->handshake_queue.last_cpu); ++ /* Queues up a call to packet_process_queued_handshake_packets(skb): */ + queue_work_on(cpu, wg->handshake_receive_wq, +- &per_cpu_ptr(wg->incoming_handshakes_worker, cpu)->work); ++ &per_cpu_ptr(wg->handshake_queue.worker, cpu)->work); + break; + } + case cpu_to_le32(MESSAGE_DATA): +-- +2.18.4 + + +From 8f841e7aa3578d15f12f452bf3415a41ce57e3c8 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Mon, 29 Nov 2021 10:39:27 -0500 +Subject: [PATCH 144/146] wireguard: receive: drop handshakes if queue lock is + contended + +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 +Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Jakub Kicinski +Signed-off-by: Jason A. Donenfeld +--- + drivers/net/wireguard/receive.c | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/wireguard/receive.c b/drivers/net/wireguard/receive.c +index f4e537e3e8ec..7b8df406c773 100644 +--- a/drivers/net/wireguard/receive.c ++++ b/drivers/net/wireguard/receive.c +@@ -554,9 +554,19 @@ void wg_packet_receive(struct wg_device *wg, struct sk_buff *skb) + case cpu_to_le32(MESSAGE_HANDSHAKE_INITIATION): + case cpu_to_le32(MESSAGE_HANDSHAKE_RESPONSE): + case cpu_to_le32(MESSAGE_HANDSHAKE_COOKIE): { +- int cpu; +- if (unlikely(!rng_is_initialized() || +- ptr_ring_produce_bh(&wg->handshake_queue.ring, skb))) { ++ int cpu, ret = -EBUSY; ++ ++ if (unlikely(!rng_is_initialized())) ++ goto drop; ++ if (atomic_read(&wg->handshake_queue_len) > MAX_QUEUED_INCOMING_HANDSHAKES / 2) { ++ if (spin_trylock_bh(&wg->handshake_queue.ring.producer_lock)) { ++ ret = __ptr_ring_produce(&wg->handshake_queue.ring, skb); ++ spin_unlock_bh(&wg->handshake_queue.ring.producer_lock); ++ } ++ } else ++ ret = ptr_ring_produce_bh(&wg->handshake_queue.ring, skb); ++ if (ret) { ++ drop: + net_dbg_skb_ratelimited("%s: Dropping handshake packet from %pISpfsc\n", + wg->dev->name, skb); + goto err; +-- +2.18.4 + + +From 612766c5191e28c075b57f8277fb3b52d0330ae9 Mon Sep 17 00:00:00 2001 +From: "Gustavo A. R. Silva" +Date: Mon, 29 Nov 2021 10:39:28 -0500 +Subject: [PATCH 145/146] wireguard: ratelimiter: use kvcalloc() instead of + kvzalloc() + +commit 4e3fd721710553832460c179c2ee5ce67ef7f1e0 upstream. + +Use 2-factor argument form kvcalloc() instead of kvzalloc(). + +Link: https://github.com/KSPP/linux/issues/162 +Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") +Signed-off-by: Gustavo A. R. Silva +[Jason: Gustavo's link above is for KSPP, but this isn't actually a + security fix, as table_size is bounded to 8192 anyway, and gcc realizes + this, so the codegen comes out to be about the same.] +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Jakub Kicinski +Signed-off-by: Jason A. Donenfeld +--- + drivers/net/wireguard/ratelimiter.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/wireguard/ratelimiter.c b/drivers/net/wireguard/ratelimiter.c +index 3fedd1d21f5e..dd55e5c26f46 100644 +--- a/drivers/net/wireguard/ratelimiter.c ++++ b/drivers/net/wireguard/ratelimiter.c +@@ -176,12 +176,12 @@ int wg_ratelimiter_init(void) + (1U << 14) / sizeof(struct hlist_head))); + max_entries = table_size * 8; + +- table_v4 = kvzalloc(table_size * sizeof(*table_v4), GFP_KERNEL); ++ table_v4 = kvcalloc(table_size, sizeof(*table_v4), GFP_KERNEL); + if (unlikely(!table_v4)) + goto err_kmemcache; + + #if IS_ENABLED(CONFIG_IPV6) +- table_v6 = kvzalloc(table_size * sizeof(*table_v6), GFP_KERNEL); ++ table_v6 = kvcalloc(table_size, sizeof(*table_v6), GFP_KERNEL); + if (unlikely(!table_v6)) { + kvfree(table_v4); + goto err_kmemcache; +-- +2.18.4 + + +From d768bbaf42d9f76ebd1a45e0c090b02cf975ce72 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Tue, 14 Dec 2021 17:01:46 +0100 +Subject: [PATCH 146/146] crypto: x86/curve25519 - use in/out register + constraints more precisely + +commit acd93f8a4ca784d8eff303c6cae49f3bf7b3a499 upstream. + +Rather than passing all variables as modified, pass ones that are only +read into that parameter. This helps with old gcc versions when +alternatives are additionally used, and lets gcc's codegen be a little +bit more efficient. This also syncs up with the latest Vale/EverCrypt +output. + +Reported-by: Mathias Krause +Cc: Aymeric Fromherz +Link: https://lore.kernel.org/wireguard/1554725710.1290070.1639240504281.JavaMail.zimbra@inria.fr/ +Link: https://github.com/project-everest/hacl-star/pull/501 +Signed-off-by: Jason A. Donenfeld +Reviewed-by: Mathias Krause +Signed-off-by: Herbert Xu +Signed-off-by: Jason A. Donenfeld +--- + arch/x86/crypto/curve25519-x86_64.c | 774 ++++++++++++++++++---------- + 1 file changed, 493 insertions(+), 281 deletions(-) + +diff --git a/arch/x86/crypto/curve25519-x86_64.c b/arch/x86/crypto/curve25519-x86_64.c +index 3fcbe873f2f5..d55fa9e9b9e6 100644 +--- a/arch/x86/crypto/curve25519-x86_64.c ++++ b/arch/x86/crypto/curve25519-x86_64.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -63,10 +64,9 @@ static inline u64 add_scalar(u64 *out, const u64 *f1, u64 f2) + + /* Return the carry bit in a register */ + " adcx %%r11, %1;" +- : "+&r" (f2), "=&r" (carry_r) +- : "r" (out), "r" (f1) +- : "%r8", "%r9", "%r10", "%r11", "memory", "cc" +- ); ++ : "+&r"(f2), "=&r"(carry_r) ++ : "r"(out), "r"(f1) ++ : "%r8", "%r9", "%r10", "%r11", "memory", "cc"); + + return carry_r; + } +@@ -107,17 +107,16 @@ static inline void fadd(u64 *out, const u64 *f1, const u64 *f2) + " cmovc %0, %%rax;" + " add %%rax, %%r8;" + " movq %%r8, 0(%1);" +- : "+&r" (f2) +- : "r" (out), "r" (f1) +- : "%rax", "%rcx", "%r8", "%r9", "%r10", "%r11", "memory", "cc" +- ); ++ : "+&r"(f2) ++ : "r"(out), "r"(f1) ++ : "%rax", "%rcx", "%r8", "%r9", "%r10", "%r11", "memory", "cc"); + } + +-/* Computes the field substraction of two field elements */ ++/* Computes the field subtraction of two field elements */ + static inline void fsub(u64 *out, const u64 *f1, const u64 *f2) + { + asm volatile( +- /* Compute the raw substraction of f1-f2 */ ++ /* Compute the raw subtraction of f1-f2 */ + " movq 0(%1), %%r8;" + " subq 0(%2), %%r8;" + " movq 8(%1), %%r9;" +@@ -134,7 +133,7 @@ static inline void fsub(u64 *out, const u64 *f1, const u64 *f2) + " mov $38, %%rcx;" + " cmovc %%rcx, %%rax;" + +- /* Step 2: Substract carry*38 from the original difference */ ++ /* Step 2: Subtract carry*38 from the original difference */ + " sub %%rax, %%r8;" + " sbb $0, %%r9;" + " sbb $0, %%r10;" +@@ -150,10 +149,9 @@ static inline void fsub(u64 *out, const u64 *f1, const u64 *f2) + " movq %%r9, 8(%0);" + " movq %%r10, 16(%0);" + " movq %%r11, 24(%0);" +- : +- : "r" (out), "r" (f1), "r" (f2) +- : "%rax", "%rcx", "%r8", "%r9", "%r10", "%r11", "memory", "cc" +- ); ++ : ++ : "r"(out), "r"(f1), "r"(f2) ++ : "%rax", "%rcx", "%r8", "%r9", "%r10", "%r11", "memory", "cc"); + } + + /* Computes a field multiplication: out <- f1 * f2 +@@ -161,239 +159,400 @@ static inline void fsub(u64 *out, const u64 *f1, const u64 *f2) + static inline void fmul(u64 *out, const u64 *f1, const u64 *f2, u64 *tmp) + { + asm volatile( ++ + /* Compute the raw multiplication: tmp <- src1 * src2 */ + + /* Compute src1[0] * src2 */ +- " movq 0(%1), %%rdx;" +- " mulxq 0(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " movq %%r8, 0(%0);" +- " mulxq 8(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " movq %%r10, 8(%0);" +- " mulxq 16(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" +- " mulxq 24(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " mov $0, %%rax;" +- " adox %%rdx, %%rax;" ++ " movq 0(%0), %%rdx;" ++ " mulxq 0(%1), %%r8, %%r9;" ++ " xor %%r10d, %%r10d;" ++ " movq %%r8, 0(%2);" ++ " mulxq 8(%1), %%r10, %%r11;" ++ " adox %%r9, %%r10;" ++ " movq %%r10, 8(%2);" ++ " mulxq 16(%1), %%rbx, %%r13;" ++ " adox %%r11, %%rbx;" ++ " mulxq 24(%1), %%r14, %%rdx;" ++ " adox %%r13, %%r14;" ++ " mov $0, %%rax;" ++ " adox %%rdx, %%rax;" ++ + /* Compute src1[1] * src2 */ +- " movq 8(%1), %%rdx;" +- " mulxq 0(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 8(%0), %%r8;" " movq %%r8, 8(%0);" +- " mulxq 8(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 16(%0);" +- " mulxq 16(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " mov $0, %%r8;" +- " mulxq 24(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " mov $0, %%rax;" +- " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" ++ " movq 8(%0), %%rdx;" ++ " mulxq 0(%1), %%r8, %%r9;" ++ " xor %%r10d, %%r10d;" ++ " adcxq 8(%2), %%r8;" ++ " movq %%r8, 8(%2);" ++ " mulxq 8(%1), %%r10, %%r11;" ++ " adox %%r9, %%r10;" ++ " adcx %%rbx, %%r10;" ++ " movq %%r10, 16(%2);" ++ " mulxq 16(%1), %%rbx, %%r13;" ++ " adox %%r11, %%rbx;" ++ " adcx %%r14, %%rbx;" ++ " mov $0, %%r8;" ++ " mulxq 24(%1), %%r14, %%rdx;" ++ " adox %%r13, %%r14;" ++ " adcx %%rax, %%r14;" ++ " mov $0, %%rax;" ++ " adox %%rdx, %%rax;" ++ " adcx %%r8, %%rax;" ++ + /* Compute src1[2] * src2 */ +- " movq 16(%1), %%rdx;" +- " mulxq 0(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 16(%0), %%r8;" " movq %%r8, 16(%0);" +- " mulxq 8(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 24(%0);" +- " mulxq 16(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " mov $0, %%r8;" +- " mulxq 24(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " mov $0, %%rax;" +- " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" ++ " movq 16(%0), %%rdx;" ++ " mulxq 0(%1), %%r8, %%r9;" ++ " xor %%r10d, %%r10d;" ++ " adcxq 16(%2), %%r8;" ++ " movq %%r8, 16(%2);" ++ " mulxq 8(%1), %%r10, %%r11;" ++ " adox %%r9, %%r10;" ++ " adcx %%rbx, %%r10;" ++ " movq %%r10, 24(%2);" ++ " mulxq 16(%1), %%rbx, %%r13;" ++ " adox %%r11, %%rbx;" ++ " adcx %%r14, %%rbx;" ++ " mov $0, %%r8;" ++ " mulxq 24(%1), %%r14, %%rdx;" ++ " adox %%r13, %%r14;" ++ " adcx %%rax, %%r14;" ++ " mov $0, %%rax;" ++ " adox %%rdx, %%rax;" ++ " adcx %%r8, %%rax;" ++ + /* Compute src1[3] * src2 */ +- " movq 24(%1), %%rdx;" +- " mulxq 0(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 24(%0), %%r8;" " movq %%r8, 24(%0);" +- " mulxq 8(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 32(%0);" +- " mulxq 16(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " movq %%rbx, 40(%0);" " mov $0, %%r8;" +- " mulxq 24(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " movq %%r14, 48(%0);" " mov $0, %%rax;" +- " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" " movq %%rax, 56(%0);" ++ " movq 24(%0), %%rdx;" ++ " mulxq 0(%1), %%r8, %%r9;" ++ " xor %%r10d, %%r10d;" ++ " adcxq 24(%2), %%r8;" ++ " movq %%r8, 24(%2);" ++ " mulxq 8(%1), %%r10, %%r11;" ++ " adox %%r9, %%r10;" ++ " adcx %%rbx, %%r10;" ++ " movq %%r10, 32(%2);" ++ " mulxq 16(%1), %%rbx, %%r13;" ++ " adox %%r11, %%rbx;" ++ " adcx %%r14, %%rbx;" ++ " movq %%rbx, 40(%2);" ++ " mov $0, %%r8;" ++ " mulxq 24(%1), %%r14, %%rdx;" ++ " adox %%r13, %%r14;" ++ " adcx %%rax, %%r14;" ++ " movq %%r14, 48(%2);" ++ " mov $0, %%rax;" ++ " adox %%rdx, %%rax;" ++ " adcx %%r8, %%rax;" ++ " movq %%rax, 56(%2);" ++ + /* Line up pointers */ +- " mov %0, %1;" + " mov %2, %0;" ++ " mov %3, %2;" + + /* Wrap the result back into the field */ + + /* Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo */ + " mov $38, %%rdx;" +- " mulxq 32(%1), %%r8, %%r13;" +- " xor %k3, %k3;" +- " adoxq 0(%1), %%r8;" +- " mulxq 40(%1), %%r9, %%rbx;" ++ " mulxq 32(%0), %%r8, %%r13;" ++ " xor %k1, %k1;" ++ " adoxq 0(%0), %%r8;" ++ " mulxq 40(%0), %%r9, %%rbx;" + " adcx %%r13, %%r9;" +- " adoxq 8(%1), %%r9;" +- " mulxq 48(%1), %%r10, %%r13;" ++ " adoxq 8(%0), %%r9;" ++ " mulxq 48(%0), %%r10, %%r13;" + " adcx %%rbx, %%r10;" +- " adoxq 16(%1), %%r10;" +- " mulxq 56(%1), %%r11, %%rax;" ++ " adoxq 16(%0), %%r10;" ++ " mulxq 56(%0), %%r11, %%rax;" + " adcx %%r13, %%r11;" +- " adoxq 24(%1), %%r11;" +- " adcx %3, %%rax;" +- " adox %3, %%rax;" ++ " adoxq 24(%0), %%r11;" ++ " adcx %1, %%rax;" ++ " adox %1, %%rax;" + " imul %%rdx, %%rax;" + + /* Step 2: Fold the carry back into dst */ + " add %%rax, %%r8;" +- " adcx %3, %%r9;" +- " movq %%r9, 8(%0);" +- " adcx %3, %%r10;" +- " movq %%r10, 16(%0);" +- " adcx %3, %%r11;" +- " movq %%r11, 24(%0);" ++ " adcx %1, %%r9;" ++ " movq %%r9, 8(%2);" ++ " adcx %1, %%r10;" ++ " movq %%r10, 16(%2);" ++ " adcx %1, %%r11;" ++ " movq %%r11, 24(%2);" + + /* Step 3: Fold the carry bit back in; guaranteed not to carry at this point */ + " mov $0, %%rax;" + " cmovc %%rdx, %%rax;" + " add %%rax, %%r8;" +- " movq %%r8, 0(%0);" +- : "+&r" (tmp), "+&r" (f1), "+&r" (out), "+&r" (f2) +- : +- : "%rax", "%rdx", "%r8", "%r9", "%r10", "%r11", "%rbx", "%r13", "%r14", "memory", "cc" +- ); ++ " movq %%r8, 0(%2);" ++ : "+&r"(f1), "+&r"(f2), "+&r"(tmp) ++ : "r"(out) ++ : "%rax", "%rbx", "%rdx", "%r8", "%r9", "%r10", "%r11", "%r13", ++ "%r14", "memory", "cc"); + } + + /* Computes two field multiplications: +- * out[0] <- f1[0] * f2[0] +- * out[1] <- f1[1] * f2[1] +- * Uses the 16-element buffer tmp for intermediate results. */ ++ * out[0] <- f1[0] * f2[0] ++ * out[1] <- f1[1] * f2[1] ++ * Uses the 16-element buffer tmp for intermediate results: */ + static inline void fmul2(u64 *out, const u64 *f1, const u64 *f2, u64 *tmp) + { + asm volatile( ++ + /* Compute the raw multiplication tmp[0] <- f1[0] * f2[0] */ + + /* Compute src1[0] * src2 */ +- " movq 0(%1), %%rdx;" +- " mulxq 0(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " movq %%r8, 0(%0);" +- " mulxq 8(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " movq %%r10, 8(%0);" +- " mulxq 16(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" +- " mulxq 24(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " mov $0, %%rax;" +- " adox %%rdx, %%rax;" ++ " movq 0(%0), %%rdx;" ++ " mulxq 0(%1), %%r8, %%r9;" ++ " xor %%r10d, %%r10d;" ++ " movq %%r8, 0(%2);" ++ " mulxq 8(%1), %%r10, %%r11;" ++ " adox %%r9, %%r10;" ++ " movq %%r10, 8(%2);" ++ " mulxq 16(%1), %%rbx, %%r13;" ++ " adox %%r11, %%rbx;" ++ " mulxq 24(%1), %%r14, %%rdx;" ++ " adox %%r13, %%r14;" ++ " mov $0, %%rax;" ++ " adox %%rdx, %%rax;" ++ + /* Compute src1[1] * src2 */ +- " movq 8(%1), %%rdx;" +- " mulxq 0(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 8(%0), %%r8;" " movq %%r8, 8(%0);" +- " mulxq 8(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 16(%0);" +- " mulxq 16(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " mov $0, %%r8;" +- " mulxq 24(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " mov $0, %%rax;" +- " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" ++ " movq 8(%0), %%rdx;" ++ " mulxq 0(%1), %%r8, %%r9;" ++ " xor %%r10d, %%r10d;" ++ " adcxq 8(%2), %%r8;" ++ " movq %%r8, 8(%2);" ++ " mulxq 8(%1), %%r10, %%r11;" ++ " adox %%r9, %%r10;" ++ " adcx %%rbx, %%r10;" ++ " movq %%r10, 16(%2);" ++ " mulxq 16(%1), %%rbx, %%r13;" ++ " adox %%r11, %%rbx;" ++ " adcx %%r14, %%rbx;" ++ " mov $0, %%r8;" ++ " mulxq 24(%1), %%r14, %%rdx;" ++ " adox %%r13, %%r14;" ++ " adcx %%rax, %%r14;" ++ " mov $0, %%rax;" ++ " adox %%rdx, %%rax;" ++ " adcx %%r8, %%rax;" ++ + /* Compute src1[2] * src2 */ +- " movq 16(%1), %%rdx;" +- " mulxq 0(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 16(%0), %%r8;" " movq %%r8, 16(%0);" +- " mulxq 8(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 24(%0);" +- " mulxq 16(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " mov $0, %%r8;" +- " mulxq 24(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " mov $0, %%rax;" +- " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" ++ " movq 16(%0), %%rdx;" ++ " mulxq 0(%1), %%r8, %%r9;" ++ " xor %%r10d, %%r10d;" ++ " adcxq 16(%2), %%r8;" ++ " movq %%r8, 16(%2);" ++ " mulxq 8(%1), %%r10, %%r11;" ++ " adox %%r9, %%r10;" ++ " adcx %%rbx, %%r10;" ++ " movq %%r10, 24(%2);" ++ " mulxq 16(%1), %%rbx, %%r13;" ++ " adox %%r11, %%rbx;" ++ " adcx %%r14, %%rbx;" ++ " mov $0, %%r8;" ++ " mulxq 24(%1), %%r14, %%rdx;" ++ " adox %%r13, %%r14;" ++ " adcx %%rax, %%r14;" ++ " mov $0, %%rax;" ++ " adox %%rdx, %%rax;" ++ " adcx %%r8, %%rax;" ++ + /* Compute src1[3] * src2 */ +- " movq 24(%1), %%rdx;" +- " mulxq 0(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 24(%0), %%r8;" " movq %%r8, 24(%0);" +- " mulxq 8(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 32(%0);" +- " mulxq 16(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " movq %%rbx, 40(%0);" " mov $0, %%r8;" +- " mulxq 24(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " movq %%r14, 48(%0);" " mov $0, %%rax;" +- " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" " movq %%rax, 56(%0);" ++ " movq 24(%0), %%rdx;" ++ " mulxq 0(%1), %%r8, %%r9;" ++ " xor %%r10d, %%r10d;" ++ " adcxq 24(%2), %%r8;" ++ " movq %%r8, 24(%2);" ++ " mulxq 8(%1), %%r10, %%r11;" ++ " adox %%r9, %%r10;" ++ " adcx %%rbx, %%r10;" ++ " movq %%r10, 32(%2);" ++ " mulxq 16(%1), %%rbx, %%r13;" ++ " adox %%r11, %%rbx;" ++ " adcx %%r14, %%rbx;" ++ " movq %%rbx, 40(%2);" ++ " mov $0, %%r8;" ++ " mulxq 24(%1), %%r14, %%rdx;" ++ " adox %%r13, %%r14;" ++ " adcx %%rax, %%r14;" ++ " movq %%r14, 48(%2);" ++ " mov $0, %%rax;" ++ " adox %%rdx, %%rax;" ++ " adcx %%r8, %%rax;" ++ " movq %%rax, 56(%2);" + + /* Compute the raw multiplication tmp[1] <- f1[1] * f2[1] */ + + /* Compute src1[0] * src2 */ +- " movq 32(%1), %%rdx;" +- " mulxq 32(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " movq %%r8, 64(%0);" +- " mulxq 40(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " movq %%r10, 72(%0);" +- " mulxq 48(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" +- " mulxq 56(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " mov $0, %%rax;" +- " adox %%rdx, %%rax;" ++ " movq 32(%0), %%rdx;" ++ " mulxq 32(%1), %%r8, %%r9;" ++ " xor %%r10d, %%r10d;" ++ " movq %%r8, 64(%2);" ++ " mulxq 40(%1), %%r10, %%r11;" ++ " adox %%r9, %%r10;" ++ " movq %%r10, 72(%2);" ++ " mulxq 48(%1), %%rbx, %%r13;" ++ " adox %%r11, %%rbx;" ++ " mulxq 56(%1), %%r14, %%rdx;" ++ " adox %%r13, %%r14;" ++ " mov $0, %%rax;" ++ " adox %%rdx, %%rax;" ++ + /* Compute src1[1] * src2 */ +- " movq 40(%1), %%rdx;" +- " mulxq 32(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 72(%0), %%r8;" " movq %%r8, 72(%0);" +- " mulxq 40(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 80(%0);" +- " mulxq 48(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " mov $0, %%r8;" +- " mulxq 56(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " mov $0, %%rax;" +- " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" ++ " movq 40(%0), %%rdx;" ++ " mulxq 32(%1), %%r8, %%r9;" ++ " xor %%r10d, %%r10d;" ++ " adcxq 72(%2), %%r8;" ++ " movq %%r8, 72(%2);" ++ " mulxq 40(%1), %%r10, %%r11;" ++ " adox %%r9, %%r10;" ++ " adcx %%rbx, %%r10;" ++ " movq %%r10, 80(%2);" ++ " mulxq 48(%1), %%rbx, %%r13;" ++ " adox %%r11, %%rbx;" ++ " adcx %%r14, %%rbx;" ++ " mov $0, %%r8;" ++ " mulxq 56(%1), %%r14, %%rdx;" ++ " adox %%r13, %%r14;" ++ " adcx %%rax, %%r14;" ++ " mov $0, %%rax;" ++ " adox %%rdx, %%rax;" ++ " adcx %%r8, %%rax;" ++ + /* Compute src1[2] * src2 */ +- " movq 48(%1), %%rdx;" +- " mulxq 32(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 80(%0), %%r8;" " movq %%r8, 80(%0);" +- " mulxq 40(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 88(%0);" +- " mulxq 48(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " mov $0, %%r8;" +- " mulxq 56(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " mov $0, %%rax;" +- " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" ++ " movq 48(%0), %%rdx;" ++ " mulxq 32(%1), %%r8, %%r9;" ++ " xor %%r10d, %%r10d;" ++ " adcxq 80(%2), %%r8;" ++ " movq %%r8, 80(%2);" ++ " mulxq 40(%1), %%r10, %%r11;" ++ " adox %%r9, %%r10;" ++ " adcx %%rbx, %%r10;" ++ " movq %%r10, 88(%2);" ++ " mulxq 48(%1), %%rbx, %%r13;" ++ " adox %%r11, %%rbx;" ++ " adcx %%r14, %%rbx;" ++ " mov $0, %%r8;" ++ " mulxq 56(%1), %%r14, %%rdx;" ++ " adox %%r13, %%r14;" ++ " adcx %%rax, %%r14;" ++ " mov $0, %%rax;" ++ " adox %%rdx, %%rax;" ++ " adcx %%r8, %%rax;" ++ + /* Compute src1[3] * src2 */ +- " movq 56(%1), %%rdx;" +- " mulxq 32(%3), %%r8, %%r9;" " xor %%r10d, %%r10d;" " adcxq 88(%0), %%r8;" " movq %%r8, 88(%0);" +- " mulxq 40(%3), %%r10, %%r11;" " adox %%r9, %%r10;" " adcx %%rbx, %%r10;" " movq %%r10, 96(%0);" +- " mulxq 48(%3), %%rbx, %%r13;" " adox %%r11, %%rbx;" " adcx %%r14, %%rbx;" " movq %%rbx, 104(%0);" " mov $0, %%r8;" +- " mulxq 56(%3), %%r14, %%rdx;" " adox %%r13, %%r14;" " adcx %%rax, %%r14;" " movq %%r14, 112(%0);" " mov $0, %%rax;" +- " adox %%rdx, %%rax;" " adcx %%r8, %%rax;" " movq %%rax, 120(%0);" ++ " movq 56(%0), %%rdx;" ++ " mulxq 32(%1), %%r8, %%r9;" ++ " xor %%r10d, %%r10d;" ++ " adcxq 88(%2), %%r8;" ++ " movq %%r8, 88(%2);" ++ " mulxq 40(%1), %%r10, %%r11;" ++ " adox %%r9, %%r10;" ++ " adcx %%rbx, %%r10;" ++ " movq %%r10, 96(%2);" ++ " mulxq 48(%1), %%rbx, %%r13;" ++ " adox %%r11, %%rbx;" ++ " adcx %%r14, %%rbx;" ++ " movq %%rbx, 104(%2);" ++ " mov $0, %%r8;" ++ " mulxq 56(%1), %%r14, %%rdx;" ++ " adox %%r13, %%r14;" ++ " adcx %%rax, %%r14;" ++ " movq %%r14, 112(%2);" ++ " mov $0, %%rax;" ++ " adox %%rdx, %%rax;" ++ " adcx %%r8, %%rax;" ++ " movq %%rax, 120(%2);" ++ + /* Line up pointers */ +- " mov %0, %1;" + " mov %2, %0;" ++ " mov %3, %2;" + + /* Wrap the results back into the field */ + + /* Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo */ + " mov $38, %%rdx;" +- " mulxq 32(%1), %%r8, %%r13;" +- " xor %k3, %k3;" +- " adoxq 0(%1), %%r8;" +- " mulxq 40(%1), %%r9, %%rbx;" ++ " mulxq 32(%0), %%r8, %%r13;" ++ " xor %k1, %k1;" ++ " adoxq 0(%0), %%r8;" ++ " mulxq 40(%0), %%r9, %%rbx;" + " adcx %%r13, %%r9;" +- " adoxq 8(%1), %%r9;" +- " mulxq 48(%1), %%r10, %%r13;" ++ " adoxq 8(%0), %%r9;" ++ " mulxq 48(%0), %%r10, %%r13;" + " adcx %%rbx, %%r10;" +- " adoxq 16(%1), %%r10;" +- " mulxq 56(%1), %%r11, %%rax;" ++ " adoxq 16(%0), %%r10;" ++ " mulxq 56(%0), %%r11, %%rax;" + " adcx %%r13, %%r11;" +- " adoxq 24(%1), %%r11;" +- " adcx %3, %%rax;" +- " adox %3, %%rax;" ++ " adoxq 24(%0), %%r11;" ++ " adcx %1, %%rax;" ++ " adox %1, %%rax;" + " imul %%rdx, %%rax;" + + /* Step 2: Fold the carry back into dst */ + " add %%rax, %%r8;" +- " adcx %3, %%r9;" +- " movq %%r9, 8(%0);" +- " adcx %3, %%r10;" +- " movq %%r10, 16(%0);" +- " adcx %3, %%r11;" +- " movq %%r11, 24(%0);" ++ " adcx %1, %%r9;" ++ " movq %%r9, 8(%2);" ++ " adcx %1, %%r10;" ++ " movq %%r10, 16(%2);" ++ " adcx %1, %%r11;" ++ " movq %%r11, 24(%2);" + + /* Step 3: Fold the carry bit back in; guaranteed not to carry at this point */ + " mov $0, %%rax;" + " cmovc %%rdx, %%rax;" + " add %%rax, %%r8;" +- " movq %%r8, 0(%0);" ++ " movq %%r8, 0(%2);" + + /* Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo */ + " mov $38, %%rdx;" +- " mulxq 96(%1), %%r8, %%r13;" +- " xor %k3, %k3;" +- " adoxq 64(%1), %%r8;" +- " mulxq 104(%1), %%r9, %%rbx;" ++ " mulxq 96(%0), %%r8, %%r13;" ++ " xor %k1, %k1;" ++ " adoxq 64(%0), %%r8;" ++ " mulxq 104(%0), %%r9, %%rbx;" + " adcx %%r13, %%r9;" +- " adoxq 72(%1), %%r9;" +- " mulxq 112(%1), %%r10, %%r13;" ++ " adoxq 72(%0), %%r9;" ++ " mulxq 112(%0), %%r10, %%r13;" + " adcx %%rbx, %%r10;" +- " adoxq 80(%1), %%r10;" +- " mulxq 120(%1), %%r11, %%rax;" ++ " adoxq 80(%0), %%r10;" ++ " mulxq 120(%0), %%r11, %%rax;" + " adcx %%r13, %%r11;" +- " adoxq 88(%1), %%r11;" +- " adcx %3, %%rax;" +- " adox %3, %%rax;" ++ " adoxq 88(%0), %%r11;" ++ " adcx %1, %%rax;" ++ " adox %1, %%rax;" + " imul %%rdx, %%rax;" + + /* Step 2: Fold the carry back into dst */ + " add %%rax, %%r8;" +- " adcx %3, %%r9;" +- " movq %%r9, 40(%0);" +- " adcx %3, %%r10;" +- " movq %%r10, 48(%0);" +- " adcx %3, %%r11;" +- " movq %%r11, 56(%0);" ++ " adcx %1, %%r9;" ++ " movq %%r9, 40(%2);" ++ " adcx %1, %%r10;" ++ " movq %%r10, 48(%2);" ++ " adcx %1, %%r11;" ++ " movq %%r11, 56(%2);" + + /* Step 3: Fold the carry bit back in; guaranteed not to carry at this point */ + " mov $0, %%rax;" + " cmovc %%rdx, %%rax;" + " add %%rax, %%r8;" +- " movq %%r8, 32(%0);" +- : "+&r" (tmp), "+&r" (f1), "+&r" (out), "+&r" (f2) +- : +- : "%rax", "%rdx", "%r8", "%r9", "%r10", "%r11", "%rbx", "%r13", "%r14", "memory", "cc" +- ); ++ " movq %%r8, 32(%2);" ++ : "+&r"(f1), "+&r"(f2), "+&r"(tmp) ++ : "r"(out) ++ : "%rax", "%rbx", "%rdx", "%r8", "%r9", "%r10", "%r11", "%r13", ++ "%r14", "memory", "cc"); + } + +-/* Computes the field multiplication of four-element f1 with value in f2 */ ++/* Computes the field multiplication of four-element f1 with value in f2 ++ * Requires f2 to be smaller than 2^17 */ + static inline void fmul_scalar(u64 *out, const u64 *f1, u64 f2) + { + register u64 f2_r asm("rdx") = f2; + + asm volatile( + /* Compute the raw multiplication of f1*f2 */ +- " mulxq 0(%2), %%r8, %%rcx;" /* f1[0]*f2 */ +- " mulxq 8(%2), %%r9, %%rbx;" /* f1[1]*f2 */ ++ " mulxq 0(%2), %%r8, %%rcx;" /* f1[0]*f2 */ ++ " mulxq 8(%2), %%r9, %%rbx;" /* f1[1]*f2 */ + " add %%rcx, %%r9;" + " mov $0, %%rcx;" +- " mulxq 16(%2), %%r10, %%r13;" /* f1[2]*f2 */ ++ " mulxq 16(%2), %%r10, %%r13;" /* f1[2]*f2 */ + " adcx %%rbx, %%r10;" +- " mulxq 24(%2), %%r11, %%rax;" /* f1[3]*f2 */ ++ " mulxq 24(%2), %%r11, %%rax;" /* f1[3]*f2 */ + " adcx %%r13, %%r11;" + " adcx %%rcx, %%rax;" + +@@ -417,17 +576,17 @@ static inline void fmul_scalar(u64 *out, const u64 *f1, u64 f2) + " cmovc %%rdx, %%rax;" + " add %%rax, %%r8;" + " movq %%r8, 0(%1);" +- : "+&r" (f2_r) +- : "r" (out), "r" (f1) +- : "%rax", "%rcx", "%r8", "%r9", "%r10", "%r11", "%rbx", "%r13", "memory", "cc" +- ); ++ : "+&r"(f2_r) ++ : "r"(out), "r"(f1) ++ : "%rax", "%rbx", "%rcx", "%r8", "%r9", "%r10", "%r11", "%r13", ++ "memory", "cc"); + } + + /* Computes p1 <- bit ? p2 : p1 in constant time */ + static inline void cswap2(u64 bit, const u64 *p1, const u64 *p2) + { + asm volatile( +- /* Invert the polarity of bit to match cmov expectations */ ++ /* Transfer bit into CF flag */ + " add $18446744073709551615, %0;" + + /* cswap p1[0], p2[0] */ +@@ -501,10 +660,9 @@ static inline void cswap2(u64 bit, const u64 *p1, const u64 *p2) + " cmovc %%r10, %%r9;" + " movq %%r8, 56(%1);" + " movq %%r9, 56(%2);" +- : "+&r" (bit) +- : "r" (p1), "r" (p2) +- : "%r8", "%r9", "%r10", "memory", "cc" +- ); ++ : "+&r"(bit) ++ : "r"(p1), "r"(p2) ++ : "%r8", "%r9", "%r10", "memory", "cc"); + } + + /* Computes the square of a field element: out <- f * f +@@ -515,15 +673,22 @@ static inline void fsqr(u64 *out, const u64 *f, u64 *tmp) + /* Compute the raw multiplication: tmp <- f * f */ + + /* Step 1: Compute all partial products */ +- " movq 0(%1), %%rdx;" /* f[0] */ +- " mulxq 8(%1), %%r8, %%r14;" " xor %%r15d, %%r15d;" /* f[1]*f[0] */ +- " mulxq 16(%1), %%r9, %%r10;" " adcx %%r14, %%r9;" /* f[2]*f[0] */ +- " mulxq 24(%1), %%rax, %%rcx;" " adcx %%rax, %%r10;" /* f[3]*f[0] */ +- " movq 24(%1), %%rdx;" /* f[3] */ +- " mulxq 8(%1), %%r11, %%rbx;" " adcx %%rcx, %%r11;" /* f[1]*f[3] */ +- " mulxq 16(%1), %%rax, %%r13;" " adcx %%rax, %%rbx;" /* f[2]*f[3] */ +- " movq 8(%1), %%rdx;" " adcx %%r15, %%r13;" /* f1 */ +- " mulxq 16(%1), %%rax, %%rcx;" " mov $0, %%r14;" /* f[2]*f[1] */ ++ " movq 0(%0), %%rdx;" /* f[0] */ ++ " mulxq 8(%0), %%r8, %%r14;" ++ " xor %%r15d, %%r15d;" /* f[1]*f[0] */ ++ " mulxq 16(%0), %%r9, %%r10;" ++ " adcx %%r14, %%r9;" /* f[2]*f[0] */ ++ " mulxq 24(%0), %%rax, %%rcx;" ++ " adcx %%rax, %%r10;" /* f[3]*f[0] */ ++ " movq 24(%0), %%rdx;" /* f[3] */ ++ " mulxq 8(%0), %%r11, %%rbx;" ++ " adcx %%rcx, %%r11;" /* f[1]*f[3] */ ++ " mulxq 16(%0), %%rax, %%r13;" ++ " adcx %%rax, %%rbx;" /* f[2]*f[3] */ ++ " movq 8(%0), %%rdx;" ++ " adcx %%r15, %%r13;" /* f1 */ ++ " mulxq 16(%0), %%rax, %%rcx;" ++ " mov $0, %%r14;" /* f[2]*f[1] */ + + /* Step 2: Compute two parallel carry chains */ + " xor %%r15d, %%r15d;" +@@ -541,39 +706,50 @@ static inline void fsqr(u64 *out, const u64 *f, u64 *tmp) + " adcx %%r14, %%r14;" + + /* Step 3: Compute intermediate squares */ +- " movq 0(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[0]^2 */ +- " movq %%rax, 0(%0);" +- " add %%rcx, %%r8;" " movq %%r8, 8(%0);" +- " movq 8(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[1]^2 */ +- " adcx %%rax, %%r9;" " movq %%r9, 16(%0);" +- " adcx %%rcx, %%r10;" " movq %%r10, 24(%0);" +- " movq 16(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[2]^2 */ +- " adcx %%rax, %%r11;" " movq %%r11, 32(%0);" +- " adcx %%rcx, %%rbx;" " movq %%rbx, 40(%0);" +- " movq 24(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[3]^2 */ +- " adcx %%rax, %%r13;" " movq %%r13, 48(%0);" +- " adcx %%rcx, %%r14;" " movq %%r14, 56(%0);" ++ " movq 0(%0), %%rdx;" ++ " mulx %%rdx, %%rax, %%rcx;" /* f[0]^2 */ ++ " movq %%rax, 0(%1);" ++ " add %%rcx, %%r8;" ++ " movq %%r8, 8(%1);" ++ " movq 8(%0), %%rdx;" ++ " mulx %%rdx, %%rax, %%rcx;" /* f[1]^2 */ ++ " adcx %%rax, %%r9;" ++ " movq %%r9, 16(%1);" ++ " adcx %%rcx, %%r10;" ++ " movq %%r10, 24(%1);" ++ " movq 16(%0), %%rdx;" ++ " mulx %%rdx, %%rax, %%rcx;" /* f[2]^2 */ ++ " adcx %%rax, %%r11;" ++ " movq %%r11, 32(%1);" ++ " adcx %%rcx, %%rbx;" ++ " movq %%rbx, 40(%1);" ++ " movq 24(%0), %%rdx;" ++ " mulx %%rdx, %%rax, %%rcx;" /* f[3]^2 */ ++ " adcx %%rax, %%r13;" ++ " movq %%r13, 48(%1);" ++ " adcx %%rcx, %%r14;" ++ " movq %%r14, 56(%1);" + + /* Line up pointers */ +- " mov %0, %1;" +- " mov %2, %0;" ++ " mov %1, %0;" ++ " mov %2, %1;" + + /* Wrap the result back into the field */ + + /* Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo */ + " mov $38, %%rdx;" +- " mulxq 32(%1), %%r8, %%r13;" ++ " mulxq 32(%0), %%r8, %%r13;" + " xor %%ecx, %%ecx;" +- " adoxq 0(%1), %%r8;" +- " mulxq 40(%1), %%r9, %%rbx;" ++ " adoxq 0(%0), %%r8;" ++ " mulxq 40(%0), %%r9, %%rbx;" + " adcx %%r13, %%r9;" +- " adoxq 8(%1), %%r9;" +- " mulxq 48(%1), %%r10, %%r13;" ++ " adoxq 8(%0), %%r9;" ++ " mulxq 48(%0), %%r10, %%r13;" + " adcx %%rbx, %%r10;" +- " adoxq 16(%1), %%r10;" +- " mulxq 56(%1), %%r11, %%rax;" ++ " adoxq 16(%0), %%r10;" ++ " mulxq 56(%0), %%r11, %%rax;" + " adcx %%r13, %%r11;" +- " adoxq 24(%1), %%r11;" ++ " adoxq 24(%0), %%r11;" + " adcx %%rcx, %%rax;" + " adox %%rcx, %%rax;" + " imul %%rdx, %%rax;" +@@ -581,40 +757,47 @@ static inline void fsqr(u64 *out, const u64 *f, u64 *tmp) + /* Step 2: Fold the carry back into dst */ + " add %%rax, %%r8;" + " adcx %%rcx, %%r9;" +- " movq %%r9, 8(%0);" ++ " movq %%r9, 8(%1);" + " adcx %%rcx, %%r10;" +- " movq %%r10, 16(%0);" ++ " movq %%r10, 16(%1);" + " adcx %%rcx, %%r11;" +- " movq %%r11, 24(%0);" ++ " movq %%r11, 24(%1);" + + /* Step 3: Fold the carry bit back in; guaranteed not to carry at this point */ + " mov $0, %%rax;" + " cmovc %%rdx, %%rax;" + " add %%rax, %%r8;" +- " movq %%r8, 0(%0);" +- : "+&r" (tmp), "+&r" (f), "+&r" (out) +- : +- : "%rax", "%rcx", "%rdx", "%r8", "%r9", "%r10", "%r11", "%rbx", "%r13", "%r14", "%r15", "memory", "cc" +- ); ++ " movq %%r8, 0(%1);" ++ : "+&r"(f), "+&r"(tmp) ++ : "r"(out) ++ : "%rax", "%rbx", "%rcx", "%rdx", "%r8", "%r9", "%r10", "%r11", ++ "%r13", "%r14", "%r15", "memory", "cc"); + } + + /* Computes two field squarings: +- * out[0] <- f[0] * f[0] +- * out[1] <- f[1] * f[1] ++ * out[0] <- f[0] * f[0] ++ * out[1] <- f[1] * f[1] + * Uses the 16-element buffer tmp for intermediate results */ + static inline void fsqr2(u64 *out, const u64 *f, u64 *tmp) + { + asm volatile( + /* Step 1: Compute all partial products */ +- " movq 0(%1), %%rdx;" /* f[0] */ +- " mulxq 8(%1), %%r8, %%r14;" " xor %%r15d, %%r15d;" /* f[1]*f[0] */ +- " mulxq 16(%1), %%r9, %%r10;" " adcx %%r14, %%r9;" /* f[2]*f[0] */ +- " mulxq 24(%1), %%rax, %%rcx;" " adcx %%rax, %%r10;" /* f[3]*f[0] */ +- " movq 24(%1), %%rdx;" /* f[3] */ +- " mulxq 8(%1), %%r11, %%rbx;" " adcx %%rcx, %%r11;" /* f[1]*f[3] */ +- " mulxq 16(%1), %%rax, %%r13;" " adcx %%rax, %%rbx;" /* f[2]*f[3] */ +- " movq 8(%1), %%rdx;" " adcx %%r15, %%r13;" /* f1 */ +- " mulxq 16(%1), %%rax, %%rcx;" " mov $0, %%r14;" /* f[2]*f[1] */ ++ " movq 0(%0), %%rdx;" /* f[0] */ ++ " mulxq 8(%0), %%r8, %%r14;" ++ " xor %%r15d, %%r15d;" /* f[1]*f[0] */ ++ " mulxq 16(%0), %%r9, %%r10;" ++ " adcx %%r14, %%r9;" /* f[2]*f[0] */ ++ " mulxq 24(%0), %%rax, %%rcx;" ++ " adcx %%rax, %%r10;" /* f[3]*f[0] */ ++ " movq 24(%0), %%rdx;" /* f[3] */ ++ " mulxq 8(%0), %%r11, %%rbx;" ++ " adcx %%rcx, %%r11;" /* f[1]*f[3] */ ++ " mulxq 16(%0), %%rax, %%r13;" ++ " adcx %%rax, %%rbx;" /* f[2]*f[3] */ ++ " movq 8(%0), %%rdx;" ++ " adcx %%r15, %%r13;" /* f1 */ ++ " mulxq 16(%0), %%rax, %%rcx;" ++ " mov $0, %%r14;" /* f[2]*f[1] */ + + /* Step 2: Compute two parallel carry chains */ + " xor %%r15d, %%r15d;" +@@ -632,29 +815,47 @@ static inline void fsqr2(u64 *out, const u64 *f, u64 *tmp) + " adcx %%r14, %%r14;" + + /* Step 3: Compute intermediate squares */ +- " movq 0(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[0]^2 */ +- " movq %%rax, 0(%0);" +- " add %%rcx, %%r8;" " movq %%r8, 8(%0);" +- " movq 8(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[1]^2 */ +- " adcx %%rax, %%r9;" " movq %%r9, 16(%0);" +- " adcx %%rcx, %%r10;" " movq %%r10, 24(%0);" +- " movq 16(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[2]^2 */ +- " adcx %%rax, %%r11;" " movq %%r11, 32(%0);" +- " adcx %%rcx, %%rbx;" " movq %%rbx, 40(%0);" +- " movq 24(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[3]^2 */ +- " adcx %%rax, %%r13;" " movq %%r13, 48(%0);" +- " adcx %%rcx, %%r14;" " movq %%r14, 56(%0);" ++ " movq 0(%0), %%rdx;" ++ " mulx %%rdx, %%rax, %%rcx;" /* f[0]^2 */ ++ " movq %%rax, 0(%1);" ++ " add %%rcx, %%r8;" ++ " movq %%r8, 8(%1);" ++ " movq 8(%0), %%rdx;" ++ " mulx %%rdx, %%rax, %%rcx;" /* f[1]^2 */ ++ " adcx %%rax, %%r9;" ++ " movq %%r9, 16(%1);" ++ " adcx %%rcx, %%r10;" ++ " movq %%r10, 24(%1);" ++ " movq 16(%0), %%rdx;" ++ " mulx %%rdx, %%rax, %%rcx;" /* f[2]^2 */ ++ " adcx %%rax, %%r11;" ++ " movq %%r11, 32(%1);" ++ " adcx %%rcx, %%rbx;" ++ " movq %%rbx, 40(%1);" ++ " movq 24(%0), %%rdx;" ++ " mulx %%rdx, %%rax, %%rcx;" /* f[3]^2 */ ++ " adcx %%rax, %%r13;" ++ " movq %%r13, 48(%1);" ++ " adcx %%rcx, %%r14;" ++ " movq %%r14, 56(%1);" + + /* Step 1: Compute all partial products */ +- " movq 32(%1), %%rdx;" /* f[0] */ +- " mulxq 40(%1), %%r8, %%r14;" " xor %%r15d, %%r15d;" /* f[1]*f[0] */ +- " mulxq 48(%1), %%r9, %%r10;" " adcx %%r14, %%r9;" /* f[2]*f[0] */ +- " mulxq 56(%1), %%rax, %%rcx;" " adcx %%rax, %%r10;" /* f[3]*f[0] */ +- " movq 56(%1), %%rdx;" /* f[3] */ +- " mulxq 40(%1), %%r11, %%rbx;" " adcx %%rcx, %%r11;" /* f[1]*f[3] */ +- " mulxq 48(%1), %%rax, %%r13;" " adcx %%rax, %%rbx;" /* f[2]*f[3] */ +- " movq 40(%1), %%rdx;" " adcx %%r15, %%r13;" /* f1 */ +- " mulxq 48(%1), %%rax, %%rcx;" " mov $0, %%r14;" /* f[2]*f[1] */ ++ " movq 32(%0), %%rdx;" /* f[0] */ ++ " mulxq 40(%0), %%r8, %%r14;" ++ " xor %%r15d, %%r15d;" /* f[1]*f[0] */ ++ " mulxq 48(%0), %%r9, %%r10;" ++ " adcx %%r14, %%r9;" /* f[2]*f[0] */ ++ " mulxq 56(%0), %%rax, %%rcx;" ++ " adcx %%rax, %%r10;" /* f[3]*f[0] */ ++ " movq 56(%0), %%rdx;" /* f[3] */ ++ " mulxq 40(%0), %%r11, %%rbx;" ++ " adcx %%rcx, %%r11;" /* f[1]*f[3] */ ++ " mulxq 48(%0), %%rax, %%r13;" ++ " adcx %%rax, %%rbx;" /* f[2]*f[3] */ ++ " movq 40(%0), %%rdx;" ++ " adcx %%r15, %%r13;" /* f1 */ ++ " mulxq 48(%0), %%rax, %%rcx;" ++ " mov $0, %%r14;" /* f[2]*f[1] */ + + /* Step 2: Compute two parallel carry chains */ + " xor %%r15d, %%r15d;" +@@ -672,37 +873,48 @@ static inline void fsqr2(u64 *out, const u64 *f, u64 *tmp) + " adcx %%r14, %%r14;" + + /* Step 3: Compute intermediate squares */ +- " movq 32(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[0]^2 */ +- " movq %%rax, 64(%0);" +- " add %%rcx, %%r8;" " movq %%r8, 72(%0);" +- " movq 40(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[1]^2 */ +- " adcx %%rax, %%r9;" " movq %%r9, 80(%0);" +- " adcx %%rcx, %%r10;" " movq %%r10, 88(%0);" +- " movq 48(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[2]^2 */ +- " adcx %%rax, %%r11;" " movq %%r11, 96(%0);" +- " adcx %%rcx, %%rbx;" " movq %%rbx, 104(%0);" +- " movq 56(%1), %%rdx;" " mulx %%rdx, %%rax, %%rcx;" /* f[3]^2 */ +- " adcx %%rax, %%r13;" " movq %%r13, 112(%0);" +- " adcx %%rcx, %%r14;" " movq %%r14, 120(%0);" ++ " movq 32(%0), %%rdx;" ++ " mulx %%rdx, %%rax, %%rcx;" /* f[0]^2 */ ++ " movq %%rax, 64(%1);" ++ " add %%rcx, %%r8;" ++ " movq %%r8, 72(%1);" ++ " movq 40(%0), %%rdx;" ++ " mulx %%rdx, %%rax, %%rcx;" /* f[1]^2 */ ++ " adcx %%rax, %%r9;" ++ " movq %%r9, 80(%1);" ++ " adcx %%rcx, %%r10;" ++ " movq %%r10, 88(%1);" ++ " movq 48(%0), %%rdx;" ++ " mulx %%rdx, %%rax, %%rcx;" /* f[2]^2 */ ++ " adcx %%rax, %%r11;" ++ " movq %%r11, 96(%1);" ++ " adcx %%rcx, %%rbx;" ++ " movq %%rbx, 104(%1);" ++ " movq 56(%0), %%rdx;" ++ " mulx %%rdx, %%rax, %%rcx;" /* f[3]^2 */ ++ " adcx %%rax, %%r13;" ++ " movq %%r13, 112(%1);" ++ " adcx %%rcx, %%r14;" ++ " movq %%r14, 120(%1);" + + /* Line up pointers */ +- " mov %0, %1;" +- " mov %2, %0;" ++ " mov %1, %0;" ++ " mov %2, %1;" + + /* Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo */ + " mov $38, %%rdx;" +- " mulxq 32(%1), %%r8, %%r13;" ++ " mulxq 32(%0), %%r8, %%r13;" + " xor %%ecx, %%ecx;" +- " adoxq 0(%1), %%r8;" +- " mulxq 40(%1), %%r9, %%rbx;" ++ " adoxq 0(%0), %%r8;" ++ " mulxq 40(%0), %%r9, %%rbx;" + " adcx %%r13, %%r9;" +- " adoxq 8(%1), %%r9;" +- " mulxq 48(%1), %%r10, %%r13;" ++ " adoxq 8(%0), %%r9;" ++ " mulxq 48(%0), %%r10, %%r13;" + " adcx %%rbx, %%r10;" +- " adoxq 16(%1), %%r10;" +- " mulxq 56(%1), %%r11, %%rax;" ++ " adoxq 16(%0), %%r10;" ++ " mulxq 56(%0), %%r11, %%rax;" + " adcx %%r13, %%r11;" +- " adoxq 24(%1), %%r11;" ++ " adoxq 24(%0), %%r11;" + " adcx %%rcx, %%rax;" + " adox %%rcx, %%rax;" + " imul %%rdx, %%rax;" +@@ -710,32 +922,32 @@ static inline void fsqr2(u64 *out, const u64 *f, u64 *tmp) + /* Step 2: Fold the carry back into dst */ + " add %%rax, %%r8;" + " adcx %%rcx, %%r9;" +- " movq %%r9, 8(%0);" ++ " movq %%r9, 8(%1);" + " adcx %%rcx, %%r10;" +- " movq %%r10, 16(%0);" ++ " movq %%r10, 16(%1);" + " adcx %%rcx, %%r11;" +- " movq %%r11, 24(%0);" ++ " movq %%r11, 24(%1);" + + /* Step 3: Fold the carry bit back in; guaranteed not to carry at this point */ + " mov $0, %%rax;" + " cmovc %%rdx, %%rax;" + " add %%rax, %%r8;" +- " movq %%r8, 0(%0);" ++ " movq %%r8, 0(%1);" + + /* Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo */ + " mov $38, %%rdx;" +- " mulxq 96(%1), %%r8, %%r13;" ++ " mulxq 96(%0), %%r8, %%r13;" + " xor %%ecx, %%ecx;" +- " adoxq 64(%1), %%r8;" +- " mulxq 104(%1), %%r9, %%rbx;" ++ " adoxq 64(%0), %%r8;" ++ " mulxq 104(%0), %%r9, %%rbx;" + " adcx %%r13, %%r9;" +- " adoxq 72(%1), %%r9;" +- " mulxq 112(%1), %%r10, %%r13;" ++ " adoxq 72(%0), %%r9;" ++ " mulxq 112(%0), %%r10, %%r13;" + " adcx %%rbx, %%r10;" +- " adoxq 80(%1), %%r10;" +- " mulxq 120(%1), %%r11, %%rax;" ++ " adoxq 80(%0), %%r10;" ++ " mulxq 120(%0), %%r11, %%rax;" + " adcx %%r13, %%r11;" +- " adoxq 88(%1), %%r11;" ++ " adoxq 88(%0), %%r11;" + " adcx %%rcx, %%rax;" + " adox %%rcx, %%rax;" + " imul %%rdx, %%rax;" +@@ -743,21 +955,21 @@ static inline void fsqr2(u64 *out, const u64 *f, u64 *tmp) + /* Step 2: Fold the carry back into dst */ + " add %%rax, %%r8;" + " adcx %%rcx, %%r9;" +- " movq %%r9, 40(%0);" ++ " movq %%r9, 40(%1);" + " adcx %%rcx, %%r10;" +- " movq %%r10, 48(%0);" ++ " movq %%r10, 48(%1);" + " adcx %%rcx, %%r11;" +- " movq %%r11, 56(%0);" ++ " movq %%r11, 56(%1);" + + /* Step 3: Fold the carry bit back in; guaranteed not to carry at this point */ + " mov $0, %%rax;" + " cmovc %%rdx, %%rax;" + " add %%rax, %%r8;" +- " movq %%r8, 32(%0);" +- : "+&r" (tmp), "+&r" (f), "+&r" (out) +- : +- : "%rax", "%rcx", "%rdx", "%r8", "%r9", "%r10", "%r11", "%rbx", "%r13", "%r14", "%r15", "memory", "cc" +- ); ++ " movq %%r8, 32(%1);" ++ : "+&r"(f), "+&r"(tmp) ++ : "r"(out) ++ : "%rax", "%rbx", "%rcx", "%rdx", "%r8", "%r9", "%r10", "%r11", ++ "%r13", "%r14", "%r15", "memory", "cc"); + } + + static void point_add_and_double(u64 *q, u64 *p01_tmp1, u64 *tmp2) +-- +2.18.4 + diff --git a/SPECS/kernel.spec b/SPECS/kernel.spec index f4272ce..9e9bb1a 100644 --- a/SPECS/kernel.spec +++ b/SPECS/kernel.spec @@ -89,7 +89,7 @@ Summary: The Linux kernel %if 0%{?released_kernel} # Do we have a -stable update to apply? -%define stable_update 158 +%define stable_update 179 # Set rpm version accordingly %if 0%{?stable_update} %define stablerev %{stable_update} @@ -3009,6 +3009,9 @@ fi # # %changelog +* Sat Feb 12 2022 Pablo Greco - 5.4.179-200 +- Update to version v5.4.179 + * Sat Nov 6 2021 Pablo Greco - 5.4.158-200 - Update to version v5.4.158