Commit 17a3ea20 authored by Linus Torvalds's avatar Linus Torvalds Committed by Ben Hutchings

Fix potential infoleak in older kernels

Not upstream as it is not needed there.

So a patch something like this might be a safe way to fix the
potential infoleak in older kernels.

THIS IS UNTESTED. It's a very obvious patch, though, so if it compiles
it probably works. It just initializes the output variable with 0 in
the inline asm description, instead of doing it in the exception
handler.

It will generate slightly worse code (a few unnecessary ALU
operations), but it doesn't have any interactions with the exception
handler implementation.
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent ce626e14
...@@ -329,7 +329,7 @@ do { \ ...@@ -329,7 +329,7 @@ do { \
#define __get_user_asm_u64(x, ptr, retval, errret) \ #define __get_user_asm_u64(x, ptr, retval, errret) \
__get_user_asm(x, ptr, retval, "q", "", "=r", errret) __get_user_asm(x, ptr, retval, "q", "", "=r", errret)
#define __get_user_asm_ex_u64(x, ptr) \ #define __get_user_asm_ex_u64(x, ptr) \
__get_user_asm_ex(x, ptr, "q", "", "=r") __get_user_asm_ex(x, ptr, "q", "", "=&r")
#endif #endif
#define __get_user_size(x, ptr, size, retval, errret) \ #define __get_user_size(x, ptr, size, retval, errret) \
...@@ -372,13 +372,13 @@ do { \ ...@@ -372,13 +372,13 @@ do { \
__chk_user_ptr(ptr); \ __chk_user_ptr(ptr); \
switch (size) { \ switch (size) { \
case 1: \ case 1: \
__get_user_asm_ex(x, ptr, "b", "b", "=q"); \ __get_user_asm_ex(x, ptr, "b", "b", "=&q"); \
break; \ break; \
case 2: \ case 2: \
__get_user_asm_ex(x, ptr, "w", "w", "=r"); \ __get_user_asm_ex(x, ptr, "w", "w", "=&r"); \
break; \ break; \
case 4: \ case 4: \
__get_user_asm_ex(x, ptr, "l", "k", "=r"); \ __get_user_asm_ex(x, ptr, "l", "k", "=&r"); \
break; \ break; \
case 8: \ case 8: \
__get_user_asm_ex_u64(x, ptr); \ __get_user_asm_ex_u64(x, ptr); \
...@@ -392,7 +392,7 @@ do { \ ...@@ -392,7 +392,7 @@ do { \
asm volatile("1: mov"itype" %1,%"rtype"0\n" \ asm volatile("1: mov"itype" %1,%"rtype"0\n" \
"2:\n" \ "2:\n" \
_ASM_EXTABLE_EX(1b, 2b) \ _ASM_EXTABLE_EX(1b, 2b) \
: ltype(x) : "m" (__m(addr))) : ltype(x) : "m" (__m(addr)), "0" (0))
#define __put_user_nocheck(x, ptr, size) \ #define __put_user_nocheck(x, ptr, size) \
({ \ ({ \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment