diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-07-22 05:32:45 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-07-22 05:32:45 +0000 |
commit | 728f699c4591bb13d48d44d1f3534b13b03c579d (patch) | |
tree | ade5faa3dbf53b43e0631b0b61aeab1a8a6288ad /sys | |
parent | f5ce639e4d14c5d10adcf3a7e4994901239f6e63 (diff) |
Slam signal handlers harder in tame_fail(), found by semarie.
Also delete some prototype KTRACE code which is not headed in the
right direction.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_tame.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/sys/kern/kern_tame.c b/sys/kern/kern_tame.c index 4485efce57f..9751b130c32 100644 --- a/sys/kern/kern_tame.c +++ b/sys/kern/kern_tame.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_tame.c,v 1.12 2015/07/21 16:17:17 guenther Exp $ */ +/* $OpenBSD: kern_tame.c,v 1.13 2015/07/22 05:32:44 deraadt Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org> @@ -41,6 +41,7 @@ #include <sys/tame.h> +#include <sys/signal.h> #include <sys/signalvar.h> #include <sys/syscall.h> #include <sys/syscallargs.h> @@ -247,25 +248,13 @@ tame_fail(struct proc *p, int error, int code) { printf("tame: pid %d %s syscall %d\n", p->p_pid, p->p_comm, p->p_tame_syscall); -#ifdef KTRACE - if (KTRPOINT(p, KTR_PSIG)) { - siginfo_t si; - - memset(&si, 0, sizeof(si)); - if (p->p_p->ps_tame & _TM_ABORT) - si.si_signo = SIGABRT; - else - si.si_signo = SIGKILL; - si.si_code = code; - // si.si_syscall = p->p_tame_syscall; - /// si.si_nsysarg ... - ktrpsig(p, si.si_signo, SIG_DFL, p->p_sigmask, code, &si); - } -#endif - if (p->p_p->ps_tame & _TM_ABORT) { - /* Core dump requested */ - atomic_clearbits_int(&p->p_sigmask, sigmask(SIGABRT)); - atomic_clearbits_int(&p->p_p->ps_flags, PS_TAMED); + if (p->p_p->ps_tame & _TM_ABORT) { /* Core dump requested */ + struct sigaction sa; + + p->p_p->ps_tame = 0; /* Disable all TAME_ flags */ + memset(&sa, 0, sizeof sa); + sa.sa_handler = SIG_DFL; + setsigvec(p, SIGABRT, &sa); psignal(p, SIGABRT); } else psignal(p, SIGKILL); |