proc_vmspace_getref: treat curproc specially to fix coredump problem pointed

by Christos Zoulas.
This commit is contained in:
yamt 2006-03-12 10:32:47 +00:00
parent 33f0a013e3
commit 6c02fe74a4
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_proc.c,v 1.86 2006/03/01 12:38:21 yamt Exp $ */
/* $NetBSD: kern_proc.c,v 1.87 2006/03/12 10:32:47 yamt Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.86 2006/03/01 12:38:21 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.87 2006/03/12 10:32:47 yamt Exp $");
#include "opt_kstack.h"
@ -1238,7 +1238,9 @@ proc_vmspace_getref(struct proc *p, struct vmspace **vm)
/* XXXCDC: how should locking work here? */
if ((p->p_flag & P_WEXIT) != 0 ||
/* curproc exception is for coredump. */
if ((p != curproc && (p->p_flag & P_WEXIT) != 0) ||
(p->p_vmspace->vm_refcnt < 1)) { /* XXX */
return EFAULT;
}