diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2006-08-30 08:33:30 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2006-08-30 08:33:30 -0400 |
commit | af313e5a4f56b248767d667c3c2436dda767df77 (patch) | |
tree | 7cc495fcd98841375a3f3a6a574dd6d9fcd7a7c2 | |
parent | dc709bd190c130b299ac19d596594256265c042a (diff) |
[S390] broken copy_in_user function.
The copy_in_user primitive does not work as advertised. If the source
and target area are available copy_in_user copies one byte too much.
If one of the memory areas is not available it does not copy as much
data as it can, but up to 257 bytes less.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/lib/uaccess.S | 33 | ||||
-rw-r--r-- | arch/s390/lib/uaccess64.S | 35 |
2 files changed, 35 insertions, 33 deletions
diff --git a/arch/s390/lib/uaccess.S b/arch/s390/lib/uaccess.S index 5d59e2625048..837275284d9f 100644 --- a/arch/s390/lib/uaccess.S +++ b/arch/s390/lib/uaccess.S | |||
@@ -88,30 +88,31 @@ __copy_to_user_asm: | |||
88 | .globl __copy_in_user_asm | 88 | .globl __copy_in_user_asm |
89 | # %r2 = from, %r3 = n, %r4 = to | 89 | # %r2 = from, %r3 = n, %r4 = to |
90 | __copy_in_user_asm: | 90 | __copy_in_user_asm: |
91 | ahi %r3,-1 | ||
92 | jo 6f | ||
91 | sacf 256 | 93 | sacf 256 |
92 | bras 1,1f | 94 | bras %r1,4f |
93 | mvc 0(1,%r4),0(%r2) | 95 | 0: ahi %r3,257 |
94 | 0: mvc 0(256,%r4),0(%r2) | 96 | 1: mvc 0(1,%r4),0(%r2) |
95 | la %r2,256(%r2) | ||
96 | la %r4,256(%r4) | ||
97 | 1: ahi %r3,-256 | ||
98 | jnm 0b | ||
99 | 2: ex %r3,0(%r1) | ||
100 | sacf 0 | ||
101 | slr %r2,%r2 | ||
102 | br 14 | ||
103 | 3: mvc 0(1,%r4),0(%r2) | ||
104 | la %r2,1(%r2) | 97 | la %r2,1(%r2) |
105 | la %r4,1(%r4) | 98 | la %r4,1(%r4) |
106 | ahi %r3,-1 | 99 | ahi %r3,-1 |
100 | jnz 1b | ||
101 | 2: lr %r2,%r3 | ||
102 | br %r14 | ||
103 | 3: mvc 0(256,%r4),0(%r2) | ||
104 | la %r2,256(%r2) | ||
105 | la %r4,256(%r4) | ||
106 | 4: ahi %r3,-256 | ||
107 | jnm 3b | 107 | jnm 3b |
108 | 4: lr %r2,%r3 | 108 | 5: ex %r3,4(%r1) |
109 | sacf 0 | 109 | sacf 0 |
110 | 6: slr %r2,%r2 | ||
110 | br %r14 | 111 | br %r14 |
111 | .section __ex_table,"a" | 112 | .section __ex_table,"a" |
112 | .long 0b,3b | 113 | .long 1b,2b |
113 | .long 2b,3b | 114 | .long 3b,0b |
114 | .long 3b,4b | 115 | .long 5b,0b |
115 | .previous | 116 | .previous |
116 | 117 | ||
117 | .align 4 | 118 | .align 4 |
diff --git a/arch/s390/lib/uaccess64.S b/arch/s390/lib/uaccess64.S index 19b41a33c230..1f755be22f92 100644 --- a/arch/s390/lib/uaccess64.S +++ b/arch/s390/lib/uaccess64.S | |||
@@ -88,30 +88,31 @@ __copy_to_user_asm: | |||
88 | .globl __copy_in_user_asm | 88 | .globl __copy_in_user_asm |
89 | # %r2 = from, %r3 = n, %r4 = to | 89 | # %r2 = from, %r3 = n, %r4 = to |
90 | __copy_in_user_asm: | 90 | __copy_in_user_asm: |
91 | aghi %r3,-1 | ||
92 | jo 6f | ||
91 | sacf 256 | 93 | sacf 256 |
92 | bras 1,1f | 94 | bras %r1,4f |
93 | mvc 0(1,%r4),0(%r2) | 95 | 0: aghi %r3,257 |
94 | 0: mvc 0(256,%r4),0(%r2) | 96 | 1: mvc 0(1,%r4),0(%r2) |
95 | la %r2,256(%r2) | ||
96 | la %r4,256(%r4) | ||
97 | 1: aghi %r3,-256 | ||
98 | jnm 0b | ||
99 | 2: ex %r3,0(%r1) | ||
100 | sacf 0 | ||
101 | slgr %r2,%r2 | ||
102 | br 14 | ||
103 | 3: mvc 0(1,%r4),0(%r2) | ||
104 | la %r2,1(%r2) | 97 | la %r2,1(%r2) |
105 | la %r4,1(%r4) | 98 | la %r4,1(%r4) |
106 | aghi %r3,-1 | 99 | aghi %r3,-1 |
100 | jnz 1b | ||
101 | 2: lgr %r2,%r3 | ||
102 | br %r14 | ||
103 | 3: mvc 0(256,%r4),0(%r2) | ||
104 | la %r2,256(%r2) | ||
105 | la %r4,256(%r4) | ||
106 | 4: aghi %r3,-256 | ||
107 | jnm 3b | 107 | jnm 3b |
108 | 4: lgr %r2,%r3 | 108 | 5: ex %r3,4(%r1) |
109 | sacf 0 | 109 | sacf 0 |
110 | br %r14 | 110 | 6: slgr %r2,%r2 |
111 | br 14 | ||
111 | .section __ex_table,"a" | 112 | .section __ex_table,"a" |
112 | .quad 0b,3b | 113 | .quad 1b,2b |
113 | .quad 2b,3b | 114 | .quad 3b,0b |
114 | .quad 3b,4b | 115 | .quad 5b,0b |
115 | .previous | 116 | .previous |
116 | 117 | ||
117 | .align 4 | 118 | .align 4 |