summaryrefslogtreecommitdiffstats
path: root/sys/i386/ibcs2
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-01-23 23:59:38 +0000
committerjhb <jhb@FreeBSD.org>2001-01-23 23:59:38 +0000
commit80649f2bc14466af487fac64c40a88ede7c20efc (patch)
tree781ea883b6ed60cc23e615d8c1d3f2f82b901dd5 /sys/i386/ibcs2
parentf5fbc62142d116619713e03561896c38676e6f5c (diff)
downloadFreeBSD-src-80649f2bc14466af487fac64c40a88ede7c20efc.zip
FreeBSD-src-80649f2bc14466af487fac64c40a88ede7c20efc.tar.gz
Proc locking.
Diffstat (limited to 'sys/i386/ibcs2')
-rw-r--r--sys/i386/ibcs2/ibcs2_fcntl.c5
-rw-r--r--sys/i386/ibcs2/ibcs2_ioctl.c7
-rw-r--r--sys/i386/ibcs2/ibcs2_misc.c5
-rw-r--r--sys/i386/ibcs2/ibcs2_other.c2
-rw-r--r--sys/i386/ibcs2/ibcs2_signal.c17
-rw-r--r--sys/i386/ibcs2/ibcs2_util.c13
6 files changed, 41 insertions, 8 deletions
diff --git a/sys/i386/ibcs2/ibcs2_fcntl.c b/sys/i386/ibcs2/ibcs2_fcntl.c
index 88c9c1d..61c37cc 100644
--- a/sys/i386/ibcs2/ibcs2_fcntl.c
+++ b/sys/i386/ibcs2/ibcs2_fcntl.c
@@ -188,14 +188,17 @@ ibcs2_open(p, uap)
ret = spx_open(p, uap);
} else
#endif /* SPX_HACK */
+ PROC_LOCK(p);
if (!ret && !noctty && SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
struct filedesc *fdp = p->p_fd;
struct file *fp = fdp->fd_ofiles[p->p_retval[0]];
+ PROC_UNLOCK(p);
/* ignore any error, just give it a try */
if (fp->f_type == DTYPE_VNODE)
fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, p);
- }
+ } else
+ PROC_UNLOCK(p);
return ret;
}
diff --git a/sys/i386/ibcs2/ibcs2_ioctl.c b/sys/i386/ibcs2/ibcs2_ioctl.c
index bc188f4..1350c1a 100644
--- a/sys/i386/ibcs2/ibcs2_ioctl.c
+++ b/sys/i386/ibcs2/ibcs2_ioctl.c
@@ -499,8 +499,11 @@ ibcs2_ioctl(p, uap)
return ioctl(p, (struct ioctl_args *)uap);
case IBCS2_TIOCGPGRP:
- return copyout((caddr_t)&p->p_pgrp->pg_id, SCARG(uap, data),
+ PROC_LOCK(p);
+ error = copyout((caddr_t)&p->p_pgrp->pg_id, SCARG(uap, data),
sizeof(p->p_pgrp->pg_id));
+ PROC_UNLOCK(p);
+ return error;
case IBCS2_TIOCSPGRP: /* XXX - is uap->data a pointer to pgid? */
{
@@ -526,6 +529,7 @@ ibcs2_ioctl(p, uap)
short bitx, bity;
} ibcs2_jwinsize;
+ PROC_LOCK(p);
ibcs2_jwinsize.bytex = 80;
/* p->p_session->s_ttyp->t_winsize.ws_col; XXX */
ibcs2_jwinsize.bytey = 25;
@@ -534,6 +538,7 @@ ibcs2_ioctl(p, uap)
p->p_session->s_ttyp->t_winsize.ws_xpixel;
ibcs2_jwinsize.bity =
p->p_session->s_ttyp->t_winsize.ws_ypixel;
+ PROC_UNLOCK(p);
return copyout((caddr_t)&ibcs2_jwinsize, SCARG(uap, data),
sizeof(ibcs2_jwinsize));
}
diff --git a/sys/i386/ibcs2/ibcs2_misc.c b/sys/i386/ibcs2/ibcs2_misc.c
index de67da4..b53788f 100644
--- a/sys/i386/ibcs2/ibcs2_misc.c
+++ b/sys/i386/ibcs2/ibcs2_misc.c
@@ -122,6 +122,7 @@ ibcs2_ulimit(p, uap)
return 0;
#endif
case IBCS2_GETPSIZE:
+ mtx_assert(&Giant, MA_OWNED);
p->p_retval[0] = p->p_rlimit[RLIMIT_RSS].rlim_cur; /* XXX */
return 0;
case IBCS2_GETDTABLESIZE:
@@ -946,7 +947,9 @@ ibcs2_pgrpsys(p, uap)
{
switch (SCARG(uap, type)) {
case 0: /* getpgrp */
+ PROC_LOCK(p);
p->p_retval[0] = p->p_pgrp->pg_id;
+ PROC_UNLOCK(p);
return 0;
case 1: /* setpgrp */
@@ -956,7 +959,9 @@ ibcs2_pgrpsys(p, uap)
SCARG(&sa, pid) = 0;
SCARG(&sa, pgid) = 0;
setpgid(p, &sa);
+ PROC_LOCK(p);
p->p_retval[0] = p->p_pgrp->pg_id;
+ PROC_UNLOCK(p);
return 0;
}
diff --git a/sys/i386/ibcs2/ibcs2_other.c b/sys/i386/ibcs2/ibcs2_other.c
index 3578b3a..23b9743 100644
--- a/sys/i386/ibcs2/ibcs2_other.c
+++ b/sys/i386/ibcs2/ibcs2_other.c
@@ -48,7 +48,9 @@ ibcs2_secure(struct proc *p, struct ibcs2_secure_args *uap)
switch (uap->cmd) {
case IBCS2_SECURE_GETLUID: /* get login uid */
+ PROC_LOCK(p);
p->p_retval[0] = p->p_ucred->cr_uid;
+ PROC_UNLOCK(p);
return 0;
case IBCS2_SECURE_SETLUID: /* set login uid */
diff --git a/sys/i386/ibcs2/ibcs2_signal.c b/sys/i386/ibcs2/ibcs2_signal.c
index f8829f1..70b5f57 100644
--- a/sys/i386/ibcs2/ibcs2_signal.c
+++ b/sys/i386/ibcs2/ibcs2_signal.c
@@ -318,13 +318,16 @@ ibcs2_sigsys(p, uap)
p->p_retval[0] = (int)sa.sa_handler;
/* special sigset() check */
- if(IBCS2_SIGCALL(SCARG(uap, sig)) == IBCS2_SIGSET_MASK)
+ if(IBCS2_SIGCALL(SCARG(uap, sig)) == IBCS2_SIGSET_MASK) {
+ PROC_LOCK(p);
/* check to make sure signal is not blocked */
if(sigismember(&p->p_sigmask, signum)) {
/* return SIG_HOLD and unblock signal*/
p->p_retval[0] = (int)IBCS2_SIG_HOLD;
SIGDELSET(p->p_sigmask, signum);
}
+ PROC_UNLOCK(p);
+ }
return 0;
}
@@ -369,7 +372,9 @@ ibcs2_sigsys(p, uap)
sigset_t mask;
struct sigsuspend_args sa;
+ PROC_LOCK(p);
mask = p->p_sigmask;
+ PROC_UNLOCK(p);
SIGDELSET(mask, signum);
SCARG(&sa, sigmask) = &mask;
return sigsuspend(p, &sa);
@@ -391,7 +396,9 @@ ibcs2_sigprocmask(p, uap)
if (SCARG(uap, oset) != NULL) {
/* Fix the return value first if needed */
+ PROC_LOCK(p);
bsd_to_ibcs2_sigset(&p->p_sigmask, &iss);
+ PROC_UNLOCK(p);
if ((error = copyout(&iss, SCARG(uap, oset), sizeof(iss))) != 0)
return error;
}
@@ -405,7 +412,7 @@ ibcs2_sigprocmask(p, uap)
ibcs2_to_bsd_sigset(&iss, &bss);
- (void) splhigh();
+ PROC_LOCK(p);
switch (SCARG(uap, how)) {
case IBCS2_SIG_BLOCK:
@@ -427,7 +434,7 @@ ibcs2_sigprocmask(p, uap)
break;
}
- (void) spl0();
+ PROC_UNLOCK(p);
return error;
}
@@ -440,8 +447,10 @@ ibcs2_sigpending(p, uap)
sigset_t bss;
ibcs2_sigset_t iss;
+ PROC_LOCK(p);
bss = p->p_siglist;
SIGSETAND(bss, p->p_sigmask);
+ PROC_UNLOCK(p);
bsd_to_ibcs2_sigset(&bss, &iss);
return copyout(&iss, SCARG(uap, mask), sizeof(iss));
@@ -473,7 +482,9 @@ ibcs2_pause(p, uap)
sigset_t mask;
struct sigsuspend_args sa;
+ PROC_LOCK(p);
mask = p->p_sigmask;
+ PROC_UNLOCK(p);
SCARG(&sa, sigmask) = &mask;
return sigsuspend(p, &sa);
}
diff --git a/sys/i386/ibcs2/ibcs2_util.c b/sys/i386/ibcs2/ibcs2_util.c
index 0a361fd..1d710be 100644
--- a/sys/i386/ibcs2/ibcs2_util.c
+++ b/sys/i386/ibcs2/ibcs2_util.c
@@ -62,6 +62,7 @@ ibcs2_emul_find(p, sgp, prefix, path, pbuf, cflag)
struct nameidata ndroot;
struct vattr vat;
struct vattr vatroot;
+ struct ucred *uc;
int error;
char *ptr, *buf, *cp;
size_t sz, len;
@@ -140,14 +141,20 @@ ibcs2_emul_find(p, sgp, prefix, path, pbuf, cflag)
return error;
}
- if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0) {
+ PROC_LOCK(p);
+ uc = p->p_ucred;
+ crhold(uc);
+ PROC_UNLOCK(p);
+ if ((error = VOP_GETATTR(nd.ni_vp, &vat, uc, p)) != 0) {
+ crfree(uc);
goto done;
}
- if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, p->p_ucred, p))
- != 0) {
+ if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, uc, p)) != 0) {
+ crfree(uc);
goto done;
}
+ crfree(uc);
if (vat.va_fsid == vatroot.va_fsid &&
vat.va_fileid == vatroot.va_fileid) {
OpenPOWER on IntegriCloud