From owner-svn-src-head@freebsd.org Tue Aug 16 02:20:03 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A57FBBA04F; Tue, 16 Aug 2016 02:20:03 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 093701BCB; Tue, 16 Aug 2016 02:20:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7G2K2gU051483; Tue, 16 Aug 2016 02:20:02 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7G2K2Yu051482; Tue, 16 Aug 2016 02:20:02 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201608160220.u7G2K2Yu051482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 16 Aug 2016 02:20:02 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 02:20:03 -0000 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 Reviewed by: Bryan Cantrill Approved by: Matthew Ahrens Author: Alex Wilson 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; }