diff options
author | Jake Burkholder <jake@FreeBSD.org> | 2000-12-23 19:43:10 +0000 |
---|---|---|
committer | Jake Burkholder <jake@FreeBSD.org> | 2000-12-23 19:43:10 +0000 |
commit | 98f03f90302d1d2f1878c8451c5ddf1789eeafce (patch) | |
tree | ea50f71f1cefaa4318c6e8145cbda53d3da0e4f2 /sys/kern/kern_prot.c | |
parent | 1826f66757c99b9b52f6b69e11ea871edce46a25 (diff) | |
download | src-98f03f90302d1d2f1878c8451c5ddf1789eeafce.tar.gz src-98f03f90302d1d2f1878c8451c5ddf1789eeafce.zip |
Protect proc.p_pptr and proc.p_children/p_sibling with the
proctree_lock.
linprocfs not locked pending response from informal maintainer.
Reviewed by: jhb, -smp@
Notes
Notes:
svn path=/head/; revision=70317
Diffstat (limited to 'sys/kern/kern_prot.c')
-rw-r--r-- | sys/kern/kern_prot.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 5e11a3f0b2ae..51ca9192d508 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -50,6 +50,7 @@ #include <sys/systm.h> #include <sys/sysproto.h> #include <sys/kernel.h> +#include <sys/lock.h> #include <sys/proc.h> #include <sys/malloc.h> #include <sys/pioctl.h> @@ -65,8 +66,9 @@ struct getpid_args { #endif /* - * NOT MP SAFE due to p_pptr access + * getpid - MP SAFE */ + /* ARGSUSED */ int getpid(p, uap) @@ -76,11 +78,17 @@ getpid(p, uap) p->p_retval[0] = p->p_pid; #if defined(COMPAT_43) || defined(COMPAT_SUNOS) + PROCTREE_LOCK(PT_SHARED); p->p_retval[1] = p->p_pptr->p_pid; + PROCTREE_LOCK(PT_RELEASE); #endif return (0); } +/* + * getppid - MP SAFE + */ + #ifndef _SYS_SYSPROTO_H_ struct getppid_args { int dummy; @@ -93,7 +101,9 @@ getppid(p, uap) struct getppid_args *uap; { + PROCTREE_LOCK(PT_SHARED); p->p_retval[0] = p->p_pptr->p_pid; + PROCTREE_LOCK(PT_RELEASE); return (0); } |