Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Dec 2017 22:08:34 +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: r326813 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace
Message-ID:  <201712122208.vBCM8YlQ094404@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Tue Dec 12 22:08:34 2017
New Revision: 326813
URL: https://svnweb.freebsd.org/changeset/base/326813

Log:
  MFV r326785: 8880 improve DTrace error checking
  
  illumos/illumos-gate@2cf374268f3e1c9e9be6367466b183d27632583a
  https://github.com/illumos/illumos-gate/commit/2cf374268f3e1c9e9be6367466b183d27632583a
  
  https://www.illumos.org/issues/8880
  
  Reviewed by: Tim Kordas <tim.kordas@joyent.com>
  Reviewed by: Bryan Cantrill <bryan@joyent.com>
  Reviewed by: Richard Lowe <richlowe@richlowe.net>
  Approved by: Dan McDonald <danmcd@joyent.com>
  Author: Jerry Jelinek <jerry.jelinek@joyent.com>
  
  MFC after:	1 week

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 Dec 12 22:06:22 2017	(r326812)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Tue Dec 12 22:08:34 2017	(r326813)
@@ -13929,6 +13929,7 @@ dtrace_dof_relocate(dof_hdr_t *dof, dof_sec_t *sec, ui
     uint64_t udaddr)
 {
 	uintptr_t daddr = (uintptr_t)dof;
+	uintptr_t ts_end;
 	dof_relohdr_t *dofr =
 	    (dof_relohdr_t *)(uintptr_t)(daddr + sec->dofs_offset);
 	dof_sec_t *ss, *rs, *ts;
@@ -13944,6 +13945,7 @@ dtrace_dof_relocate(dof_hdr_t *dof, dof_sec_t *sec, ui
 	ss = dtrace_dof_sect(dof, DOF_SECT_STRTAB, dofr->dofr_strtab);
 	rs = dtrace_dof_sect(dof, DOF_SECT_RELTAB, dofr->dofr_relsec);
 	ts = dtrace_dof_sect(dof, DOF_SECT_NONE, dofr->dofr_tgtsec);
+	ts_end = (uintptr_t)ts + sizeof (dof_sec_t);
 
 	if (ss == NULL || rs == NULL || ts == NULL)
 		return (-1); /* dtrace_dof_error() has been called already */
@@ -13967,6 +13969,11 @@ dtrace_dof_relocate(dof_hdr_t *dof, dof_sec_t *sec, ui
 		case DOF_RELO_DOFREL:
 			if (r->dofr_offset >= ts->dofs_size || r->dofr_offset +
 			    sizeof (uint64_t) > ts->dofs_size) {
+				dtrace_dof_error(dof, "bad relocation offset");
+				return (-1);
+			}
+
+			if (taddr >= (uintptr_t)ts && taddr < ts_end) {
 				dtrace_dof_error(dof, "bad relocation offset");
 				return (-1);
 			}



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