Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Aug 2013 14:44:11 +0000 (UTC)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r253887 - head/sys/dev/filemon
Message-ID:  <201308021444.r72EiBk2059771@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hrs
Date: Fri Aug  2 14:44:11 2013
New Revision: 253887
URL: http://svnweb.freebsd.org/changeset/base/253887

Log:
  Add p_candebug() check to FILEMON_SET_PID ioctl.
  
  Discussed with:	sjg
  MFC after:	3 days

Modified:
  head/sys/dev/filemon/filemon.c

Modified: head/sys/dev/filemon/filemon.c
==============================================================================
--- head/sys/dev/filemon/filemon.c	Fri Aug  2 14:14:23 2013	(r253886)
+++ head/sys/dev/filemon/filemon.c	Fri Aug  2 14:44:11 2013	(r253887)
@@ -150,6 +150,7 @@ filemon_ioctl(struct cdev *dev, u_long c
 {
 	int error = 0;
 	struct filemon *filemon;
+	struct proc *p;
 
 	devfs_get_cdevpriv((void **) &filemon);
 
@@ -163,7 +164,13 @@ filemon_ioctl(struct cdev *dev, u_long c
 
 	/* Set the monitored process ID. */
 	case FILEMON_SET_PID:
-		filemon->pid = *((pid_t *)data);
+		p = pfind(*((pid_t *)data));
+		if (p == NULL)
+			return (EINVAL);
+		error = p_candebug(curthread, p);
+		if (error == 0)
+			filemon->pid = p->p_pid;
+		PROC_UNLOCK(p);
 		break;
 
 	default:



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