Fix deafult signal actions

This commit is contained in:
Masamichi Takagi
2014-09-24 10:18:10 +09:00
committed by Tomoki Shirasawa
parent 013d3e95c2
commit 759ceac769

View File

@@ -205,6 +205,7 @@ do_signal(unsigned long rc, void *regs0, struct process *proc, struct sig_pendin
int sig; int sig;
__sigset_t w; __sigset_t w;
int irqstate; int irqstate;
struct fork_tree_node *ftn = proc->ftn;
for(w = pending->sigmask.__val[0], sig = 0; w; sig++, w >>= 1); for(w = pending->sigmask.__val[0], sig = 0; w; sig++, w >>= 1);
dkprintf("do_signal,pid=%d,sig=%d\n", proc->pid, sig); dkprintf("do_signal,pid=%d,sig=%d\n", proc->pid, sig);
@@ -276,10 +277,11 @@ do_signal(unsigned long rc, void *regs0, struct process *proc, struct sig_pendin
kfree(pending); kfree(pending);
ihk_mc_spinlock_unlock(&proc->sighandler->lock, irqstate); ihk_mc_spinlock_unlock(&proc->sighandler->lock, irqstate);
switch (sig) { switch (sig) {
case SIGSTOP: { case SIGSTOP:
case SIGTSTP:
case SIGTTIN:
case SIGTTOU:
dkprintf("do_signal,SIGSTOP,changing state\n"); dkprintf("do_signal,SIGSTOP,changing state\n");
struct process *proc = cpu_local_var(current);
struct fork_tree_node *ftn = proc->ftn;
/* Update process state in fork tree */ /* Update process state in fork tree */
ihk_mc_spinlock_lock_noirq(&ftn->lock); ihk_mc_spinlock_lock_noirq(&ftn->lock);
@@ -299,11 +301,12 @@ do_signal(unsigned long rc, void *regs0, struct process *proc, struct sig_pendin
proc->status = PS_STOPPED; proc->status = PS_STOPPED;
schedule(); schedule();
dkprintf("SIGSTOP(): woken up\n"); dkprintf("SIGSTOP(): woken up\n");
break; } break;
case SIGTRAP: { case SIGTRAP:
dkprintf("do_signal,SIGTRAP,changing state\n"); dkprintf("do_signal,SIGTRAP\n");
struct process *proc = cpu_local_var(current); if(!(ftn->ptrace & PT_TRACED)) {
struct fork_tree_node *ftn = proc->ftn; goto core;
}
/* Update process state in fork tree */ /* Update process state in fork tree */
ihk_mc_spinlock_lock_noirq(&ftn->lock); ihk_mc_spinlock_lock_noirq(&ftn->lock);
@@ -320,25 +323,31 @@ do_signal(unsigned long rc, void *regs0, struct process *proc, struct sig_pendin
schedule(); schedule();
dkprintf("SIGTRAP(): woken up\n"); dkprintf("SIGTRAP(): woken up\n");
break; } break;
case SIGCONT: case SIGCONT:
dkprintf("do_signal,SIGCONT,do nothing\n"); dkprintf("do_signal,SIGCONT,do nothing\n");
break; break;
case SIGSEGV:
kprintf("do_signal,SIGSEGV received\n");
case SIGQUIT: case SIGQUIT:
case SIGILL: case SIGILL:
case SIGABRT: case SIGABRT:
case SIGBUS:
case SIGFPE: case SIGFPE:
case SIGUSR1: case SIGSEGV:
case SIGUSR2: case SIGBUS:
core:
dkprintf("do_signal,default,core,sig=%d\n", sig);
coredump(proc, regs); coredump(proc, regs);
coredumped = 0x80; coredumped = 0x80;
terminate(0, sig | coredumped, (ihk_mc_user_context_t *)regs->rsp); terminate(0, sig | coredumped, (ihk_mc_user_context_t *)regs->rsp);
break; break;
case SIGHUP:
case SIGINT:
case SIGKILL: case SIGKILL:
dkprintf("do_signal,calling terminate\n"); case SIGPIPE:
case SIGALRM:
case SIGTERM:
case SIGUSR1:
case SIGUSR2:
dkprintf("do_signal,default,terminate,sig=%d\n", sig);
terminate(0, sig, (ihk_mc_user_context_t *)regs->rsp); terminate(0, sig, (ihk_mc_user_context_t *)regs->rsp);
break; break;
case SIGCHLD: case SIGCHLD: