提交 c599a782 编写于 作者: A Andreas Larsson 提交者: David S. Miller

sparc32: Preserve clone syscall flags argument for restarts due to signals

This fixes a bug where a clone syscall that is restarted due to a
pending signal is restarted with garbage in the register %o0 that holds
the clone flags.

This keep the original %i0 of a syscall (as seen from the trap handler)
in %l6 rather than %l5. This is done because for clone (and also qfork)
%l5 is used as a temporary variable in the same register window. Before
this, that temporary value would be the value that was then incorrectly
used as the orig_i0 argument to do_notify_resume.

In order to preserve %l6, the temporary usage of %l6 in ret_sys_call is
changed to use %l5 instead and the setting %l6 to 0 or 1 was removed.
The use of that 0 or 1 value in %l6 was removed in commit
28e61036.
Signed-off-by: NAndreas Larsson <andreas@gaisler.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 bda16693
...@@ -1009,7 +1009,7 @@ do_syscall: ...@@ -1009,7 +1009,7 @@ do_syscall:
andcc %l5, _TIF_SYSCALL_TRACE, %g0 andcc %l5, _TIF_SYSCALL_TRACE, %g0
mov %i4, %o4 mov %i4, %o4
bne linux_syscall_trace bne linux_syscall_trace
mov %i0, %l5 mov %i0, %l6
2: 2:
call %l7 call %l7
mov %i5, %o5 mov %i5, %o5
...@@ -1018,16 +1018,15 @@ do_syscall: ...@@ -1018,16 +1018,15 @@ do_syscall:
st %o0, [%sp + STACKFRAME_SZ + PT_I0] st %o0, [%sp + STACKFRAME_SZ + PT_I0]
ret_sys_call: ret_sys_call:
ld [%curptr + TI_FLAGS], %l6 ld [%curptr + TI_FLAGS], %l5
cmp %o0, -ERESTART_RESTARTBLOCK cmp %o0, -ERESTART_RESTARTBLOCK
ld [%sp + STACKFRAME_SZ + PT_PSR], %g3 ld [%sp + STACKFRAME_SZ + PT_PSR], %g3
set PSR_C, %g2 set PSR_C, %g2
bgeu 1f bgeu 1f
andcc %l6, _TIF_SYSCALL_TRACE, %g0 andcc %l5, _TIF_SYSCALL_TRACE, %g0
/* System call success, clear Carry condition code. */ /* System call success, clear Carry condition code. */
andn %g3, %g2, %g3 andn %g3, %g2, %g3
clr %l6
st %g3, [%sp + STACKFRAME_SZ + PT_PSR] st %g3, [%sp + STACKFRAME_SZ + PT_PSR]
bne linux_syscall_trace2 bne linux_syscall_trace2
ld [%sp + STACKFRAME_SZ + PT_NPC], %l1 /* pc = npc */ ld [%sp + STACKFRAME_SZ + PT_NPC], %l1 /* pc = npc */
...@@ -1042,7 +1041,6 @@ ret_sys_call: ...@@ -1042,7 +1041,6 @@ ret_sys_call:
sub %g0, %o0, %o0 sub %g0, %o0, %o0
or %g3, %g2, %g3 or %g3, %g2, %g3
st %o0, [%sp + STACKFRAME_SZ + PT_I0] st %o0, [%sp + STACKFRAME_SZ + PT_I0]
mov 1, %l6
st %g3, [%sp + STACKFRAME_SZ + PT_PSR] st %g3, [%sp + STACKFRAME_SZ + PT_PSR]
bne linux_syscall_trace2 bne linux_syscall_trace2
ld [%sp + STACKFRAME_SZ + PT_NPC], %l1 /* pc = npc */ ld [%sp + STACKFRAME_SZ + PT_NPC], %l1 /* pc = npc */
......
...@@ -75,7 +75,7 @@ signal_p: ...@@ -75,7 +75,7 @@ signal_p:
ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr
mov %g2, %o2 mov %g2, %o2
mov %l5, %o1 mov %l6, %o1
call do_notify_resume call do_notify_resume
add %sp, STACKFRAME_SZ, %o0 ! pt_regs ptr add %sp, STACKFRAME_SZ, %o0 ! pt_regs ptr
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册