svn commit: r304198 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace

Mark Johnston markj at FreeBSD.org
Tue Aug 16 02:20:03 UTC 2016


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 at joyent.com>
  Reviewed by: Bryan Cantrill <bryan at joyent.com>
  Approved by: Matthew Ahrens <mahrens at delphix.com>
  Author: Alex Wilson <alex.wilson at joyent.com>
  
  illumos/illumos-gate at 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;
 		}


More information about the svn-src-all mailing list