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 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) { |
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 |
2074 if (copyin(&uprobe->ftps_noffs, &noffs, 2075 sizeof (uprobe->ftps_noffs))) 2076 return (EFAULT); |
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 |
2092 if (copyin(uprobe, probe, size) != 0) { 2093 kmem_free(probe, size); 2094 return (EFAULT); 2095 } |
2096 |
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 --- |