Index: sys/kern/kern_sig.c =================================================================== RCS file: /var3/mirrors/cvs/openbsd/cvs/src/sys/kern/kern_sig.c,v retrieving revision 1.126 diff -u -r1.126 kern_sig.c --- sys/kern/kern_sig.c 11 Jul 2011 15:40:47 -0000 1.126 +++ sys/kern/kern_sig.c 17 Sep 2011 06:27:26 -0000 @@ -61,6 +61,7 @@ #include #include #include +#include #include #include @@ -1300,6 +1301,45 @@ void sigexit(struct proc *p, int signum) { + const struct process *parent_ps; + + switch (signum) { + case 0: + case SIGKILL: + case SIGINT: + case SIGTERM: + case SIGALRM: + case SIGSTOP: + case SIGTTIN: + case SIGTTOU: + case SIGTSTP: + case SIGHUP: + case SIGUSR1: + case SIGUSR2: + case SIGPIPE: + break; + default: + parent_ps = p->p_p->ps_pptr; + if (parent_ps != NULL) { + log(LOG_INFO, + "signal %d received by (%.32s:%d) UID(%lu) " + "EUID(%lu), parent (%.32s:%d) UID(%lu) EUID(%lu)\n", + signum, p->p_comm, p->p_pid, + (unsigned long) p->p_cred->p_ruid, + (unsigned long) p->p_ucred->cr_uid, + parent_ps->ps_mainproc->p_comm, + parent_ps->ps_mainproc->p_pid, + (unsigned long) parent_ps->ps_cred->p_ruid, + (unsigned long) parent_ps->ps_cred->pc_ucred->cr_uid); + } else { + log(LOG_INFO, + "signal %d received by (%.32s:%d) UID(%lu) " + "EUID(%lu), orphan\n", + signum, p->p_comm, p->p_pid, + (unsigned long) p->p_cred->p_ruid, + (unsigned long) p->p_ucred->cr_uid); + } + } /* Mark process as going away */ atomic_setbits_int(&p->p_flag, P_WEXIT);