Hi Paul,
When I run spawn that is one of benchmark programs on unixbench-4.1.0, an error is asserted as follows.
% spawn 30
Illegal instruction
The caused PC is 0x4007fe, but the PC should be 0x400800, please refer to appended spawn's disassembled list. The 'report' is handled by alarm signal.
When '-ERESTARTNOINTR' is returned from fork syscall, do_signal() subtracts 2 from the address that is handled by alarm signal.
I think that the following patch can avoid this problem because the handled function does not come from a system call.
--- arch/sh/kernel/signal.c.org Mon Feb 5 03:44:54 2007
+++ arch/sh/kernel/signal.c Thu Mar 1 11:14:54 2007
@@ -583,16 +583,17 @@ static void do_signal(struct pt_regs *re
/* Whee! Actually deliver the signal. */
if (handle_signal(signr, &ka, &info, oldset, regs) == 0) {
/* a signal was successfully delivered; the saved
* sigmask will have been stored in the signal frame,
* and will be restored by sigreturn, so we can simply
* clear the TIF_RESTORE_SIGMASK flag */
if (test_thread_flag(TIF_RESTORE_SIGMASK))
clear_thread_flag(TIF_RESTORE_SIGMASK);
+ regs->tra = -1; /* disable syscall checks */
}
}
no_signal:
/* Did we come from a system call? */
if (regs->tra >= 0) {
/* Restart the system call - no handlers present */
if (regs->regs[0] == -ERESTARTNOHAND ||
-a part of spawn's disassembled list----------------------------------
wake_me:
004007e0 d005 MOV.L @(H'14,PC),R0 ; 0x4007f8;*__sysv_signal@@GLIB
C_2.2
004007e2 2f86 MOV.L R8,@-R15
004007e4 6843 MOV R4,R8
004007e6 4f22 STS.L PR,@-R15
004007e8 400b JSR @R0
004007ea e40e MOV #H'E,R4
004007ec 4f26 LDS.L @R15+,PR
004007ee d103 MOV.L @(H'C,PC),R1 ; 0x4007fc;*alarm@@GLIBC_2.2
004007f0 6483 MOV R8,R4
004007f2 412b JMP @R1
004007f4 68f6 MOV.L @R15+,R8
004007f6 0009 NOP
004007f8 057c MOV.B @(R0,R7),R5 ; __sysv_signal@@GLIBC_2.2
004007fa 0040 .data.w h'0040
004007fc 0608 .data.w h'0608 ; alarm@@GLIBC_2.2
004007fe 0040 .data.w h'0040
report:
00400800 4f22 STS.L PR,@-R15
00400802 d105 MOV.L @(H'14,PC),R1 ; 0x400818;*_edata
00400804 d005 MOV.L @(H'14,PC),R0 ; 0x40081c;*fprintf@@GLIBC_2.2
|