Author: markj
Date: Tue Aug 16 02:16:54 2016
New Revision: 304196
URL: https://svnweb.freebsd.org/changeset/base/304196

Log:
  MFV r296989:
  6734 dtrace_canstore_statvar() fails for some valid static variables
  
  Reviewed by: Dan McDonald <dan...@omniti.com>
  Approved by: Richard Lowe <richl...@richlowe.net>
  Author: Bryan Cantrill <br...@joyent.com>
  
  illumos/illumos-gate@d65f2bb4e50559c6c375a2aa9f728cbc34379015
  
  MFC after:    2 weeks

Added:
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.16kglobal.d
     - copied unchanged from r296989, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/tst.16kglobal.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.16klocal.d
     - copied unchanged from r296989, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/tst.16klocal.d
Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Copied: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.16kglobal.d
 (from r296989, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/tst.16kglobal.d)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.16kglobal.d
    Tue Aug 16 02:16:54 2016        (r304196, copy of r296989, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/tst.16kglobal.d)
@@ -0,0 +1,32 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2016, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option strsize=16k
+
+char *k;
+
+BEGIN
+{
+       j = probeprov;
+       k = j;
+       k[0] = 'D';
+       k[1] = 'T';
+}
+
+BEGIN
+{
+       trace(stringof(k));
+       exit(k == "DTrace" ? 0 : 1);
+}

Copied: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.16klocal.d 
(from r296989, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/tst.16klocal.d)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.16klocal.d 
    Tue Aug 16 02:16:54 2016        (r304196, copy of r296989, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/tst.16klocal.d)
@@ -0,0 +1,29 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2016, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option strsize=16k
+
+BEGIN
+{
+       this->j = probeprov;
+       this->j[0] = 'D';
+       this->j[1] = 'T';
+}
+
+BEGIN
+{
+       trace(this->j);
+       exit(this->j == "DTrace" ? 0 : 1);
+}

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:14:36 2016        (r304195)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c        Tue Aug 
16 02:16:54 2016        (r304196)
@@ -707,8 +707,8 @@ dtrace_canstore_statvar(uint64_t addr, s
        if (nsvars == 0)
                return (0);
 
-       maxglobalsize = dtrace_statvar_maxsize;
-       maxlocalsize = (maxglobalsize + sizeof (uint64_t)) * NCPU;
+       maxglobalsize = dtrace_statvar_maxsize + sizeof (uint64_t);
+       maxlocalsize = maxglobalsize * NCPU;
 
        for (i = 0; i < nsvars; i++) {
                dtrace_statvar_t *svar = svars[i];
@@ -726,8 +726,8 @@ dtrace_canstore_statvar(uint64_t addr, s
                 * DTrace to escalate an orthogonal kernel heap corruption bug
                 * into the ability to store to arbitrary locations in memory.
                 */
-               VERIFY((scope == DIFV_SCOPE_GLOBAL && size < maxglobalsize) ||
-                   (scope == DIFV_SCOPE_LOCAL && size < maxlocalsize));
+               VERIFY((scope == DIFV_SCOPE_GLOBAL && size <= maxglobalsize) ||
+                   (scope == DIFV_SCOPE_LOCAL && size <= maxlocalsize));
 
                if (DTRACE_INRANGE(addr, sz, svar->dtsv_data, svar->dtsv_size))
                        return (1);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to