Skip to contentSkip to conversation

4.7.5-stable review

PATCH In review Greg Kroah-Hartman 4 participants 183 messages Sep 22, 2016 – Oct 3, 2016 Page 2 of 2

Subsystems (7)
lore
Share & tools
lore
author maintainer
#166 lore raw

PATCH 171/184 mips: copy_from_user() must zero the destination on access_ok() failure

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Al Viro <[email protected]>

commit e69d700535ac43a18032b3c399c69bf4639e89a2 upstream.

---
 arch/mips/include/asm/uaccess.h |    3 +++
 1 file changed, 3 insertions(+)
arch/mips/include/asm/uaccess.h +3 -0
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/thread_info.h>
+#include <linux/string.h>
 #include <asm/asm-eva.h>
 
 /*
@@ -1170,6 +1171,8 @@ extern size_t __copy_in_user_eva(void *_
 			__cu_len = __invoke_copy_from_user(__cu_to,	\
 							   __cu_from,	\
 							   __cu_len);   \
+		} else {						\
+			memset(__cu_to, 0, __cu_len);			\
 		}							\
 	}								\
 	__cu_len;							\
author maintainer
#167 lore raw

PATCH 172/184 asm-generic: make copy_from_user() zero the destination properly

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Al Viro <[email protected]>

commit 2545e5da080b4839dd859e3b09343a884f6ab0e3 upstream.

... in all cases, including the failing access_ok()

Note that some architectures using asm-generic/uaccess.h have __copy_from_user() not zeroing the tail on failure halfway through. This variant works either way.

---
 include/asm-generic/uaccess.h |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
include/asm-generic/uaccess.h +6 -4
@@ -261,11 +261,13 @@ extern int __get_user_bad(void) __attrib
 static inline long copy_from_user(void *to,
 		const void __user * from, unsigned long n)
 {
+	unsigned long res = n;
 	might_fault();
-	if (access_ok(VERIFY_READ, from, n))
-		return __copy_from_user(to, from, n);
-	else
-		return n;
+	if (likely(access_ok(VERIFY_READ, from, n)))
+		res = __copy_from_user(to, from, n);
+	if (unlikely(res))
+		memset(to + (n - res), 0, res);
+	return res;
 }
 
 static inline long copy_to_user(void __user *to,
author maintainer
#168 lore raw

PATCH 173/184 alpha: fix copy_from_user()

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Al Viro <[email protected]>

commit 2561d309dfd1555e781484af757ed0115035ddb3 upstream.

it should clear the destination even when access_ok() fails.

---
 arch/alpha/include/asm/uaccess.h |   19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
arch/alpha/include/asm/uaccess.h +8 -11
@@ -371,14 +371,6 @@ __copy_tofrom_user_nocheck(void *to, con
 	return __cu_len;
 }
 
-extern inline long
-__copy_tofrom_user(void *to, const void *from, long len, const void __user *validate)
-{
-	if (__access_ok((unsigned long)validate, len, get_fs()))
-		len = __copy_tofrom_user_nocheck(to, from, len);
-	return len;
-}
-
 #define __copy_to_user(to, from, n)					\
 ({									\
 	__chk_user_ptr(to);						\
@@ -393,17 +385,22 @@ __copy_tofrom_user(void *to, const void
 #define __copy_to_user_inatomic __copy_to_user
 #define __copy_from_user_inatomic __copy_from_user
 
-
 extern inline long
 copy_to_user(void __user *to, const void *from, long n)
 {
-	return __copy_tofrom_user((__force void *)to, from, n, to);
+	if (likely(__access_ok((unsigned long)to, n, get_fs())))
+		n = __copy_tofrom_user_nocheck((__force void *)to, from, n);
+	return n;
 }
 
 extern inline long
 copy_from_user(void *to, const void __user *from, long n)
 {
-	return __copy_tofrom_user(to, (__force void *)from, n, from);
+	if (likely(__access_ok((unsigned long)from, n, get_fs())))
+		n = __copy_tofrom_user_nocheck(to, (__force void *)from, n);
+	else
+		memset(to, 0, n);
+	return n;
 }
 
 extern void __do_clear_user(void);
author maintainer
#169 lore raw

PATCH 174/184 metag: copy_from_user() should zero the destination on access_ok() failure

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Al Viro <[email protected]>

commit 8ae95ed4ae5fc7c3391ed668b2014c9e2079533b upstream.

---
 arch/metag/include/asm/uaccess.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/metag/include/asm/uaccess.h +2 -1
@@ -204,8 +204,9 @@ extern unsigned long __must_check __copy
 static inline unsigned long
 copy_from_user(void *to, const void __user *from, unsigned long n)
 {
-	if (access_ok(VERIFY_READ, from, n))
+	if (likely(access_ok(VERIFY_READ, from, n)))
 		return __copy_user_zeroing(to, from, n);
+	memset(to, 0, n);
 	return n;
 }
 
author maintainer
#170 lore raw

PATCH 175/184 parisc: fix copy_from_user()

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Al Viro <[email protected]>

commit aace880feea38875fbc919761b77e5732a3659ef upstream.

---
 arch/parisc/include/asm/uaccess.h |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/parisc/include/asm/uaccess.h +4 -2
@@ -10,6 +10,7 @@
 #include <asm-generic/uaccess-unaligned.h>
 
 #include <linux/bug.h>
+#include <linux/string.h>
 
 #define VERIFY_READ 0
 #define VERIFY_WRITE 1
@@ -221,13 +222,14 @@ static inline unsigned long __must_check
                                           unsigned long n)
 {
         int sz = __compiletime_object_size(to);
-        int ret = -EFAULT;
+        unsigned long ret = n;
 
         if (likely(sz == -1 || !__builtin_constant_p(n) || sz >= n))
                 ret = __copy_from_user(to, from, n);
         else
                 copy_from_user_overflow();
-
+	if (unlikely(ret))
+		memset(to + (n - ret), 0, ret);
         return ret;
 }
 
author maintainer
#171 lore raw

PATCH 176/184 openrisc: fix copy_from_user()

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Al Viro <[email protected]>

commit acb2505d0119033a80c85ac8d02dccae41271667 upstream.

... that should zero on faults. Also remove the <censored> helpful logics wrt range truncation copied from ppc32. Where it had ever been needed only in case of copy_from_user() *and* had not been merged into the mainline until a month after the need had disappeared. A decade before openrisc went into mainline, I might add...

---
 arch/openrisc/include/asm/uaccess.h |   33 ++++++++++-----------------------
 1 file changed, 10 insertions(+), 23 deletions(-)
arch/openrisc/include/asm/uaccess.h +10 -23
@@ -273,28 +273,20 @@ __copy_tofrom_user(void *to, const void
 static inline unsigned long
 copy_from_user(void *to, const void *from, unsigned long n)
 {
-	unsigned long over;
+	unsigned long res = n;
 
-	if (access_ok(VERIFY_READ, from, n))
-		return __copy_tofrom_user(to, from, n);
-	if ((unsigned long)from < TASK_SIZE) {
-		over = (unsigned long)from + n - TASK_SIZE;
-		return __copy_tofrom_user(to, from, n - over) + over;
-	}
-	return n;
+	if (likely(access_ok(VERIFY_READ, from, n)))
+		n = __copy_tofrom_user(to, from, n);
+	if (unlikely(res))
+		memset(to + (n - res), 0, res);
+	return res;
 }
 
 static inline unsigned long
 copy_to_user(void *to, const void *from, unsigned long n)
 {
-	unsigned long over;
-
-	if (access_ok(VERIFY_WRITE, to, n))
-		return __copy_tofrom_user(to, from, n);
-	if ((unsigned long)to < TASK_SIZE) {
-		over = (unsigned long)to + n - TASK_SIZE;
-		return __copy_tofrom_user(to, from, n - over) + over;
-	}
+	if (likely(access_ok(VERIFY_WRITE, to, n)))
+		n = __copy_tofrom_user(to, from, n);
 	return n;
 }
 
@@ -303,13 +295,8 @@ extern unsigned long __clear_user(void *
 static inline __must_check unsigned long
 clear_user(void *addr, unsigned long size)
 {
-
-	if (access_ok(VERIFY_WRITE, addr, size))
-		return __clear_user(addr, size);
-	if ((unsigned long)addr < TASK_SIZE) {
-		unsigned long over = (unsigned long)addr + size - TASK_SIZE;
-		return __clear_user(addr, size - over) + over;
-	}
+	if (likely(access_ok(VERIFY_WRITE, addr, size)))
+		size = __clear_user(addr, size);
 	return size;
 }
 
author maintainer
#172 lore raw

PATCH 177/184 nios2: copy_from_user() should zero the tail of destination

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Al Viro <[email protected]>

commit e33d1f6f72cc82fcfc3d1fb20c9e3ad83b1928fa upstream.

---
 arch/nios2/include/asm/uaccess.h |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
arch/nios2/include/asm/uaccess.h +6 -3
@@ -102,9 +102,12 @@ extern long __copy_to_user(void __user *
 static inline long copy_from_user(void *to, const void __user *from,
 				unsigned long n)
 {
-	if (!access_ok(VERIFY_READ, from, n))
-		return n;
-	return __copy_from_user(to, from, n);
+	unsigned long res = n;
+	if (access_ok(VERIFY_READ, from, n))
+		res = __copy_from_user(to, from, n);
+	if (unlikely(res))
+		memset(to + (n - res), 0, res);
+	return res;
 }
 
 static inline long copy_to_user(void __user *to, const void *from,
author maintainer
#173 lore raw

PATCH 178/184 mn10300: copy_from_user() should zero on access_ok() failure...

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Al Viro <[email protected]>

commit ae7cc577ec2a4a6151c9e928fd1f595d953ecef1 upstream.

---
 arch/mn10300/lib/usercopy.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/mn10300/lib/usercopy.c +3 -1
@@ -9,7 +9,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the Licence, or (at your option) any later version.
  */
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 unsigned long
 __generic_copy_to_user(void *to, const void *from, unsigned long n)
@@ -24,6 +24,8 @@ __generic_copy_from_user(void *to, const
 {
 	if (access_ok(VERIFY_READ, from, n))
 		__copy_user_zeroing(to, from, n);
+	else
+		memset(to, 0, n);
 	return n;
 }
 
author maintainer
#174 lore raw

PATCH 179/184 sparc32: fix copy_from_user()

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Al Viro <[email protected]>

commit 917400cecb4b52b5cde5417348322bb9c8272fa6 upstream.

---
 arch/sparc/include/asm/uaccess_32.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/sparc/include/asm/uaccess_32.h +3 -1
@@ -263,8 +263,10 @@ static inline unsigned long copy_from_us
 {
 	if (n && __access_ok((unsigned long) from, n))
 		return __copy_user((__force void __user *) to, from, n);
-	else
+	else {
+		memset(to, 0, n);
 		return n;
+	}
 }
 
 static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)
author maintainer
#175 lore raw

PATCH 180/184 ppc32: fix copy_from_user()

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Al Viro <[email protected]>

commit 224264657b8b228f949b42346e09ed8c90136a8e upstream.

should clear on access_ok() failures. Also remove the useless range truncation logics.

---
 arch/powerpc/include/asm/uaccess.h |   21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)
arch/powerpc/include/asm/uaccess.h +2 -19
@@ -308,30 +308,17 @@ extern unsigned long __copy_tofrom_user(
 static inline unsigned long copy_from_user(void *to,
 		const void __user *from, unsigned long n)
 {
-	unsigned long over;
-
-	if (access_ok(VERIFY_READ, from, n))
+	if (likely(access_ok(VERIFY_READ, from, n)))
 		return __copy_tofrom_user((__force void __user *)to, from, n);
-	if ((unsigned long)from < TASK_SIZE) {
-		over = (unsigned long)from + n - TASK_SIZE;
-		return __copy_tofrom_user((__force void __user *)to, from,
-				n - over) + over;
-	}
++	memset(to, 0, n);
 	return n;
 }
 
 static inline unsigned long copy_to_user(void __user *to,
 		const void *from, unsigned long n)
 {
-	unsigned long over;
-
 	if (access_ok(VERIFY_WRITE, to, n))
 		return __copy_tofrom_user(to, (__force void __user *)from, n);
-	if ((unsigned long)to < TASK_SIZE) {
-		over = (unsigned long)to + n - TASK_SIZE;
-		return __copy_tofrom_user(to, (__force void __user *)from,
-				n - over) + over;
-	}
 	return n;
 }
 
@@ -422,10 +409,6 @@ static inline unsigned long clear_user(v
 	might_fault();
 	if (likely(access_ok(VERIFY_WRITE, addr, size)))
 		return __clear_user(addr, size);
-	if ((unsigned long)addr < TASK_SIZE) {
-		unsigned long over = (unsigned long)addr + size - TASK_SIZE;
-		return __clear_user(addr, size - over) + over;
-	}
 	return size;
 }
 
author maintainer
#176 lore raw

PATCH 181/184 ia64: copy_from_user() should zero the destination on access_ok() failure

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Al Viro <[email protected]>

commit a5e541f796f17228793694d64b507f5f57db4cd7 upstream.

---
 arch/ia64/include/asm/uaccess.h |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
arch/ia64/include/asm/uaccess.h +9 -11
@@ -263,17 +263,15 @@ __copy_from_user (void *to, const void _
 	__cu_len;									\
 })
 
-#define copy_from_user(to, from, n)							\
-({											\
-	void *__cu_to = (to);								\
-	const void __user *__cu_from = (from);						\
-	long __cu_len = (n);								\
-											\
-	__chk_user_ptr(__cu_from);							\
-	if (__access_ok(__cu_from, __cu_len, get_fs()))					\
-		__cu_len = __copy_user((__force void __user *) __cu_to, __cu_from, __cu_len);	\
-	__cu_len;									\
-})
+static inline unsigned long
+copy_from_user(void *to, const void __user *from, unsigned long n)
+{
+	if (likely(__access_ok(from, n, get_fs())))
+		n = __copy_user((__force void __user *) to, from, n);
+	else
+		memset(to, 0, n);
+	return n;
+}
 
 #define __copy_in_user(to, from, size)	__copy_user((to), (from), (size))
 
author maintainer
#177 lore raw

PATCH 182/184 iwlegacy: avoid warning about missing braces

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Arnd Bergmann <[email protected]>

commit 2cce76c3fab410520610a7d2f52faebc3cfcf843 upstream.

gcc-6 warns about code in il3945_hw_txq_ctx_free() being somewhat ambiguous:

drivers/net/wireless/intel/iwlegacy/3945.c:1022:5: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]

This adds a set of curly braces to avoid the warning.

---
 drivers/net/wireless/intel/iwlegacy/3945.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlegacy/3945.c +2 -1
@@ -1019,12 +1019,13 @@ il3945_hw_txq_ctx_free(struct il_priv *i
 	int txq_id;
 
 	/* Tx queues */
-	if (il->txq)
+	if (il->txq) {
 		for (txq_id = 0; txq_id < il->hw_params.max_txq_num; txq_id++)
 			if (txq_id == IL39_CMD_QUEUE_NUM)
 				il_cmd_queue_free(il);
 			else
 				il_tx_queue_free(il, txq_id);
+	}
 
 	/* free tx queue structure */
 	il_free_txq_mem(il);
#178 lore raw
In reply to Greg Kroah-Hartman
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.7.5 release. There are 184 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat Sep 24 17:40:23 UTC 2016. Anything received after that time might be too late.

Build results:

	total: 149 pass: 137 fail: 12
Failed builds:
	avr32:defconfig
	avr32:allnoconfig
	avr32:merisc_defconfig
	avr32:atngw100mkii_evklcd101_defconfig
	powerpc:defconfig
	powerpc:allmodconfig
	powerpc:allnoconfig
	powerpc:ppc6xx_defconfig
	powerpc:mpc83xx_defconfig
	powerpc:tqm8xx_defconfig
	powerpc:85xx/sbc8548_defconfig
	powerpc:83xx/mpc834x_mds_defconfig

Qemu test results:

	total: 108 pass: 97 fail: 11
Failed tests:
	openrisc:or1ksim_defconfig
	powerpc:mac99:nosmp:ppc_book3s_defconfig
	powerpc:g3beige:nosmp:ppc_book3s_defconfig
	powerpc:mac99:smp:ppc_book3s_defconfig
	powerpc:virtex-ml507:44x/virtex5_defconfig
	powerpc:mpc8548cds:85xx/mpc85xx_cds_defconfig
	powerpc:mpc8548cds:smpdev:85xx/mpc85xx_cds_defconfig
	powerpc:bamboo:44x/bamboo_defconfig
	powerpc:mac99:ppc64_book3s_defconfig:nosmp
	powerpc:mac99:ppc64_book3s_defconfig:smp4
	powerpc:pseries:pseries_defconfig

Failures pretty much match 4.4, so I won't go into specifics here.

Details are available at http://kerneltests.org/builders.

Guenter

author maintainer
#179 lore raw
Quoted 40 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.7.5 release. There are 184 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat Sep 24 17:40:23 UTC 2016. Anything received after that time might be too late.

Build results:

	total: 149 pass: 137 fail: 12
Failed builds:
	avr32:defconfig
	avr32:allnoconfig
	avr32:merisc_defconfig
	avr32:atngw100mkii_evklcd101_defconfig
	powerpc:defconfig
	powerpc:allmodconfig
	powerpc:allnoconfig
	powerpc:ppc6xx_defconfig
	powerpc:mpc83xx_defconfig
	powerpc:tqm8xx_defconfig
	powerpc:85xx/sbc8548_defconfig
	powerpc:83xx/mpc834x_mds_defconfig

Qemu test results:

	total: 108 pass: 97 fail: 11
Failed tests:
	openrisc:or1ksim_defconfig
	powerpc:mac99:nosmp:ppc_book3s_defconfig
	powerpc:g3beige:nosmp:ppc_book3s_defconfig
	powerpc:mac99:smp:ppc_book3s_defconfig
	powerpc:virtex-ml507:44x/virtex5_defconfig
	powerpc:mpc8548cds:85xx/mpc85xx_cds_defconfig
	powerpc:mpc8548cds:smpdev:85xx/mpc85xx_cds_defconfig
	powerpc:bamboo:44x/bamboo_defconfig
	powerpc:mac99:ppc64_book3s_defconfig:nosmp
	powerpc:mac99:ppc64_book3s_defconfig:smp4
	powerpc:pseries:pseries_defconfig
Quoted 1 line

Failures pretty much match 4.4, so I won't go into specifics here.

Should all now be fixed up, sorry for the mess, it's on arches that I don't do local test builds for :(

greg k-h

author maintainer
#180 lore raw

PATCH 183/184 genirq/msi: Fix broken debug output

In reply to Greg Kroah-Hartman

4.7-stable review patch. If anyone has any objections, please let me know.

------------------

From: Thomas Gleixner <[email protected]>

commit 4364e1a29be16b2783c0bcbc263f61236af64281 upstream.

virq is not required to be the same for all msi descs. Use the base irq number from the desc in the debug printk.

---
 kernel/irq/msi.c |    1 +
 1 file changed, 1 insertion(+)
kernel/irq/msi.c +1 -0
@@ -352,6 +352,7 @@ int msi_domain_alloc_irqs(struct irq_dom
 		ops->msi_finish(&arg, 0);
 
 	for_each_msi_entry(desc, dev) {
+		virq = desc->irq;
 		if (desc->nvec_used == 1)
 			dev_dbg(dev, "irq %d for MSI\n", virq);
 		else
#181 lore raw
In reply to Greg Kroah-Hartman
Quoted 9 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.7.5 release. There are 184 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat Sep 24 17:40:23 UTC 2016. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

Quoted 9 lines
	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.7.5-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.7.y
and the diffstat can be found below.

thanks,

greg k-h

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

Signature · 5 lines
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America(Silicon Valley)
[email protected]
author maintainer
#182 lore raw
Quoted 15 lines · Shuah Khan
Quoted 14 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.7.5 release. There are 184 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Sat Sep 24 17:40:23 UTC 2016. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.7.5-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.7.y
and the diffstat can be found below.

Quoted 6 lines
Quoted 4 lines

thanks,

greg k-h

Compiled and booted on my test system. No dmesg regressions.

Great, thanks for testing both of these and letting me know!

greg k-h