Commit 83a17d26 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parent aa95ce36
...@@ -198,8 +198,11 @@ copy_from_user(void *to, const void __user *from, unsigned long size) ...@@ -198,8 +198,11 @@ copy_from_user(void *to, const void __user *from, unsigned long size)
check_object_size(to, size, false); check_object_size(to, size, false);
ret = ___copy_from_user(to, from, size); ret = ___copy_from_user(to, from, size);
if (unlikely(ret)) if (unlikely(ret)) {
if ((long)ret < 0)
ret = copy_from_user_fixup(to, from, size); ret = copy_from_user_fixup(to, from, size);
return ret;
}
return ret; return ret;
} }
...@@ -218,9 +221,12 @@ copy_to_user(void __user *to, const void *from, unsigned long size) ...@@ -218,9 +221,12 @@ copy_to_user(void __user *to, const void *from, unsigned long size)
check_object_size(from, size, true); check_object_size(from, size, true);
ret = ___copy_to_user(to, from, size); ret = ___copy_to_user(to, from, size);
if (unlikely(ret)) if (unlikely(ret)) {
if ((long)ret < 0)
ret = copy_to_user_fixup(to, from, size); ret = copy_to_user_fixup(to, from, size);
return ret; return ret;
}
return ret;
} }
#define __copy_to_user copy_to_user #define __copy_to_user copy_to_user
...@@ -234,9 +240,12 @@ copy_in_user(void __user *to, void __user *from, unsigned long size) ...@@ -234,9 +240,12 @@ copy_in_user(void __user *to, void __user *from, unsigned long size)
{ {
unsigned long ret = ___copy_in_user(to, from, size); unsigned long ret = ___copy_in_user(to, from, size);
if (unlikely(ret)) if (unlikely(ret)) {
if ((long)ret < 0)
ret = copy_in_user_fixup(to, from, size); ret = copy_in_user_fixup(to, from, size);
return ret; return ret;
}
return ret;
} }
#define __copy_in_user copy_in_user #define __copy_in_user copy_in_user
......
...@@ -926,41 +926,40 @@ tlb_type: .word 0 /* Must NOT end up in BSS */ ...@@ -926,41 +926,40 @@ tlb_type: .word 0 /* Must NOT end up in BSS */
EXPORT_SYMBOL(tlb_type) EXPORT_SYMBOL(tlb_type)
.section ".fixup",#alloc,#execinstr .section ".fixup",#alloc,#execinstr
.globl __retl_efault, __ret_one, __retl_one
ENTRY(__retl_efault) ENTRY(__retl_efault)
retl retl
mov -EFAULT, %o0 mov -EFAULT, %o0
ENDPROC(__retl_efault) ENDPROC(__retl_efault)
ENTRY(__retl_one) ENTRY(__retl_mone)
retl retl
mov 1, %o0 mov -1, %o0
ENDPROC(__retl_one) ENDPROC(__retl_mone)
ENTRY(__retl_one_fp) ENTRY(__retl_mone_fp)
VISExitHalf VISExitHalf
retl retl
mov 1, %o0 mov 1, %o0
ENDPROC(__retl_one_fp) ENDPROC(__retl_mone_fp)
ENTRY(__ret_one_asi) ENTRY(__ret_mone_asi)
wr %g0, ASI_AIUS, %asi wr %g0, ASI_AIUS, %asi
ret ret
restore %g0, 1, %o0 restore %g0, 1, %o0
ENDPROC(__ret_one_asi) ENDPROC(__ret_mone_asi)
ENTRY(__retl_one_asi) ENTRY(__retl_mone_asi)
wr %g0, ASI_AIUS, %asi wr %g0, ASI_AIUS, %asi
retl retl
mov 1, %o0 mov 1, %o0
ENDPROC(__retl_one_asi) ENDPROC(__retl_mone_asi)
ENTRY(__retl_one_asi_fp) ENTRY(__retl_mone_asi_fp)
wr %g0, ASI_AIUS, %asi wr %g0, ASI_AIUS, %asi
VISExitHalf VISExitHalf
retl retl
mov 1, %o0 mov 1, %o0
ENDPROC(__retl_one_asi_fp) ENDPROC(__retl_mone_asi_fp)
ENTRY(__retl_o1) ENTRY(__retl_o1)
retl retl
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one; \ .word 98b, __retl_mone; \
.text; \ .text; \
.align 4; .align 4;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one; \ .word 98b, __retl_mone; \
.text; \ .text; \
.align 4; .align 4;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one_asi;\ .word 98b, __retl_mone_asi;\
.text; \ .text; \
.align 4; .align 4;
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one_asi_fp;\ .word 98b, __retl_mone_asi_fp;\
.text; \ .text; \
.align 4; .align 4;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one_asi;\ .word 98b, __retl_mone_asi;\
.text; \ .text; \
.align 4; .align 4;
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one_asi_fp;\ .word 98b, __retl_mone_asi_fp;\
.text; \ .text; \
.align 4; .align 4;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one_asi;\ .word 98b, __retl_mone_asi;\
.text; \ .text; \
.align 4; .align 4;
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one_asi_fp;\ .word 98b, __retl_mone_asi_fp;\
.text; \ .text; \
.align 4; .align 4;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one_asi;\ .word 98b, __retl_mone_asi;\
.text; \ .text; \
.align 4; .align 4;
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one_asi_fp;\ .word 98b, __retl_mone_asi_fp;\
.text; \ .text; \
.align 4; .align 4;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __ret_one_asi;\ .word 98b, __ret_mone_asi;\
.text; \ .text; \
.align 4; .align 4;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __ret_one_asi;\ .word 98b, __ret_mone_asi;\
.text; \ .text; \
.align 4; .align 4;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one; \ .word 98b, __retl_mone; \
.text; \ .text; \
.align 4; .align 4;
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one_fp;\ .word 98b, __retl_mone_fp;\
.text; \ .text; \
.align 4; .align 4;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one; \ .word 98b, __retl_mone; \
.text; \ .text; \
.align 4; .align 4;
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one_fp;\ .word 98b, __retl_mone_fp;\
.text; \ .text; \
.align 4; .align 4;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one; \ .word 98b, __retl_mone; \
.text; \ .text; \
.align 4; .align 4;
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one_fp;\ .word 98b, __retl_mone_fp;\
.text; \ .text; \
.align 4; .align 4;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one; \ .word 98b, __retl_mone; \
.text; \ .text; \
.align 4; .align 4;
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
98: x; \ 98: x; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one_fp;\ .word 98b, __retl_mone_fp;\
.text; \ .text; \
.align 4; .align 4;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
98: x,y; \ 98: x,y; \
.section __ex_table,"a";\ .section __ex_table,"a";\
.align 4; \ .align 4; \
.word 98b, __retl_one; \ .word 98b, __retl_mone; \
.text; \ .text; \
.align 4; .align 4;
......
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