mirror of
https://github.com/opnsense/src.git
synced 2026-03-16 15:48:26 -04:00
Fix a panic caused by (proc)->p_session being dereferenced for a process
that was exiting.
This commit is contained in:
parent
2d8e94a4a4
commit
cd73303c45
2 changed files with 12 additions and 10 deletions
|
|
@ -31,7 +31,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_proc.c 8.7 (Berkeley) 2/14/95
|
||||
* $Id: kern_proc.c,v 1.16 1996/03/11 06:03:25 hsu Exp $
|
||||
* $Id: kern_proc.c,v 1.17 1996/04/07 16:16:05 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
|
@ -427,12 +427,18 @@ fill_eproc(p, ep)
|
|||
if (p->p_pptr)
|
||||
ep->e_ppid = p->p_pptr->p_pid;
|
||||
if (p->p_pgrp) {
|
||||
ep->e_sess = p->p_pgrp->pg_session;
|
||||
ep->e_pgid = p->p_pgrp->pg_id;
|
||||
ep->e_jobc = p->p_pgrp->pg_jobc;
|
||||
ep->e_sess = p->p_pgrp->pg_session;
|
||||
|
||||
if (ep->e_sess) {
|
||||
bcopy(ep->e_sess->s_login, ep->e_login, sizeof(ep->e_login));
|
||||
if (ep->e_sess->s_ttyvp)
|
||||
ep->e_flag = EPROC_CTTY;
|
||||
if (p->p_session && SESS_LEADER(p))
|
||||
ep->e_flag |= EPROC_SLEADER;
|
||||
}
|
||||
}
|
||||
if (ep->e_sess)
|
||||
bcopy(ep->e_sess->s_login, ep->e_login, sizeof(ep->e_login));
|
||||
if ((p->p_flag & P_CONTROLT) &&
|
||||
(ep->e_sess != NULL) &&
|
||||
((tp = ep->e_sess->s_ttyp) != NULL)) {
|
||||
|
|
@ -441,10 +447,6 @@ fill_eproc(p, ep)
|
|||
ep->e_tsess = tp->t_session;
|
||||
} else
|
||||
ep->e_tdev = NODEV;
|
||||
if (ep->e_sess && ep->e_sess->s_ttyvp)
|
||||
ep->e_flag = EPROC_CTTY;
|
||||
if (SESS_LEADER(p))
|
||||
ep->e_flag |= EPROC_SLEADER;
|
||||
if (p->p_wmesg) {
|
||||
strncpy(ep->e_wmesg, p->p_wmesg, WMESGLEN);
|
||||
ep->e_wmesg[WMESGLEN] = 0;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_prot.c 8.6 (Berkeley) 1/21/94
|
||||
* $Id: kern_prot.c,v 1.15 1995/11/11 06:53:08 bde Exp $
|
||||
* $Id: kern_prot.c,v 1.16 1995/11/12 06:42:58 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
@ -277,7 +277,7 @@ setpgid(curp, uap, retval)
|
|||
if (uap->pid != 0 && uap->pid != curp->p_pid) {
|
||||
if ((targp = pfind(uap->pid)) == 0 || !inferior(targp))
|
||||
return (ESRCH);
|
||||
if (targp->p_session != curp->p_session)
|
||||
if (targp->p_pgrp == NULL || targp->p_session != curp->p_session)
|
||||
return (EPERM);
|
||||
if (targp->p_flag & P_EXEC)
|
||||
return (EACCES);
|
||||
|
|
|
|||
Loading…
Reference in a new issue