Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 May 2014 21:55:10 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r265247 - head/sys/kern
Message-ID:  <201405022155.s42LtAnC075260@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405022155.s42LtAnC075260>