Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Aug 2016 02:20:02 +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: r304198 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace
Message-ID:  <201608160220.u7G2K2Yu051482@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Tue Aug 16 02:20:02 2016
New Revision: 304198
URL: https://svnweb.freebsd.org/changeset/base/304198

Log:
  MFV r301525:
  7033 ustack helper should fault on bad return values
  
  Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
  Reviewed by: Bryan Cantrill <bryan@joyent.com>
  Approved by: Matthew Ahrens <mahrens@delphix.com>
  Author: Alex Wilson <alex.wilson@joyent.com>
  
  illumos/illumos-gate@a2f72b65ebc430aaf277ad797e554bb4deba9b95
  
  MFC after:	2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Tue Aug 16 02:18:34 2016	(r304197)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Tue Aug 16 02:20:02 2016	(r304198)
@@ -6929,6 +6929,7 @@ dtrace_action_ustack(dtrace_mstate_t *ms
 	uint64_t *pcs = &buf[1], *fps;
 	char *str = (char *)&pcs[nframes];
 	int size, offs = 0, i, j;
+	size_t rem;
 	uintptr_t old = mstate->dtms_scratch_ptr, saved;
 	uint16_t *flags = &cpu_core[curcpu].cpuc_dtrace_flags;
 	char *sym;
@@ -7000,12 +7001,18 @@ dtrace_action_ustack(dtrace_mstate_t *ms
 			continue;
 		}
 
+		if (!dtrace_strcanload((uintptr_t)sym, strsize, &rem, mstate,
+		    &(state->dts_vstate))) {
+			str[offs++] = '\0';
+			continue;
+		}
+
 		DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
 
 		/*
 		 * Now copy in the string that the helper returned to us.
 		 */
-		for (j = 0; offs + j < strsize; j++) {
+		for (j = 0; offs + j < strsize && j < rem; j++) {
 			if ((str[offs + j] = sym[j]) == '\0')
 				break;
 		}



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