Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1254879
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3.10 11/17] m68k/uaccess: Fix asm constraints for userspace access |
| Date | 2015-10-23 20:30 +0200 |
| Message-ID | <qmPgg-112-69@gated-at.bofh.it> (permalink) |
| References | <qmODv-8sm-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <geert@linux-m68k.org>
commit 631d8b674f5f8235e9cb7e628b0fe9e5200e3158 upstream.
When compiling a MMU kernel with CPU_HAS_ADDRESS_SPACES=n (e.g. "MMU=y
allnoconfig": "echo CONFIG_MMU=y > allno.config && make KCONFIG_ALLCONFIG=1
allnoconfig"), we use plain "move" instead of "moves", and I got:
CC arch/m68k/lib/uaccess.o
{standard input}: Assembler messages:
{standard input}:47: Error: operands mismatch -- statement `move.b %a0,(%a1)' ignored
This happens because plain "move" doesn't support byte transfers between
memory and address registers, while "moves" does.
Fix the asm constraints for __generic_copy_from_user(),
__generic_copy_to_user(), and __clear_user() to only use data registers
when accessing userspace.
Also, relax the asm constraints for 16-bit userspace accesses in
__put_user() and __get_user(), as both "move" and "moves" do support
such transfers between memory and address registers.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/m68k/include/asm/uaccess_mm.h | 8 ++++----
arch/m68k/lib/uaccess.c | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
--- a/arch/m68k/include/asm/uaccess_mm.h
+++ b/arch/m68k/include/asm/uaccess_mm.h
@@ -90,7 +90,7 @@ asm volatile ("\n" \
__put_user_asm(__pu_err, __pu_val, ptr, b, d, -EFAULT); \
break; \
case 2: \
- __put_user_asm(__pu_err, __pu_val, ptr, w, d, -EFAULT); \
+ __put_user_asm(__pu_err, __pu_val, ptr, w, r, -EFAULT); \
break; \
case 4: \
__put_user_asm(__pu_err, __pu_val, ptr, l, r, -EFAULT); \
@@ -158,7 +158,7 @@ asm volatile ("\n" \
__get_user_asm(__gu_err, x, ptr, u8, b, d, -EFAULT); \
break; \
case 2: \
- __get_user_asm(__gu_err, x, ptr, u16, w, d, -EFAULT); \
+ __get_user_asm(__gu_err, x, ptr, u16, w, r, -EFAULT); \
break; \
case 4: \
__get_user_asm(__gu_err, x, ptr, u32, l, r, -EFAULT); \
@@ -245,7 +245,7 @@ __constant_copy_from_user(void *to, cons
__get_user_asm(res, *(u8 *)to, (u8 __user *)from, u8, b, d, 1);
break;
case 2:
- __get_user_asm(res, *(u16 *)to, (u16 __user *)from, u16, w, d, 2);
+ __get_user_asm(res, *(u16 *)to, (u16 __user *)from, u16, w, r, 2);
break;
case 3:
__constant_copy_from_user_asm(res, to, from, tmp, 3, w, b,);
@@ -326,7 +326,7 @@ __constant_copy_to_user(void __user *to,
__put_user_asm(res, *(u8 *)from, (u8 __user *)to, b, d, 1);
break;
case 2:
- __put_user_asm(res, *(u16 *)from, (u16 __user *)to, w, d, 2);
+ __put_user_asm(res, *(u16 *)from, (u16 __user *)to, w, r, 2);
break;
case 3:
__constant_copy_to_user_asm(res, to, from, tmp, 3, w, b,);
--- a/arch/m68k/lib/uaccess.c
+++ b/arch/m68k/lib/uaccess.c
@@ -52,7 +52,7 @@ unsigned long __generic_copy_from_user(v
" .long 3b,30b\n"
" .long 5b,50b\n"
" .previous"
- : "=d" (res), "+a" (from), "+a" (to), "=&r" (tmp)
+ : "=d" (res), "+a" (from), "+a" (to), "=&d" (tmp)
: "0" (n / 4), "d" (n & 3));
return res;
@@ -96,7 +96,7 @@ unsigned long __generic_copy_to_user(voi
" .long 7b,50b\n"
" .long 8b,50b\n"
" .previous"
- : "=d" (res), "+a" (from), "+a" (to), "=&r" (tmp)
+ : "=d" (res), "+a" (from), "+a" (to), "=&d" (tmp)
: "0" (n / 4), "d" (n & 3));
return res;
@@ -141,7 +141,7 @@ unsigned long __clear_user(void __user *
" .long 7b,40b\n"
" .previous"
: "=d" (res), "+a" (to)
- : "r" (0), "0" (n / 4), "d" (n & 3));
+ : "d" (0), "0" (n / 4), "d" (n & 3));
return res;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 3.10 00/17] 3.10.92-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 19:50 +0200 [PATCH 3.10 10/17] asix: Do full reset during ax88772_bind Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 19:50 +0200 [PATCH 3.10 15/17] workqueue: make sure delayed work run in local cpu Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 19:50 +0200 [PATCH 3.10 01/17] l2tp: protect tunnel->del_work by ref_count Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 19:50 +0200 [PATCH 3.10 13/17] crypto: ahash - ensure statesize is non-zero Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 19:50 +0200 [PATCH 3.10 08/17] ethtool: Use kcalloc instead of kmalloc for ethtool_get_strings Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 19:50 +0200 [PATCH 3.10 03/17] af_unix: return data from multiple SKBs on recv() with MSG_PEEK flag Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200 [PATCH 3.10 06/17] net: add pfmemalloc check in sk_add_backlog() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200 [PATCH 3.10 05/17] skbuff: Fix skb checksum partial check. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200 [PATCH 3.10 09/17] asix: Dont reset PHY on if_up for ASIX 88772 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200 [PATCH 3.10 04/17] skbuff: Fix skb checksum flag on skb pull Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200 [PATCH 3.10 16/17] dm thin: fix missing pool reference count decrement in pool_ctr error path Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200 [PATCH 3.10 07/17] ppp: dont override sk->sk_state in pppoe_flush_dev() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200 [PATCH 3.10 14/17] i2c: rcar: enable RuntimePM before registering to the core Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200 [PATCH 3.10 02/17] af_unix: Convert the unix_sk macro to an inline function for type safety Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200 [PATCH 3.10 17/17] rbd: fix double free on rbd_dev->header_name Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200 [PATCH 3.10 12/17] crypto: sparc - initialize blkcipher.ivsize Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200 [PATCH 3.10 11/17] m68k/uaccess: Fix asm constraints for userspace access Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-23 20:30 +0200 Re: [PATCH 3.10 00/17] 3.10.92-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2015-10-23 23:10 +0200 Re: [PATCH 3.10 00/17] 3.10.92-stable review Guenter Roeck <linux@roeck-us.net> - 2015-10-24 04:10 +0200
csiph-web