Skip to content

Commit 55c2770

Browse files
Al Virodavem330
authored andcommitted
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>
1 parent f88620b commit 55c2770

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

arch/sparc/kernel/syscalls.S

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -212,24 +212,20 @@ linux_sparc_syscall:
212212
3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
213213
ret_sys_call:
214214
ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
215-
ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
216215
sra %o0, 0, %o0
217216
mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2
218217
sllx %g2, 32, %g2
219218

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-
227219
cmp %o0, -ERESTART_RESTARTBLOCK
228220
bgeu,pn %xcc, 1f
229-
andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6
230-
80:
221+
andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
222+
ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
223+
224+
2:
225+
stb %g0, [%g6 + TI_SYS_NOERROR]
231226
/* System call success, clear Carry condition code. */
232227
andn %g3, %g2, %g3
228+
3:
233229
stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
234230
bne,pn %icc, linux_syscall_trace2
235231
add %l1, 0x4, %l2 ! npc = npc+4
@@ -238,20 +234,20 @@ ret_sys_call:
238234
stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
239235

240236
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
241243
/* System call failure, set Carry condition code.
242244
* Also, get abs(errno) to return to the process.
243245
*/
244-
andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6
245246
sub %g0, %o0, %o0
246-
or %g3, %g2, %g3
247247
stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
248-
stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
249-
bne,pn %icc, linux_syscall_trace2
250-
add %l1, 0x4, %l2 ! npc = npc+4
251-
stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
248+
ba,pt %xcc, 3b
249+
or %g3, %g2, %g3
252250

253-
b,pt %xcc, rtrap
254-
stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
255251
linux_syscall_trace2:
256252
call syscall_trace_leave
257253
add %sp, PTREGS_OFF, %o0

0 commit comments

Comments
 (0)