Deleted Added
sdiff udiff text old ( 254198 ) new ( 258291 )
full compact
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 6 unchanged lines hidden (view full) ---

15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 *
21 * Portions Copyright 2010 The FreeBSD Foundation
22 *
23 * $FreeBSD: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c 254198 2013-08-11 00:57:01Z rpaulo $
24 */
25
26/*
27 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
29 */
30
31#if defined(sun)

--- 2027 unchanged lines hidden (view full) ---

2059#ifdef notyet
2060 struct kinfo_proc kp;
2061 const cred_t *cr = td->td_ucred;
2062#endif
2063 if (!dtrace_attached())
2064 return (EAGAIN);
2065
2066 if (cmd == FASTTRAPIOC_MAKEPROBE) {
2067 fasttrap_probe_spec_t *uprobe = (void *)arg;
2068 fasttrap_probe_spec_t *probe;
2069 uint64_t noffs;
2070 size_t size;
2071 int ret;
2072 char *c;
2073
2074#if defined(sun)
2075 if (copyin(&uprobe->ftps_noffs, &noffs,
2076 sizeof (uprobe->ftps_noffs)))
2077 return (EFAULT);
2078#else
2079 noffs = uprobe->ftps_noffs;
2080#endif
2081
2082 /*
2083 * Probes must have at least one tracepoint.
2084 */
2085 if (noffs == 0)
2086 return (EINVAL);
2087
2088 size = sizeof (fasttrap_probe_spec_t) +
2089 sizeof (probe->ftps_offs[0]) * (noffs - 1);
2090
2091 if (size > 1024 * 1024)
2092 return (ENOMEM);
2093
2094 probe = kmem_alloc(size, KM_SLEEP);
2095
2096#if defined(sun)
2097 if (copyin(uprobe, probe, size) != 0) {
2098 kmem_free(probe, size);
2099 return (EFAULT);
2100 }
2101#else
2102 memcpy(probe, uprobe, sizeof(*probe));
2103 if (noffs > 1 && copyin(uprobe + 1, probe + 1, size) != 0) {
2104 kmem_free(probe, size);
2105 return (EFAULT);
2106 }
2107#endif
2108
2109
2110 /*
2111 * Verify that the function and module strings contain no
2112 * funny characters.
2113 */
2114 for (c = &probe->ftps_func[0]; *c != '\0'; c++) {
2115 if (*c < 0x20 || 0x7f <= *c) {
2116 ret = EINVAL;
2117 goto err;

--- 407 unchanged lines hidden ---