Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Sep 2016 23:22:53 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r306220 - head/sys/cddl/dev/systrace
Message-ID:  <201609222322.u8MNMrxG046367@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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. */



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