summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1996-05-30 01:21:50 +0000
committerdg <dg@FreeBSD.org>1996-05-30 01:21:50 +0000
commitcd113d77ab85db7f63be66c81a4eb642746aa284 (patch)
tree603e355f7edb105259489d17e5043c896ec3d4a9 /sys/kern
parente450158f3674d36874e6c77353f3a2f32ab4eb96 (diff)
downloadFreeBSD-src-cd113d77ab85db7f63be66c81a4eb642746aa284.zip
FreeBSD-src-cd113d77ab85db7f63be66c81a4eb642746aa284.tar.gz
Fix a panic caused by (proc)->p_session being dereferenced for a process
that was exiting.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_proc.c18
-rw-r--r--sys/kern/kern_prot.c4
2 files changed, 12 insertions, 10 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index b1a31b2..f9e9c4f 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -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;
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 3ed7088..e779a09 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -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);
OpenPOWER on IntegriCloud