aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-08-15 17:47:54 -0400
committerDavid S. Miller <davem@davemloft.net>2016-10-24 14:31:58 -0400
commit83a17d2661674d8c198adc0e183418f72aabab79 (patch)
treedfda84fcce63b99268c872b9264e302e4dc8f13c /arch/sparc
parentaa95ce361ed95c72ac42dcb315166bce5cf1a014 (diff)
sparc64: Prepare to move to more saner user copy exception handling.
The fixup helper function mechanism for handling user copy fault handling is not %100 accurrate, and can never be made so. We are going to transition the code to return the running return return length, which is always kept track in one or more registers of each of these routines. In order to convert them one by one, we have to allow the existing behavior to continue functioning. Therefore make all the copy code that wants the fixup helper to be used return negative one. After all of the user copy routines have been converted, this logic and the fixup helpers themselves can be removed completely. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/include/asm/uaccess_64.h21
-rw-r--r--arch/sparc/kernel/head_64.S23
-rw-r--r--arch/sparc/lib/GENcopy_from_user.S2
-rw-r--r--arch/sparc/lib/GENcopy_to_user.S2
-rw-r--r--arch/sparc/lib/NG2copy_from_user.S4
-rw-r--r--arch/sparc/lib/NG2copy_to_user.S4
-rw-r--r--arch/sparc/lib/NG4copy_from_user.S4
-rw-r--r--arch/sparc/lib/NG4copy_to_user.S4
-rw-r--r--arch/sparc/lib/NGcopy_from_user.S2
-rw-r--r--arch/sparc/lib/NGcopy_to_user.S2
-rw-r--r--arch/sparc/lib/U1copy_from_user.S4
-rw-r--r--arch/sparc/lib/U1copy_to_user.S4
-rw-r--r--arch/sparc/lib/U3copy_from_user.S4
-rw-r--r--arch/sparc/lib/U3copy_to_user.S4
-rw-r--r--arch/sparc/lib/copy_in_user.S2
15 files changed, 47 insertions, 39 deletions
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h
index f8518df34b63..0244012435c8 100644
--- a/arch/sparc/include/asm/uaccess_64.h
+++ b/arch/sparc/include/asm/uaccess_64.h
@@ -198,8 +198,11 @@ copy_from_user(void *to, const void __user *from, unsigned long size)
198 check_object_size(to, size, false); 198 check_object_size(to, size, false);
199 199
200 ret = ___copy_from_user(to, from, size); 200 ret = ___copy_from_user(to, from, size);
201 if (unlikely(ret)) 201 if (unlikely(ret)) {
202 ret = copy_from_user_fixup(to, from, size); 202 if ((long)ret < 0)
203 ret = copy_from_user_fixup(to, from, size);
204 return ret;
205 }
203 206
204 return ret; 207 return ret;
205} 208}
@@ -218,8 +221,11 @@ copy_to_user(void __user *to, const void *from, unsigned long size)
218 check_object_size(from, size, true); 221 check_object_size(from, size, true);
219 222
220 ret = ___copy_to_user(to, from, size); 223 ret = ___copy_to_user(to, from, size);
221 if (unlikely(ret)) 224 if (unlikely(ret)) {
222 ret = copy_to_user_fixup(to, from, size); 225 if ((long)ret < 0)
226 ret = copy_to_user_fixup(to, from, size);
227 return ret;
228 }
223 return ret; 229 return ret;
224} 230}
225#define __copy_to_user copy_to_user 231#define __copy_to_user copy_to_user
@@ -234,8 +240,11 @@ copy_in_user(void __user *to, void __user *from, unsigned long size)
234{ 240{
235 unsigned long ret = ___copy_in_user(to, from, size); 241 unsigned long ret = ___copy_in_user(to, from, size);
236 242
237 if (unlikely(ret)) 243 if (unlikely(ret)) {
238 ret = copy_in_user_fixup(to, from, size); 244 if ((long)ret < 0)
245 ret = copy_in_user_fixup(to, from, size);
246 return ret;
247 }
239 return ret; 248 return ret;
240} 249}
241#define __copy_in_user copy_in_user 250#define __copy_in_user copy_in_user
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index 603d73654295..5f17de6b5fc3 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -926,41 +926,40 @@ tlb_type: .word 0 /* Must NOT end up in BSS */
926EXPORT_SYMBOL(tlb_type) 926EXPORT_SYMBOL(tlb_type)
927 .section ".fixup",#alloc,#execinstr 927 .section ".fixup",#alloc,#execinstr
928 928
929 .globl __retl_efault, __ret_one, __retl_one
930ENTRY(__retl_efault) 929ENTRY(__retl_efault)
931 retl 930 retl
932 mov -EFAULT, %o0 931 mov -EFAULT, %o0
933ENDPROC(__retl_efault) 932ENDPROC(__retl_efault)
934 933
935ENTRY(__retl_one) 934ENTRY(__retl_mone)
936 retl 935 retl
937 mov 1, %o0 936 mov -1, %o0
938ENDPROC(__retl_one) 937ENDPROC(__retl_mone)
939 938
940ENTRY(__retl_one_fp) 939ENTRY(__retl_mone_fp)
941 VISExitHalf 940 VISExitHalf
942 retl 941 retl
943 mov 1, %o0 942 mov 1, %o0
944ENDPROC(__retl_one_fp) 943ENDPROC(__retl_mone_fp)
945 944
946ENTRY(__ret_one_asi) 945ENTRY(__ret_mone_asi)
947 wr %g0, ASI_AIUS, %asi 946 wr %g0, ASI_AIUS, %asi
948 ret 947 ret
949 restore %g0, 1, %o0 948 restore %g0, 1, %o0
950ENDPROC(__ret_one_asi) 949ENDPROC(__ret_mone_asi)
951 950
952ENTRY(__retl_one_asi) 951ENTRY(__retl_mone_asi)
953 wr %g0, ASI_AIUS, %asi 952 wr %g0, ASI_AIUS, %asi
954 retl 953 retl
955 mov 1, %o0 954 mov 1, %o0
956ENDPROC(__retl_one_asi) 955ENDPROC(__retl_mone_asi)
957 956
958ENTRY(__retl_one_asi_fp) 957ENTRY(__retl_mone_asi_fp)
959 wr %g0, ASI_AIUS, %asi 958 wr %g0, ASI_AIUS, %asi
960 VISExitHalf 959 VISExitHalf
961 retl 960 retl
962 mov 1, %o0 961 mov 1, %o0
963ENDPROC(__retl_one_asi_fp) 962ENDPROC(__retl_mone_asi_fp)
964 963
965ENTRY(__retl_o1) 964ENTRY(__retl_o1)
966 retl 965 retl
diff --git a/arch/sparc/lib/GENcopy_from_user.S b/arch/sparc/lib/GENcopy_from_user.S
index b7d0bd6b1406..5bce68202246 100644
--- a/arch/sparc/lib/GENcopy_from_user.S
+++ b/arch/sparc/lib/GENcopy_from_user.S
@@ -7,7 +7,7 @@
798: x; \ 798: x; \
8 .section __ex_table,"a";\ 8 .section __ex_table,"a";\
9 .align 4; \ 9 .align 4; \
10 .word 98b, __retl_one; \ 10 .word 98b, __retl_mone; \
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
diff --git a/arch/sparc/lib/GENcopy_to_user.S b/arch/sparc/lib/GENcopy_to_user.S
index 780550e1afc7..f663ce3ee8d9 100644
--- a/arch/sparc/lib/GENcopy_to_user.S
+++ b/arch/sparc/lib/GENcopy_to_user.S
@@ -7,7 +7,7 @@
798: x; \ 798: x; \
8 .section __ex_table,"a";\ 8 .section __ex_table,"a";\
9 .align 4; \ 9 .align 4; \
10 .word 98b, __retl_one; \ 10 .word 98b, __retl_mone; \
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
diff --git a/arch/sparc/lib/NG2copy_from_user.S b/arch/sparc/lib/NG2copy_from_user.S
index d5242b8c4f94..4d47fa5519d4 100644
--- a/arch/sparc/lib/NG2copy_from_user.S
+++ b/arch/sparc/lib/NG2copy_from_user.S
@@ -7,7 +7,7 @@
798: x; \ 798: x; \
8 .section __ex_table,"a";\ 8 .section __ex_table,"a";\
9 .align 4; \ 9 .align 4; \
10 .word 98b, __retl_one_asi;\ 10 .word 98b, __retl_mone_asi;\
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
@@ -15,7 +15,7 @@
1598: x; \ 1598: x; \
16 .section __ex_table,"a";\ 16 .section __ex_table,"a";\
17 .align 4; \ 17 .align 4; \
18 .word 98b, __retl_one_asi_fp;\ 18 .word 98b, __retl_mone_asi_fp;\
19 .text; \ 19 .text; \
20 .align 4; 20 .align 4;
21 21
diff --git a/arch/sparc/lib/NG2copy_to_user.S b/arch/sparc/lib/NG2copy_to_user.S
index 4e962d993b10..2078d752709a 100644
--- a/arch/sparc/lib/NG2copy_to_user.S
+++ b/arch/sparc/lib/NG2copy_to_user.S
@@ -7,7 +7,7 @@
798: x; \ 798: x; \
8 .section __ex_table,"a";\ 8 .section __ex_table,"a";\
9 .align 4; \ 9 .align 4; \
10 .word 98b, __retl_one_asi;\ 10 .word 98b, __retl_mone_asi;\
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
@@ -15,7 +15,7 @@
1598: x; \ 1598: x; \
16 .section __ex_table,"a";\ 16 .section __ex_table,"a";\
17 .align 4; \ 17 .align 4; \
18 .word 98b, __retl_one_asi_fp;\ 18 .word 98b, __retl_mone_asi_fp;\
19 .text; \ 19 .text; \
20 .align 4; 20 .align 4;
21 21
diff --git a/arch/sparc/lib/NG4copy_from_user.S b/arch/sparc/lib/NG4copy_from_user.S
index 2e8ee7ad07a9..f9746e7cf25e 100644
--- a/arch/sparc/lib/NG4copy_from_user.S
+++ b/arch/sparc/lib/NG4copy_from_user.S
@@ -7,7 +7,7 @@
798: x; \ 798: x; \
8 .section __ex_table,"a";\ 8 .section __ex_table,"a";\
9 .align 4; \ 9 .align 4; \
10 .word 98b, __retl_one_asi;\ 10 .word 98b, __retl_mone_asi;\
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
@@ -15,7 +15,7 @@
1598: x; \ 1598: x; \
16 .section __ex_table,"a";\ 16 .section __ex_table,"a";\
17 .align 4; \ 17 .align 4; \
18 .word 98b, __retl_one_asi_fp;\ 18 .word 98b, __retl_mone_asi_fp;\
19 .text; \ 19 .text; \
20 .align 4; 20 .align 4;
21 21
diff --git a/arch/sparc/lib/NG4copy_to_user.S b/arch/sparc/lib/NG4copy_to_user.S
index be0bf4590df8..5fa44349adde 100644
--- a/arch/sparc/lib/NG4copy_to_user.S
+++ b/arch/sparc/lib/NG4copy_to_user.S
@@ -7,7 +7,7 @@
798: x; \ 798: x; \
8 .section __ex_table,"a";\ 8 .section __ex_table,"a";\
9 .align 4; \ 9 .align 4; \
10 .word 98b, __retl_one_asi;\ 10 .word 98b, __retl_mone_asi;\
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
@@ -15,7 +15,7 @@
1598: x; \ 1598: x; \
16 .section __ex_table,"a";\ 16 .section __ex_table,"a";\
17 .align 4; \ 17 .align 4; \
18 .word 98b, __retl_one_asi_fp;\ 18 .word 98b, __retl_mone_asi_fp;\
19 .text; \ 19 .text; \
20 .align 4; 20 .align 4;
21 21
diff --git a/arch/sparc/lib/NGcopy_from_user.S b/arch/sparc/lib/NGcopy_from_user.S
index 5d1e4d1ac21e..e61694c444af 100644
--- a/arch/sparc/lib/NGcopy_from_user.S
+++ b/arch/sparc/lib/NGcopy_from_user.S
@@ -7,7 +7,7 @@
798: x; \ 798: x; \
8 .section __ex_table,"a";\ 8 .section __ex_table,"a";\
9 .align 4; \ 9 .align 4; \
10 .word 98b, __ret_one_asi;\ 10 .word 98b, __ret_mone_asi;\
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
diff --git a/arch/sparc/lib/NGcopy_to_user.S b/arch/sparc/lib/NGcopy_to_user.S
index ff630dcb273c..2d6b33d3998f 100644
--- a/arch/sparc/lib/NGcopy_to_user.S
+++ b/arch/sparc/lib/NGcopy_to_user.S
@@ -7,7 +7,7 @@
798: x; \ 798: x; \
8 .section __ex_table,"a";\ 8 .section __ex_table,"a";\
9 .align 4; \ 9 .align 4; \
10 .word 98b, __ret_one_asi;\ 10 .word 98b, __ret_mone_asi;\
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
diff --git a/arch/sparc/lib/U1copy_from_user.S b/arch/sparc/lib/U1copy_from_user.S
index ecc5692fa2b4..1ad59fbac7a7 100644
--- a/arch/sparc/lib/U1copy_from_user.S
+++ b/arch/sparc/lib/U1copy_from_user.S
@@ -7,7 +7,7 @@
798: x; \ 798: x; \
8 .section __ex_table,"a";\ 8 .section __ex_table,"a";\
9 .align 4; \ 9 .align 4; \
10 .word 98b, __retl_one; \ 10 .word 98b, __retl_mone; \
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
@@ -15,7 +15,7 @@
1598: x; \ 1598: x; \
16 .section __ex_table,"a";\ 16 .section __ex_table,"a";\
17 .align 4; \ 17 .align 4; \
18 .word 98b, __retl_one_fp;\ 18 .word 98b, __retl_mone_fp;\
19 .text; \ 19 .text; \
20 .align 4; 20 .align 4;
21 21
diff --git a/arch/sparc/lib/U1copy_to_user.S b/arch/sparc/lib/U1copy_to_user.S
index 9eea392e44d4..adcc3a510185 100644
--- a/arch/sparc/lib/U1copy_to_user.S
+++ b/arch/sparc/lib/U1copy_to_user.S
@@ -7,7 +7,7 @@
798: x; \ 798: x; \
8 .section __ex_table,"a";\ 8 .section __ex_table,"a";\
9 .align 4; \ 9 .align 4; \
10 .word 98b, __retl_one; \ 10 .word 98b, __retl_mone; \
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
@@ -15,7 +15,7 @@
1598: x; \ 1598: x; \
16 .section __ex_table,"a";\ 16 .section __ex_table,"a";\
17 .align 4; \ 17 .align 4; \
18 .word 98b, __retl_one_fp;\ 18 .word 98b, __retl_mone_fp;\
19 .text; \ 19 .text; \
20 .align 4; 20 .align 4;
21 21
diff --git a/arch/sparc/lib/U3copy_from_user.S b/arch/sparc/lib/U3copy_from_user.S
index 88ad73d86fe4..1046e2b083fe 100644
--- a/arch/sparc/lib/U3copy_from_user.S
+++ b/arch/sparc/lib/U3copy_from_user.S
@@ -7,7 +7,7 @@
798: x; \ 798: x; \
8 .section __ex_table,"a";\ 8 .section __ex_table,"a";\
9 .align 4; \ 9 .align 4; \
10 .word 98b, __retl_one; \ 10 .word 98b, __retl_mone; \
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
@@ -15,7 +15,7 @@
1598: x; \ 1598: x; \
16 .section __ex_table,"a";\ 16 .section __ex_table,"a";\
17 .align 4; \ 17 .align 4; \
18 .word 98b, __retl_one_fp;\ 18 .word 98b, __retl_mone_fp;\
19 .text; \ 19 .text; \
20 .align 4; 20 .align 4;
21 21
diff --git a/arch/sparc/lib/U3copy_to_user.S b/arch/sparc/lib/U3copy_to_user.S
index 845139d75537..032b0c5419b0 100644
--- a/arch/sparc/lib/U3copy_to_user.S
+++ b/arch/sparc/lib/U3copy_to_user.S
@@ -7,7 +7,7 @@
798: x; \ 798: x; \
8 .section __ex_table,"a";\ 8 .section __ex_table,"a";\
9 .align 4; \ 9 .align 4; \
10 .word 98b, __retl_one; \ 10 .word 98b, __retl_mone; \
11 .text; \ 11 .text; \
12 .align 4; 12 .align 4;
13 13
@@ -15,7 +15,7 @@
1598: x; \ 1598: x; \
16 .section __ex_table,"a";\ 16 .section __ex_table,"a";\
17 .align 4; \ 17 .align 4; \
18 .word 98b, __retl_one_fp;\ 18 .word 98b, __retl_mone_fp;\
19 .text; \ 19 .text; \
20 .align 4; 20 .align 4;
21 21
diff --git a/arch/sparc/lib/copy_in_user.S b/arch/sparc/lib/copy_in_user.S
index 482de093bdae..86e6663dd4e0 100644
--- a/arch/sparc/lib/copy_in_user.S
+++ b/arch/sparc/lib/copy_in_user.S
@@ -13,7 +13,7 @@
1398: x,y; \ 1398: x,y; \
14 .section __ex_table,"a";\ 14 .section __ex_table,"a";\
15 .align 4; \ 15 .align 4; \
16 .word 98b, __retl_one; \ 16 .word 98b, __retl_mone; \
17 .text; \ 17 .text; \
18 .align 4; 18 .align 4;
19 19