svn commit: r306220 - head/sys/cddl/dev/systrace

Mark Johnston markj at FreeBSD.org
Thu Sep 22 23:22:55 UTC 2016


Author: markj
Date: Thu Sep 22 23:22:53 2016
New Revision: 306220
URL: https://svnweb.freebsd.org/changeset/base/306220

Log:
  Re-check the systrace probe ID before calling dtrace_probe().
  
  Otherwise there exists a narrow window during which a syscall probe can be
  disabled and cause a concurrently-running thread to call dtrace_probe()
  with an invalid probe ID.
  
  Reported by:	ngie
  MFC after:	1 week
  Sponsored by:	Dell EMC Isilon

Modified:
  head/sys/cddl/dev/systrace/systrace.c

Modified: head/sys/cddl/dev/systrace/systrace.c
==============================================================================
--- head/sys/cddl/dev/systrace/systrace.c	Thu Sep 22 22:51:11 2016	(r306219)
+++ head/sys/cddl/dev/systrace/systrace.c	Thu Sep 22 23:22:53 2016	(r306220)
@@ -193,7 +193,8 @@ systrace_probe(struct syscall_args *sa, 
 	memset(uargs, 0, sizeof(uargs));
 
 	if (type == SYSTRACE_ENTRY) {
-		id = sa->callp->sy_entry;
+		if ((id = sa->callp->sy_entry) == DTRACE_IDNONE)
+			return;
 
 		if (sa->callp->sy_systrace_args_func != NULL)
 			/*
@@ -215,7 +216,8 @@ systrace_probe(struct syscall_args *sa, 
 		 */
 		curthread->t_dtrace_systrace_args = uargs;
 	} else {
-		id = sa->callp->sy_return;
+		if ((id = sa->callp->sy_return) == DTRACE_IDNONE)
+			return;
 
 		curthread->t_dtrace_systrace_args = NULL;
 		/* Set arg0 and arg1 as the return value of this syscall. */


More information about the svn-src-all mailing list