MFV r296989:

6734 dtrace_canstore_statvar() fails for some valid static variables

Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Bryan Cantrill <bryan@joyent.com>

illumos/illumos-gate@d65f2bb4e5

MFC after:	2 weeks
This commit is contained in:
markj 2016-08-16 02:16:54 +00:00
commit 81ae8f62f3
3 changed files with 65 additions and 4 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -707,8 +707,8 @@ dtrace_canstore_statvar(uint64_t addr, size_t sz,
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, size_t sz,
* 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);