Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159769440
D41722.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D41722.diff
View Options
diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
--- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
@@ -515,6 +515,11 @@
((mstate)->dtms_scratch_base + (mstate)->dtms_scratch_size - \
(mstate)->dtms_scratch_ptr >= (alloc_sz))
+#define DTRACE_INSCRATCHPTR(mstate, ptr, howmany) \
+ ((ptr) >= (mstate)->dtms_scratch_base && \
+ (ptr) <= \
+ ((mstate)->dtms_scratch_base + (mstate)->dtms_scratch_size - (howmany)))
+
#define DTRACE_LOADFUNC(bits) \
/*CSTYLED*/ \
uint##bits##_t \
@@ -7739,9 +7744,24 @@
}
case DTRACEACT_PRINTM: {
- /* The DIF returns a 'memref'. */
+ /*
+ * printm() assumes that the DIF returns a
+ * pointer returned by memref(). memref() is a
+ * subroutine that is used to get around the
+ * single-valued returns of DIF and is assumed
+ * to always be allocated in the scratch space.
+ * Therefore, we need to validate that the
+ * pointer given to printm() is in the scratch
+ * space in order to avoid a potential panic.
+ */
uintptr_t *memref = (uintptr_t *)(uintptr_t) val;
+ if (!DTRACE_INSCRATCHPTR(&mstate,
+ (uintptr_t)memref, 2 * sizeof(uintptr_t))) {
+ *flags |= CPU_DTRACE_BADADDR;
+ continue;
+ }
+
/* Get the size from the memref. */
size = memref[1];
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jun 19, 12:44 AM (13 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34063662
Default Alt Text
D41722.diff (1 KB)
Attached To
Mode
D41722: dtrace: Fix a kernel panic in printm().
Attached
Detach File
Event Timeline
Log In to Comment