Deleted Added
full compact
fasttrap.c (254198) fasttrap.c (258291)
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 *
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 $
23 * $FreeBSD: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c 258291 2013-11-18 03:24:50Z markj $
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) {
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;
2067 fasttrap_probe_spec_t *uprobe = *(fasttrap_probe_spec_t **)arg;
2068 fasttrap_probe_spec_t *probe;
2069 uint64_t noffs;
2070 size_t size;
2071 int ret;
2072 char *c;
2073
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);
2074 if (copyin(&uprobe->ftps_noffs, &noffs,
2075 sizeof (uprobe->ftps_noffs)))
2076 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
2077
2078 /*
2079 * Probes must have at least one tracepoint.
2080 */
2081 if (noffs == 0)
2082 return (EINVAL);
2083
2084 size = sizeof (fasttrap_probe_spec_t) +
2085 sizeof (probe->ftps_offs[0]) * (noffs - 1);
2086
2087 if (size > 1024 * 1024)
2088 return (ENOMEM);
2089
2090 probe = kmem_alloc(size, KM_SLEEP);
2091
2096#if defined(sun)
2097 if (copyin(uprobe, probe, size) != 0) {
2098 kmem_free(probe, size);
2099 return (EFAULT);
2100 }
2092 if (copyin(uprobe, probe, size) != 0) {
2093 kmem_free(probe, size);
2094 return (EFAULT);
2095 }
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
2096
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 ---
2097 /*
2098 * Verify that the function and module strings contain no
2099 * funny characters.
2100 */
2101 for (c = &probe->ftps_func[0]; *c != '\0'; c++) {
2102 if (*c < 0x20 || 0x7f <= *c) {
2103 ret = EINVAL;
2104 goto err;

--- 407 unchanged lines hidden ---