diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-10 20:25:00 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-10-10 20:25:00 -0400 |
commit | 55c2770e413e96871147b9406a9c41fe9bc5209c (patch) | |
tree | 6c53988910b1a346c068eaf070a2a0f62b23c4dc /arch | |
parent | f88620b9c5521e9cb9de88e56272bfec3d831513 (diff) |
sparc64: fix ptrace interaction with force_successful_syscall_return()
we want syscall_trace_leave() called on exit from any syscall;
skipping its call in case we'd done force_successful_syscall_return()
is broken...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sparc/kernel/syscalls.S | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S index 1d7e274f3f2b..7f5f65d0b3fd 100644 --- a/arch/sparc/kernel/syscalls.S +++ b/arch/sparc/kernel/syscalls.S | |||
@@ -212,24 +212,20 @@ linux_sparc_syscall: | |||
212 | 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] | 212 | 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] |
213 | ret_sys_call: | 213 | ret_sys_call: |
214 | ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3 | 214 | ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3 |
215 | ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc | ||
216 | sra %o0, 0, %o0 | 215 | sra %o0, 0, %o0 |
217 | mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2 | 216 | mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2 |
218 | sllx %g2, 32, %g2 | 217 | sllx %g2, 32, %g2 |
219 | 218 | ||
220 | /* Check if force_successful_syscall_return() | ||
221 | * was invoked. | ||
222 | */ | ||
223 | ldub [%g6 + TI_SYS_NOERROR], %l2 | ||
224 | brnz,a,pn %l2, 80f | ||
225 | stb %g0, [%g6 + TI_SYS_NOERROR] | ||
226 | |||
227 | cmp %o0, -ERESTART_RESTARTBLOCK | 219 | cmp %o0, -ERESTART_RESTARTBLOCK |
228 | bgeu,pn %xcc, 1f | 220 | bgeu,pn %xcc, 1f |
229 | andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6 | 221 | andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0 |
230 | 80: | 222 | ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc |
223 | |||
224 | 2: | ||
225 | stb %g0, [%g6 + TI_SYS_NOERROR] | ||
231 | /* System call success, clear Carry condition code. */ | 226 | /* System call success, clear Carry condition code. */ |
232 | andn %g3, %g2, %g3 | 227 | andn %g3, %g2, %g3 |
228 | 3: | ||
233 | stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE] | 229 | stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE] |
234 | bne,pn %icc, linux_syscall_trace2 | 230 | bne,pn %icc, linux_syscall_trace2 |
235 | add %l1, 0x4, %l2 ! npc = npc+4 | 231 | add %l1, 0x4, %l2 ! npc = npc+4 |
@@ -238,20 +234,20 @@ ret_sys_call: | |||
238 | stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC] | 234 | stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC] |
239 | 235 | ||
240 | 1: | 236 | 1: |
237 | /* Check if force_successful_syscall_return() | ||
238 | * was invoked. | ||
239 | */ | ||
240 | ldub [%g6 + TI_SYS_NOERROR], %l2 | ||
241 | brnz,pn %l2, 2b | ||
242 | ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc | ||
241 | /* System call failure, set Carry condition code. | 243 | /* System call failure, set Carry condition code. |
242 | * Also, get abs(errno) to return to the process. | 244 | * Also, get abs(errno) to return to the process. |
243 | */ | 245 | */ |
244 | andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6 | ||
245 | sub %g0, %o0, %o0 | 246 | sub %g0, %o0, %o0 |
246 | or %g3, %g2, %g3 | ||
247 | stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] | 247 | stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] |
248 | stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE] | 248 | ba,pt %xcc, 3b |
249 | bne,pn %icc, linux_syscall_trace2 | 249 | or %g3, %g2, %g3 |
250 | add %l1, 0x4, %l2 ! npc = npc+4 | ||
251 | stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC] | ||
252 | 250 | ||
253 | b,pt %xcc, rtrap | ||
254 | stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC] | ||
255 | linux_syscall_trace2: | 251 | linux_syscall_trace2: |
256 | call syscall_trace_leave | 252 | call syscall_trace_leave |
257 | add %sp, PTREGS_OFF, %o0 | 253 | add %sp, PTREGS_OFF, %o0 |