summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorAlex Wilson <alex.wilson@joyent.com>2016-04-15 14:10:39 -0700
committerAlex Wilson <alex.wilson@joyent.com>2016-05-26 20:08:50 -0700
commit41d1d652c3fede61f722f0668fcb0f7848a7c52f (patch)
tree433e6fa030c27d7e55f13eda9d9cb1665d419434 /usr/src
parentc4e89105e047c5120e419a21e0b5a9ec18892927 (diff)
downloadillumos-joyent-41d1d652c3fede61f722f0668fcb0f7848a7c52f.tar.gz
OS-5328 dtrace negative record sizes should be rejected
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com> Reviewed by: Bryan Cantrill <bryan@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/common/dtrace/dtrace.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/usr/src/uts/common/dtrace/dtrace.c b/usr/src/uts/common/dtrace/dtrace.c
index fd23a57794..4c31530238 100644
--- a/usr/src/uts/common/dtrace/dtrace.c
+++ b/usr/src/uts/common/dtrace/dtrace.c
@@ -10580,7 +10580,7 @@ dtrace_ecb_enable(dtrace_ecb_t *ecb)
}
}
-static void
+static int
dtrace_ecb_resize(dtrace_ecb_t *ecb)
{
dtrace_action_t *act;
@@ -10614,6 +10614,8 @@ dtrace_ecb_resize(dtrace_ecb_t *ecb)
curneeded = P2ROUNDUP(curneeded, rec->dtrd_alignment);
rec->dtrd_offset = curneeded;
+ if (curneeded + rec->dtrd_size < curneeded)
+ return (EINVAL);
curneeded += rec->dtrd_size;
ecb->dte_needed = MAX(ecb->dte_needed, curneeded);
@@ -10638,6 +10640,8 @@ dtrace_ecb_resize(dtrace_ecb_t *ecb)
}
curneeded = P2ROUNDUP(curneeded, rec->dtrd_alignment);
rec->dtrd_offset = curneeded;
+ if (curneeded + rec->dtrd_size < curneeded)
+ return (EINVAL);
curneeded += rec->dtrd_size;
} else {
/* tuples must be followed by an aggregation */
@@ -10647,6 +10651,8 @@ dtrace_ecb_resize(dtrace_ecb_t *ecb)
ecb->dte_size = P2ROUNDUP(ecb->dte_size,
rec->dtrd_alignment);
rec->dtrd_offset = ecb->dte_size;
+ if (ecb->dte_size + rec->dtrd_size < ecb->dte_size)
+ return (EINVAL);
ecb->dte_size += rec->dtrd_size;
ecb->dte_needed = MAX(ecb->dte_needed, ecb->dte_size);
}
@@ -10666,6 +10672,7 @@ dtrace_ecb_resize(dtrace_ecb_t *ecb)
ecb->dte_needed = P2ROUNDUP(ecb->dte_needed, (sizeof (dtrace_epid_t)));
ecb->dte_state->dts_needed = MAX(ecb->dte_state->dts_needed,
ecb->dte_needed);
+ return (0);
}
static dtrace_action_t *
@@ -11333,7 +11340,10 @@ dtrace_ecb_create(dtrace_state_t *state, dtrace_probe_t *probe,
}
}
- dtrace_ecb_resize(ecb);
+ if ((enab->dten_error = dtrace_ecb_resize(ecb)) != 0) {
+ dtrace_ecb_destroy(ecb);
+ return (NULL);
+ }
return (dtrace_ecb_create_cache = ecb);
}