svn commit: r265247 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Fri May 2 21:55:10 UTC 2014


Author: mjg
Date: Fri May  2 21:55:09 2014
New Revision: 265247
URL: http://svnweb.freebsd.org/changeset/base/265247

Log:
  Request a non-exiting process in sysctl_kern_proc_{o,}filedesc
  
  This fixes a race with exit1 freeing p_textvp.
  
  Suggested by:	kib
  MFC after:	1 week

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Fri May  2 21:54:36 2014	(r265246)
+++ head/sys/kern/kern_descrip.c	Fri May  2 21:55:09 2014	(r265247)
@@ -3010,7 +3010,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE
 	struct tty *tp;
 
 	name = (int *)arg1;
-	error = pget((pid_t)name[0], PGET_CANDEBUG, &p);
+	error = pget((pid_t)name[0], PGET_CANDEBUG | PGET_NOTWEXIT, &p);
 	if (error != 0)
 		return (error);
 	fdp = fdhold(p);
@@ -3503,7 +3503,7 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER
 	name = (int *)arg1;
 
 	sbuf_new_for_sysctl(&sb, NULL, FILEDESC_SBUF_SIZE, req);
-	error = pget((pid_t)name[0], PGET_CANDEBUG, &p);
+	error = pget((pid_t)name[0], PGET_CANDEBUG | PGET_NOTWEXIT, &p);
 	if (error != 0) {
 		sbuf_delete(&sb);
 		return (error);


More information about the svn-src-head mailing list