sparc: switch to RAW_COPY_USER
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 21 Mar 2017 21:04:45 +0000 (17:04 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 2 Apr 2017 16:53:15 +0000 (12:53 -0400)
... and drop zeroing in sparc32.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
21 files changed:
arch/sparc/Kconfig
arch/sparc/include/asm/uaccess_32.h
arch/sparc/include/asm/uaccess_64.h
arch/sparc/lib/GENcopy_from_user.S
arch/sparc/lib/GENcopy_to_user.S
arch/sparc/lib/GENpatch.S
arch/sparc/lib/NG2copy_from_user.S
arch/sparc/lib/NG2copy_to_user.S
arch/sparc/lib/NG2patch.S
arch/sparc/lib/NG4copy_from_user.S
arch/sparc/lib/NG4copy_to_user.S
arch/sparc/lib/NG4patch.S
arch/sparc/lib/NGcopy_from_user.S
arch/sparc/lib/NGcopy_to_user.S
arch/sparc/lib/NGpatch.S
arch/sparc/lib/U1copy_from_user.S
arch/sparc/lib/U1copy_to_user.S
arch/sparc/lib/U3copy_to_user.S
arch/sparc/lib/U3patch.S
arch/sparc/lib/copy_in_user.S
arch/sparc/lib/copy_user.S

index 68ac5c7cd982619581dfa65b75ac89aa8e359554..68353048f24e7645b6ebddf5a0a0f5b9acf1f7bd 100644 (file)
@@ -45,6 +45,7 @@ config SPARC
        select HAVE_ARCH_HARDENED_USERCOPY
        select PROVE_LOCKING_SMALL if PROVE_LOCKING
        select ARCH_WANT_RELAX_ORDER
+       select ARCH_HAS_RAW_COPY_USER
 
 config SPARC32
        def_bool !64BIT
index 93910845733a62115606e678e80c444d8c2e0008..12ebee2d97c7bc1b61c9afe65e996ca039aafc7e 100644 (file)
@@ -235,39 +235,18 @@ int __get_user_bad(void);
 
 unsigned long __copy_user(void __user *to, const void __user *from, unsigned long size);
 
-static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n)
+static inline unsigned long raw_copy_to_user(void __user *to, const void *from, unsigned long n)
 {
-       if (n && __access_ok((unsigned long) to, n)) {
-               check_object_size(from, n, true);
-               return __copy_user(to, (__force void __user *) from, n);
-       } else
-               return n;
-}
-
-static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n)
-{
-       check_object_size(from, n, true);
        return __copy_user(to, (__force void __user *) from, n);
 }
 
-static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
-{
-       if (n && __access_ok((unsigned long) from, n)) {
-               check_object_size(to, n, false);
-               return __copy_user((__force void __user *) to, from, n);
-       } else {
-               memset(to, 0, n);
-               return n;
-       }
-}
-
-static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)
+static inline unsigned long raw_copy_from_user(void *to, const void __user *from, unsigned long n)
 {
        return __copy_user((__force void __user *) to, from, n);
 }
 
-#define __copy_to_user_inatomic __copy_to_user
-#define __copy_from_user_inatomic __copy_from_user
+#define INLINE_COPY_FROM_USER
+#define INLINE_COPY_TO_USER
 
 static inline unsigned long __clear_user(void __user *addr, unsigned long size)
 {
index 7afb4f64553f9b0ac0b0cee88ed8b5cd51b55204..6096d671aa63a797a92fdc13a62a4607d9766c72 100644 (file)
@@ -176,39 +176,19 @@ __asm__ __volatile__(                                                     \
 
 int __get_user_bad(void);
 
-unsigned long __must_check ___copy_from_user(void *to,
+unsigned long __must_check raw_copy_from_user(void *to,
                                             const void __user *from,
                                             unsigned long size);
-static inline unsigned long __must_check
-copy_from_user(void *to, const void __user *from, unsigned long size)
-{
-       check_object_size(to, size, false);
-
-       return ___copy_from_user(to, from, size);
-}
-#define __copy_from_user copy_from_user
 
-unsigned long __must_check ___copy_to_user(void __user *to,
+unsigned long __must_check raw_copy_to_user(void __user *to,
                                           const void *from,
                                           unsigned long size);
-static inline unsigned long __must_check
-copy_to_user(void __user *to, const void *from, unsigned long size)
-{
-       check_object_size(from, size, true);
+#define INLINE_COPY_FROM_USER
+#define INLINE_COPY_TO_USER
 
-       return ___copy_to_user(to, from, size);
-}
-#define __copy_to_user copy_to_user
-
-unsigned long __must_check ___copy_in_user(void __user *to,
+unsigned long __must_check raw_copy_in_user(void __user *to,
                                           const void __user *from,
                                           unsigned long size);
-static inline unsigned long __must_check
-copy_in_user(void __user *to, void __user *from, unsigned long size)
-{
-       return ___copy_in_user(to, from, size);
-}
-#define __copy_in_user copy_in_user
 
 unsigned long __must_check __clear_user(void __user *, unsigned long);
 
@@ -217,9 +197,6 @@ unsigned long __must_check __clear_user(void __user *, unsigned long);
 __must_check long strlen_user(const char __user *str);
 __must_check long strnlen_user(const char __user *str, long n);
 
-#define __copy_to_user_inatomic __copy_to_user
-#define __copy_from_user_inatomic __copy_from_user
-
 struct pt_regs;
 unsigned long compute_effective_address(struct pt_regs *,
                                        unsigned int insn,
index 69a439fa2fc1ac809a969d6651e9b9e0f9be11b9..8aa16ef113f2b5dd68a3cba18908213a26f2df80 100644 (file)
@@ -23,7 +23,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, ___copy_in_user;          \
+       bne,pn          %icc, raw_copy_in_user;         \
         nop
 #endif
 
index 9947427ce3549799b2e0c5592b3f972e516093ed..311c8fa5e98eedfb1a006f6c5e00a3e605761a0c 100644 (file)
@@ -27,7 +27,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, ___copy_in_user;          \
+       bne,pn          %icc, raw_copy_in_user;         \
         nop
 #endif
 
index fab9e89f16bddab127ba7775791b404163d2b690..95e2f1f9e477d6915fbfc43ad14d945ec1429b9d 100644 (file)
@@ -26,8 +26,8 @@
        .type   generic_patch_copyops,#function
 generic_patch_copyops:
        GEN_DO_PATCH(memcpy, GENmemcpy)
-       GEN_DO_PATCH(___copy_from_user, GENcopy_from_user)
-       GEN_DO_PATCH(___copy_to_user, GENcopy_to_user)
+       GEN_DO_PATCH(raw_copy_from_user, GENcopy_from_user)
+       GEN_DO_PATCH(raw_copy_to_user, GENcopy_to_user)
        retl
         nop
        .size   generic_patch_copyops,.-generic_patch_copyops
index b79a6998d87c82eaeb12f5c1c23ab8fcbc8b10de..0d8a018118c239b72ae8b5ece5656561bad7ae4a 100644 (file)
@@ -36,7 +36,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, ___copy_in_user;          \
+       bne,pn          %icc, raw_copy_in_user;         \
         nop
 #endif
 
index dcec55f254ab214dc9aa959c4a575ed58f5a19d8..a7a0ea0d8a0bea97fec7e80c488a42f484e7ba6d 100644 (file)
@@ -45,7 +45,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, ___copy_in_user;          \
+       bne,pn          %icc, raw_copy_in_user;         \
         nop
 #endif
 
index 28c36f06a6d1e9084be3222a8a2d97c4966205fa..56ccc19adde801e76d5b8e8a86783131a50c8361 100644 (file)
@@ -26,8 +26,8 @@
        .type   niagara2_patch_copyops,#function
 niagara2_patch_copyops:
        NG_DO_PATCH(memcpy, NG2memcpy)
-       NG_DO_PATCH(___copy_from_user, NG2copy_from_user)
-       NG_DO_PATCH(___copy_to_user, NG2copy_to_user)
+       NG_DO_PATCH(raw_copy_from_user, NG2copy_from_user)
+       NG_DO_PATCH(raw_copy_to_user, NG2copy_to_user)
        retl
         nop
        .size   niagara2_patch_copyops,.-niagara2_patch_copyops
index 16a286c1a52836ee92b2a7d6bac66d3341b0f905..5bb506bd61fada7575c11e0c240c6ef4f6b13f9c 100644 (file)
@@ -31,7 +31,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, ___copy_in_user;          \
+       bne,pn          %icc, raw_copy_in_user;         \
         nop
 #endif
 
index 6b0276ffc858c4777d95dffcff95f048dd340cc2..a82d4d45fc1c38c1a0001c30f05eaab3ea3c046a 100644 (file)
@@ -40,7 +40,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, ___copy_in_user;          \
+       bne,pn          %icc, raw_copy_in_user;         \
         nop
 #endif
 
index a114cbcf2a48fa679f09c8675714f47cf16a1f65..3cc0f8cc95df175a542f0c6962006a9163a93517 100644 (file)
@@ -26,8 +26,8 @@
        .type   niagara4_patch_copyops,#function
 niagara4_patch_copyops:
        NG_DO_PATCH(memcpy, NG4memcpy)
-       NG_DO_PATCH(___copy_from_user, NG4copy_from_user)
-       NG_DO_PATCH(___copy_to_user, NG4copy_to_user)
+       NG_DO_PATCH(raw_copy_from_user, NG4copy_from_user)
+       NG_DO_PATCH(raw_copy_to_user, NG4copy_to_user)
        retl
         nop
        .size   niagara4_patch_copyops,.-niagara4_patch_copyops
index 9cd42fcbc781152ca95e3c8051962ea7de1538a9..2333b6f3e82409ce4c3cf480670e154dfe9db2e4 100644 (file)
@@ -25,7 +25,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, ___copy_in_user;          \
+       bne,pn          %icc, raw_copy_in_user;         \
         nop
 #endif
 
index 5c358afd464e24f3513cb6716f2983ca9f201dff..07ba20bc4ea4a620f50afbf7c364f49a66d9b270 100644 (file)
@@ -28,7 +28,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, ___copy_in_user;          \
+       bne,pn          %icc, raw_copy_in_user;         \
         nop
 #endif
 
index 3b0674fc336630844be3ab8f0e5e174816e7a4e5..62ccda7e7b389c193a0552d8718f6e1ae88f6d5f 100644 (file)
@@ -26,8 +26,8 @@
        .type   niagara_patch_copyops,#function
 niagara_patch_copyops:
        NG_DO_PATCH(memcpy, NGmemcpy)
-       NG_DO_PATCH(___copy_from_user, NGcopy_from_user)
-       NG_DO_PATCH(___copy_to_user, NGcopy_to_user)
+       NG_DO_PATCH(raw_copy_from_user, NGcopy_from_user)
+       NG_DO_PATCH(raw_copy_to_user, NGcopy_to_user)
        retl
         nop
        .size   niagara_patch_copyops,.-niagara_patch_copyops
index bb6ff73229e3e5e7eac225389db53c27d989abc1..9a6e68a9bf4ade1746772bd3ad71b7e2f4f3ec4f 100644 (file)
@@ -19,7 +19,7 @@
        .text;                  \
        .align 4;
 
-#define FUNC_NAME              ___copy_from_user
+#define FUNC_NAME              raw_copy_from_user
 #define LOAD(type,addr,dest)   type##a [addr] %asi, dest
 #define LOAD_BLK(addr,dest)    ldda [addr] ASI_BLK_AIUS, dest
 #define EX_RETVAL(x)           0
@@ -31,7 +31,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, ___copy_in_user;          \
+       bne,pn          %icc, raw_copy_in_user;         \
         nop;                                           \
 
 #include "U1memcpy.S"
index ed92ce73955889dba9faa8f028b7e5e6c4326ecf..d7b28491eddf9091522515374fba7f0755fe7619 100644 (file)
@@ -19,7 +19,7 @@
        .text;                  \
        .align 4;
 
-#define FUNC_NAME              ___copy_to_user
+#define FUNC_NAME              raw_copy_to_user
 #define STORE(type,src,addr)   type##a src, [addr] ASI_AIUS
 #define STORE_BLK(src,addr)    stda src, [addr] ASI_BLK_AIUS
 #define EX_RETVAL(x)           0
@@ -31,7 +31,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, ___copy_in_user;          \
+       bne,pn          %icc, raw_copy_in_user;         \
         nop;                                           \
 
 #include "U1memcpy.S"
index c4ee858e352a2be0e028ac757dd399938e89db04..f48fb87fe9f218daa6ca9c21665255126d62296b 100644 (file)
@@ -31,7 +31,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, ___copy_in_user;          \
+       bne,pn          %icc, raw_copy_in_user;         \
         nop;                                           \
 
 #include "U3memcpy.S"
index ecc302619a6ed387b6d09dda8ae1d32944b97322..91cd6539b6e1742e1fc75838fdcf432088a66fa1 100644 (file)
@@ -26,8 +26,8 @@
        .type   cheetah_patch_copyops,#function
 cheetah_patch_copyops:
        ULTRA3_DO_PATCH(memcpy, U3memcpy)
-       ULTRA3_DO_PATCH(___copy_from_user, U3copy_from_user)
-       ULTRA3_DO_PATCH(___copy_to_user, U3copy_to_user)
+       ULTRA3_DO_PATCH(raw_copy_from_user, U3copy_from_user)
+       ULTRA3_DO_PATCH(raw_copy_to_user, U3copy_to_user)
        retl
         nop
        .size   cheetah_patch_copyops,.-cheetah_patch_copyops
index 0252b218de45ac0685c440de07d0d2d0891834e9..1b73bb80aeb0db5a4201b1eaec0d4e12bacba329 100644 (file)
@@ -44,7 +44,7 @@ __retl_o2_plus_1:
         * to copy register windows around during thread cloning.
         */
 
-ENTRY(___copy_in_user) /* %o0=dst, %o1=src, %o2=len */
+ENTRY(raw_copy_in_user)        /* %o0=dst, %o1=src, %o2=len */
        cmp             %o2, 0
        be,pn           %XCC, 85f
         or             %o0, %o1, %o3
@@ -105,5 +105,5 @@ ENTRY(___copy_in_user)      /* %o0=dst, %o1=src, %o2=len */
         add            %o0, 1, %o0
        retl
         clr            %o0
-ENDPROC(___copy_in_user)
-EXPORT_SYMBOL(___copy_in_user)
+ENDPROC(raw_copy_in_user)
+EXPORT_SYMBOL(raw_copy_in_user)
index cea644dc67a628e8db216d6d5934fad2ec15e899..bc243ee807cc0e39981c7256e006439923c14f3e 100644 (file)
@@ -364,21 +364,7 @@ short_aligned_end:
 97:
        mov     %o2, %g3
 fixupretl:
-       sethi   %hi(PAGE_OFFSET), %g1
-       cmp     %o0, %g1
-       blu     1f
-        cmp    %o1, %g1
-       bgeu    1f
-        ld     [%g6 + TI_PREEMPT], %g1
-       cmp     %g1, 0
-       bne     1f
-        nop
-       save    %sp, -64, %sp
-       mov     %i0, %o0
-       call    __bzero
-        mov    %g3, %o1
-       restore
-1:     retl
+       retl
         mov    %g3, %o0
 
 /* exception routine sets %g2 to (broken_insn - first_insn)>>2 */