From f5474829b99c5de712b2ed8b0539360edfc89183 Mon Sep 17 00:00:00 2001 From: Salvatore Bonaccorso Date: Fri, 5 Jan 2018 10:24:18 +0100 Subject: [PATCH] Update to 4.14.8 --- debian/changelog | 5 +- ...ire-that-the-underlying-hash-algorit.patch | 151 ------------------ ...salsa20-fix-blkcipher_walk-API-usage.patch | 91 ----------- ...nt-malicious-bnuminterfaces-overflow.patch | 44 ----- debian/patches/series | 3 - 5 files changed, 4 insertions(+), 290 deletions(-) delete mode 100644 debian/patches/bugfix/all/crypto-hmac-require-that-the-underlying-hash-algorit.patch delete mode 100644 debian/patches/bugfix/all/crypto-salsa20-fix-blkcipher_walk-API-usage.patch delete mode 100644 debian/patches/bugfix/all/usb-core-prevent-malicious-bnuminterfaces-overflow.patch diff --git a/debian/changelog b/debian/changelog index 6ef9cd959..718d5ac9c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,7 @@ -linux (4.14.7-2) UNRELEASED; urgency=medium +linux (4.14.8-1) UNRELEASED; urgency=medium + + * New upstream stable update: + https://www.kernel.org/pub/linux/kernel/v4.x/ChangeLog-4.14.8 [ Ben Hutchings ] * e1000e: Fix e1000_check_for_copper_link_ich8lan return value. diff --git a/debian/patches/bugfix/all/crypto-hmac-require-that-the-underlying-hash-algorit.patch b/debian/patches/bugfix/all/crypto-hmac-require-that-the-underlying-hash-algorit.patch deleted file mode 100644 index 44c4b4f43..000000000 --- a/debian/patches/bugfix/all/crypto-hmac-require-that-the-underlying-hash-algorit.patch +++ /dev/null @@ -1,151 +0,0 @@ -From: Eric Biggers -Date: Tue, 28 Nov 2017 18:01:38 -0800 -Subject: crypto: hmac - require that the underlying hash algorithm is unkeyed -Origin: https://git.kernel.org/linus/af3ff8045bbf3e32f1a448542e73abb4c8ceb6f1 -Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2017-17806 - -Because the HMAC template didn't check that its underlying hash -algorithm is unkeyed, trying to use "hmac(hmac(sha3-512-generic))" -through AF_ALG or through KEYCTL_DH_COMPUTE resulted in the inner HMAC -being used without having been keyed, resulting in sha3_update() being -called without sha3_init(), causing a stack buffer overflow. - -This is a very old bug, but it seems to have only started causing real -problems when SHA-3 support was added (requires CONFIG_CRYPTO_SHA3) -because the innermost hash's state is ->import()ed from a zeroed buffer, -and it just so happens that other hash algorithms are fine with that, -but SHA-3 is not. However, there could be arch or hardware-dependent -hash algorithms also affected; I couldn't test everything. - -Fix the bug by introducing a function crypto_shash_alg_has_setkey() -which tests whether a shash algorithm is keyed. Then update the HMAC -template to require that its underlying hash algorithm is unkeyed. - -Here is a reproducer: - - #include - #include - - int main() - { - int algfd; - struct sockaddr_alg addr = { - .salg_type = "hash", - .salg_name = "hmac(hmac(sha3-512-generic))", - }; - char key[4096] = { 0 }; - - algfd = socket(AF_ALG, SOCK_SEQPACKET, 0); - bind(algfd, (const struct sockaddr *)&addr, sizeof(addr)); - setsockopt(algfd, SOL_ALG, ALG_SET_KEY, key, sizeof(key)); - } - -Here was the KASAN report from syzbot: - - BUG: KASAN: stack-out-of-bounds in memcpy include/linux/string.h:341 [inline] - BUG: KASAN: stack-out-of-bounds in sha3_update+0xdf/0x2e0 crypto/sha3_generic.c:161 - Write of size 4096 at addr ffff8801cca07c40 by task syzkaller076574/3044 - - CPU: 1 PID: 3044 Comm: syzkaller076574 Not tainted 4.14.0-mm1+ #25 - Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 - Call Trace: - __dump_stack lib/dump_stack.c:17 [inline] - dump_stack+0x194/0x257 lib/dump_stack.c:53 - print_address_description+0x73/0x250 mm/kasan/report.c:252 - kasan_report_error mm/kasan/report.c:351 [inline] - kasan_report+0x25b/0x340 mm/kasan/report.c:409 - check_memory_region_inline mm/kasan/kasan.c:260 [inline] - check_memory_region+0x137/0x190 mm/kasan/kasan.c:267 - memcpy+0x37/0x50 mm/kasan/kasan.c:303 - memcpy include/linux/string.h:341 [inline] - sha3_update+0xdf/0x2e0 crypto/sha3_generic.c:161 - crypto_shash_update+0xcb/0x220 crypto/shash.c:109 - shash_finup_unaligned+0x2a/0x60 crypto/shash.c:151 - crypto_shash_finup+0xc4/0x120 crypto/shash.c:165 - hmac_finup+0x182/0x330 crypto/hmac.c:152 - crypto_shash_finup+0xc4/0x120 crypto/shash.c:165 - shash_digest_unaligned+0x9e/0xd0 crypto/shash.c:172 - crypto_shash_digest+0xc4/0x120 crypto/shash.c:186 - hmac_setkey+0x36a/0x690 crypto/hmac.c:66 - crypto_shash_setkey+0xad/0x190 crypto/shash.c:64 - shash_async_setkey+0x47/0x60 crypto/shash.c:207 - crypto_ahash_setkey+0xaf/0x180 crypto/ahash.c:200 - hash_setkey+0x40/0x90 crypto/algif_hash.c:446 - alg_setkey crypto/af_alg.c:221 [inline] - alg_setsockopt+0x2a1/0x350 crypto/af_alg.c:254 - SYSC_setsockopt net/socket.c:1851 [inline] - SyS_setsockopt+0x189/0x360 net/socket.c:1830 - entry_SYSCALL_64_fastpath+0x1f/0x96 - -Reported-by: syzbot -Cc: -Signed-off-by: Eric Biggers -Signed-off-by: Herbert Xu ---- - crypto/hmac.c | 6 +++++- - crypto/shash.c | 5 +++-- - include/crypto/internal/hash.h | 8 ++++++++ - 3 files changed, 16 insertions(+), 3 deletions(-) - -diff --git a/crypto/hmac.c b/crypto/hmac.c -index 92871dc2a63e..e74730224f0a 100644 ---- a/crypto/hmac.c -+++ b/crypto/hmac.c -@@ -195,11 +195,15 @@ static int hmac_create(struct crypto_template *tmpl, struct rtattr **tb) - salg = shash_attr_alg(tb[1], 0, 0); - if (IS_ERR(salg)) - return PTR_ERR(salg); -+ alg = &salg->base; - -+ /* The underlying hash algorithm must be unkeyed */ - err = -EINVAL; -+ if (crypto_shash_alg_has_setkey(salg)) -+ goto out_put_alg; -+ - ds = salg->digestsize; - ss = salg->statesize; -- alg = &salg->base; - if (ds > alg->cra_blocksize || - ss < alg->cra_blocksize) - goto out_put_alg; -diff --git a/crypto/shash.c b/crypto/shash.c -index 325a14da5827..e849d3ee2e27 100644 ---- a/crypto/shash.c -+++ b/crypto/shash.c -@@ -25,11 +25,12 @@ - - static const struct crypto_type crypto_shash_type; - --static int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, -- unsigned int keylen) -+int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, -+ unsigned int keylen) - { - return -ENOSYS; - } -+EXPORT_SYMBOL_GPL(shash_no_setkey); - - static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key, - unsigned int keylen) -diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h -index f0b44c16e88f..c2bae8da642c 100644 ---- a/include/crypto/internal/hash.h -+++ b/include/crypto/internal/hash.h -@@ -82,6 +82,14 @@ int ahash_register_instance(struct crypto_template *tmpl, - struct ahash_instance *inst); - void ahash_free_instance(struct crypto_instance *inst); - -+int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, -+ unsigned int keylen); -+ -+static inline bool crypto_shash_alg_has_setkey(struct shash_alg *alg) -+{ -+ return alg->setkey != shash_no_setkey; -+} -+ - int crypto_init_ahash_spawn(struct crypto_ahash_spawn *spawn, - struct hash_alg_common *alg, - struct crypto_instance *inst); --- -2.11.0 - diff --git a/debian/patches/bugfix/all/crypto-salsa20-fix-blkcipher_walk-API-usage.patch b/debian/patches/bugfix/all/crypto-salsa20-fix-blkcipher_walk-API-usage.patch deleted file mode 100644 index 4418d7f77..000000000 --- a/debian/patches/bugfix/all/crypto-salsa20-fix-blkcipher_walk-API-usage.patch +++ /dev/null @@ -1,91 +0,0 @@ -From: Eric Biggers -Date: Tue, 28 Nov 2017 20:56:59 -0800 -Subject: crypto: salsa20 - fix blkcipher_walk API usage -Origin: https://git.kernel.org/linus/ecaaab5649781c5a0effdaf298a925063020500e -Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2017-17805 - -When asked to encrypt or decrypt 0 bytes, both the generic and x86 -implementations of Salsa20 crash in blkcipher_walk_done(), either when -doing 'kfree(walk->buffer)' or 'free_page((unsigned long)walk->page)', -because walk->buffer and walk->page have not been initialized. - -The bug is that Salsa20 is calling blkcipher_walk_done() even when -nothing is in 'walk.nbytes'. But blkcipher_walk_done() is only meant to -be called when a nonzero number of bytes have been provided. - -The broken code is part of an optimization that tries to make only one -call to salsa20_encrypt_bytes() to process inputs that are not evenly -divisible by 64 bytes. To fix the bug, just remove this "optimization" -and use the blkcipher_walk API the same way all the other users do. - -Reproducer: - - #include - #include - #include - - int main() - { - int algfd, reqfd; - struct sockaddr_alg addr = { - .salg_type = "skcipher", - .salg_name = "salsa20", - }; - char key[16] = { 0 }; - - algfd = socket(AF_ALG, SOCK_SEQPACKET, 0); - bind(algfd, (void *)&addr, sizeof(addr)); - reqfd = accept(algfd, 0, 0); - setsockopt(algfd, SOL_ALG, ALG_SET_KEY, key, sizeof(key)); - read(reqfd, key, sizeof(key)); - } - -Reported-by: syzbot -Fixes: eb6f13eb9f81 ("[CRYPTO] salsa20_generic: Fix multi-page processing") -Cc: # v2.6.25+ -Signed-off-by: Eric Biggers -Signed-off-by: Herbert Xu ---- - arch/x86/crypto/salsa20_glue.c | 7 ------- - crypto/salsa20_generic.c | 7 ------- - 2 files changed, 14 deletions(-) - -diff --git a/arch/x86/crypto/salsa20_glue.c b/arch/x86/crypto/salsa20_glue.c -index 399a29d067d6..cb91a64a99e7 100644 ---- a/arch/x86/crypto/salsa20_glue.c -+++ b/arch/x86/crypto/salsa20_glue.c -@@ -59,13 +59,6 @@ static int encrypt(struct blkcipher_desc *desc, - - salsa20_ivsetup(ctx, walk.iv); - -- if (likely(walk.nbytes == nbytes)) -- { -- salsa20_encrypt_bytes(ctx, walk.src.virt.addr, -- walk.dst.virt.addr, nbytes); -- return blkcipher_walk_done(desc, &walk, 0); -- } -- - while (walk.nbytes >= 64) { - salsa20_encrypt_bytes(ctx, walk.src.virt.addr, - walk.dst.virt.addr, -diff --git a/crypto/salsa20_generic.c b/crypto/salsa20_generic.c -index f550b5d94630..d7da0eea5622 100644 ---- a/crypto/salsa20_generic.c -+++ b/crypto/salsa20_generic.c -@@ -188,13 +188,6 @@ static int encrypt(struct blkcipher_desc *desc, - - salsa20_ivsetup(ctx, walk.iv); - -- if (likely(walk.nbytes == nbytes)) -- { -- salsa20_encrypt_bytes(ctx, walk.dst.virt.addr, -- walk.src.virt.addr, nbytes); -- return blkcipher_walk_done(desc, &walk, 0); -- } -- - while (walk.nbytes >= 64) { - salsa20_encrypt_bytes(ctx, walk.dst.virt.addr, - walk.src.virt.addr, --- -2.11.0 - diff --git a/debian/patches/bugfix/all/usb-core-prevent-malicious-bnuminterfaces-overflow.patch b/debian/patches/bugfix/all/usb-core-prevent-malicious-bnuminterfaces-overflow.patch deleted file mode 100644 index 13e050e03..000000000 --- a/debian/patches/bugfix/all/usb-core-prevent-malicious-bnuminterfaces-overflow.patch +++ /dev/null @@ -1,44 +0,0 @@ -From: Alan Stern -Date: Tue, 12 Dec 2017 14:25:13 -0500 -Subject: USB: core: prevent malicious bNumInterfaces overflow -Origin: https://git.kernel.org/linus/48a4ff1c7bb5a32d2e396b03132d20d552c0eca7 -Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2017-17558 - -A malicious USB device with crafted descriptors can cause the kernel -to access unallocated memory by setting the bNumInterfaces value too -high in a configuration descriptor. Although the value is adjusted -during parsing, this adjustment is skipped in one of the error return -paths. - -This patch prevents the problem by setting bNumInterfaces to 0 -initially. The existing code already sets it to the proper value -after parsing is complete. - -Signed-off-by: Alan Stern -Reported-by: Andrey Konovalov -CC: -Signed-off-by: Greg Kroah-Hartman ---- - drivers/usb/core/config.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/drivers/usb/core/config.c -+++ b/drivers/usb/core/config.c -@@ -555,6 +555,9 @@ static int usb_parse_configuration(struc - unsigned iad_num = 0; - - memcpy(&config->desc, buffer, USB_DT_CONFIG_SIZE); -+ nintf = nintf_orig = config->desc.bNumInterfaces; -+ config->desc.bNumInterfaces = 0; // Adjusted later -+ - if (config->desc.bDescriptorType != USB_DT_CONFIG || - config->desc.bLength < USB_DT_CONFIG_SIZE || - config->desc.bLength > size) { -@@ -568,7 +571,6 @@ static int usb_parse_configuration(struc - buffer += config->desc.bLength; - size -= config->desc.bLength; - -- nintf = nintf_orig = config->desc.bNumInterfaces; - if (nintf > USB_MAXINTERFACES) { - dev_warn(ddev, "config %d has too many interfaces: %d, " - "using maximum allowed: %d\n", diff --git a/debian/patches/series b/debian/patches/series index bc52f5a59..678f91d6e 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -121,15 +121,12 @@ bugfix/all/dccp-cve-2017-8824-use-after-free-in-dccp-code.patch bugfix/all/netfilter-nfnetlink_cthelper-add-missing-permission-.patch bugfix/all/netlink-add-netns-check-on-taps.patch bugfix/all/netfilter-xt_osf-add-missing-permission-checks.patch -bugfix/all/usb-core-prevent-malicious-bnuminterfaces-overflow.patch bugfix/all/net-ipv4-fix-for-a-race-condition-in-raw_sendmsg.patch bugfix/all/media-dvb-usb-v2-lmedm04-Improve-logic-checking-of-w.patch bugfix/all/media-dvb-usb-v2-lmedm04-move-ts2020-attach-to-dm04_.patch bugfix/all/media-hdpvr-fix-an-error-handling-path-in-hdpvr_prob.patch bugfix/all/kvm-fix-stack-out-of-bounds-read-in-write_mmio.patch bugfix/all/bluetooth-prevent-stack-info-leak-from-the-efs-element.patch -bugfix/all/crypto-salsa20-fix-blkcipher_walk-API-usage.patch -bugfix/all/crypto-hmac-require-that-the-underlying-hash-algorit.patch bugfix/all/bpf-encapsulate-verifier-log-state-into-a-structure.patch bugfix/all/bpf-move-global-verifier-log-into-verifier-environme.patch bugfix/all/bpf-fix-branch-pruning-logic.patch