aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-10-04 17:13:59 -0400
committerDavid S. Miller <davem@davemloft.net>2012-10-04 17:13:59 -0400
commitffa9009c9828db3f74178e459cfbca6e77ff5dd9 (patch)
treec648de2a6ce01af2e93f44e15d0a92e6e0a0181f /arch
parent40138249c3b7a0762155216b963ec7fd4d09b5b4 (diff)
sparc64: Fix strace hiccups when force_successful_syscall() triggers.
When force_successful_syscall() triggers, the syscall return status reported the ptrace applications gets garbled. Fix this by reordering the events and tests in the ret_sys_call path. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc/kernel/syscalls.S31
1 files changed, 13 insertions, 18 deletions
diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S
index ed277e2fdfc8..b0ac10306425 100644
--- a/arch/sparc/kernel/syscalls.S
+++ b/arch/sparc/kernel/syscalls.S
@@ -212,24 +212,19 @@ linux_sparc_syscall:
2123: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] 2123: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
213ret_sys_call: 213ret_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,pn %l2, 80f
225 nop
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
23080: 222 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
223
2242:
231 /* System call success, clear Carry condition code. */ 225 /* System call success, clear Carry condition code. */
232 andn %g3, %g2, %g3 226 andn %g3, %g2, %g3
2273:
233 stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE] 228 stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
234 bne,pn %icc, linux_syscall_trace2 229 bne,pn %icc, linux_syscall_trace2
235 add %l1, 0x4, %l2 ! npc = npc+4 230 add %l1, 0x4, %l2 ! npc = npc+4
@@ -238,20 +233,20 @@ ret_sys_call:
238 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC] 233 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
239 234
2401: 2351:
236 /* Check if force_successful_syscall_return()
237 * was invoked.
238 */
239 ldub [%g6 + TI_SYS_NOERROR], %l2
240 brnz,pn %l2, 2b
241 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
241 /* System call failure, set Carry condition code. 242 /* System call failure, set Carry condition code.
242 * Also, get abs(errno) to return to the process. 243 * Also, get abs(errno) to return to the process.
243 */ 244 */
244 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6
245 sub %g0, %o0, %o0 245 sub %g0, %o0, %o0
246 or %g3, %g2, %g3
247 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] 246 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
248 stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE] 247 ba,pt %xcc, 3b
249 bne,pn %icc, linux_syscall_trace2 248 or %g3, %g2, %g3
250 add %l1, 0x4, %l2 ! npc = npc+4
251 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
252 249
253 b,pt %xcc, rtrap
254 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
255linux_syscall_trace2: 250linux_syscall_trace2:
256 call syscall_trace_leave 251 call syscall_trace_leave
257 add %sp, PTREGS_OFF, %o0 252 add %sp, PTREGS_OFF, %o0