fasttrap.c (268007) | fasttrap.c (268097) |
---|---|
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 268007 2014-06-28 19:59:12Z pfg $ | 23 * $FreeBSD: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c 268097 2014-07-01 15:36:05Z pfg $ |
24 */ 25 26/* 27 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 28 * Use is subject to license terms. 29 */ 30 | 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) 32#pragma ident "%Z%%M% %I% %E% SMI" 33#endif | 31/* 32 * Copyright (c) 2013, Joyent, Inc. All rights reserved. 33 */ |
34 35#include <sys/atomic.h> 36#include <sys/errno.h> 37#include <sys/stat.h> 38#include <sys/modctl.h> 39#include <sys/conf.h> 40#include <sys/systm.h> 41#if defined(sun) --- 16 unchanged lines hidden (view full) --- 58#if defined(sun) 59#include <util/qsort.h> 60#endif 61#include <sys/mutex.h> 62#include <sys/kernel.h> 63#if !defined(sun) 64#include <sys/dtrace_bsd.h> 65#include <sys/eventhandler.h> | 34 35#include <sys/atomic.h> 36#include <sys/errno.h> 37#include <sys/stat.h> 38#include <sys/modctl.h> 39#include <sys/conf.h> 40#include <sys/systm.h> 41#if defined(sun) --- 16 unchanged lines hidden (view full) --- 58#if defined(sun) 59#include <util/qsort.h> 60#endif 61#include <sys/mutex.h> 62#include <sys/kernel.h> 63#if !defined(sun) 64#include <sys/dtrace_bsd.h> 65#include <sys/eventhandler.h> |
66#include <sys/u8_textprep.h> |
|
66#include <sys/user.h> 67#include <vm/vm.h> 68#include <vm/pmap.h> 69#include <vm/vm_map.h> 70#include <vm/vm_param.h> 71#include <cddl/dev/dtrace/dtrace_cddl.h> 72#endif 73 --- 2177 unchanged lines hidden (view full) --- 2251 if (!dtrace_attached()) 2252 return (EAGAIN); 2253 2254 if (cmd == FASTTRAPIOC_MAKEPROBE) { 2255 fasttrap_probe_spec_t *uprobe = *(fasttrap_probe_spec_t **)arg; 2256 fasttrap_probe_spec_t *probe; 2257 uint64_t noffs; 2258 size_t size; | 67#include <sys/user.h> 68#include <vm/vm.h> 69#include <vm/pmap.h> 70#include <vm/vm_map.h> 71#include <vm/vm_param.h> 72#include <cddl/dev/dtrace/dtrace_cddl.h> 73#endif 74 --- 2177 unchanged lines hidden (view full) --- 2252 if (!dtrace_attached()) 2253 return (EAGAIN); 2254 2255 if (cmd == FASTTRAPIOC_MAKEPROBE) { 2256 fasttrap_probe_spec_t *uprobe = *(fasttrap_probe_spec_t **)arg; 2257 fasttrap_probe_spec_t *probe; 2258 uint64_t noffs; 2259 size_t size; |
2259 int ret; 2260 char *c; | 2260 int ret, err; |
2261 2262 if (copyin(&uprobe->ftps_noffs, &noffs, 2263 sizeof (uprobe->ftps_noffs))) 2264 return (EFAULT); 2265 2266 /* 2267 * Probes must have at least one tracepoint. 2268 */ --- 12 unchanged lines hidden (view full) --- 2281 kmem_free(probe, size); 2282 return (EFAULT); 2283 } 2284 2285 /* 2286 * Verify that the function and module strings contain no 2287 * funny characters. 2288 */ | 2261 2262 if (copyin(&uprobe->ftps_noffs, &noffs, 2263 sizeof (uprobe->ftps_noffs))) 2264 return (EFAULT); 2265 2266 /* 2267 * Probes must have at least one tracepoint. 2268 */ --- 12 unchanged lines hidden (view full) --- 2281 kmem_free(probe, size); 2282 return (EFAULT); 2283 } 2284 2285 /* 2286 * Verify that the function and module strings contain no 2287 * funny characters. 2288 */ |
2289 for (c = &probe->ftps_func[0]; *c != '\0'; c++) { 2290 if (*c < 0x20 || 0x7f <= *c) { 2291 ret = EINVAL; 2292 goto err; 2293 } | 2289 if (u8_validate(probe->ftps_func, strlen(probe->ftps_func), 2290 NULL, U8_VALIDATE_ENTIRE, &err) < 0) { 2291 ret = EINVAL; 2292 goto err; |
2294 } 2295 | 2293 } 2294 |
2296 for (c = &probe->ftps_mod[0]; *c != '\0'; c++) { 2297 if (*c < 0x20 || 0x7f <= *c) { 2298 ret = EINVAL; 2299 goto err; 2300 } | 2295 if (u8_validate(probe->ftps_mod, strlen(probe->ftps_mod), 2296 NULL, U8_VALIDATE_ENTIRE, &err) < 0) { 2297 ret = EINVAL; 2298 goto err; |
2301 } 2302 2303#ifdef notyet 2304 if (!PRIV_POLICY_CHOICE(cr, PRIV_ALL, B_FALSE)) { 2305 proc_t *p; 2306 pid_t pid = probe->ftps_pid; 2307 2308#if defined(sun) --- 417 unchanged lines hidden --- | 2299 } 2300 2301#ifdef notyet 2302 if (!PRIV_POLICY_CHOICE(cr, PRIV_ALL, B_FALSE)) { 2303 proc_t *p; 2304 pid_t pid = probe->ftps_pid; 2305 2306#if defined(sun) --- 417 unchanged lines hidden --- |