summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2014-02-17 13:11:15 +0000
committeravg <avg@FreeBSD.org>2014-02-17 13:11:15 +0000
commit5add2c7be77fb298fb3c4810ef6c4c1dce046bf3 (patch)
tree9f1992dd2039567ae81eadff1e09a7792137520d
parent3321f134994b66e53405726a3cb81d5dc6116b83 (diff)
downloadFreeBSD-src-5add2c7be77fb298fb3c4810ef6c4c1dce046bf3.zip
FreeBSD-src-5add2c7be77fb298fb3c4810ef6c4c1dce046bf3.tar.gz
MFC r258291: change the ioctl definition so that the fasttrap ioctl
handler is responsible for copying in userland data
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c15
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h2
2 files changed, 2 insertions, 15 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
index d72ee63..fc468b0 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
@@ -2064,20 +2064,16 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag,
return (EAGAIN);
if (cmd == FASTTRAPIOC_MAKEPROBE) {
- fasttrap_probe_spec_t *uprobe = (void *)arg;
+ fasttrap_probe_spec_t *uprobe = *(fasttrap_probe_spec_t **)arg;
fasttrap_probe_spec_t *probe;
uint64_t noffs;
size_t size;
int ret;
char *c;
-#if defined(sun)
if (copyin(&uprobe->ftps_noffs, &noffs,
sizeof (uprobe->ftps_noffs)))
return (EFAULT);
-#else
- noffs = uprobe->ftps_noffs;
-#endif
/*
* Probes must have at least one tracepoint.
@@ -2093,19 +2089,10 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag,
probe = kmem_alloc(size, KM_SLEEP);
-#if defined(sun)
if (copyin(uprobe, probe, size) != 0) {
kmem_free(probe, size);
return (EFAULT);
}
-#else
- memcpy(probe, uprobe, sizeof(*probe));
- if (noffs > 1 && copyin(uprobe + 1, probe + 1, size) != 0) {
- kmem_free(probe, size);
- return (EFAULT);
- }
-#endif
-
/*
* Verify that the function and module strings contain no
diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h b/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h
index 58967fd..431307f 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h
+++ b/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h
@@ -42,8 +42,8 @@ extern "C" {
#define FASTTRAPIOC_MAKEPROBE (FASTTRAPIOC | 1)
#define FASTTRAPIOC_GETINSTR (FASTTRAPIOC | 2)
#else
-#define FASTTRAPIOC_MAKEPROBE _IOW('f', 1, fasttrap_probe_spec_t)
#define FASTTRAPIOC_GETINSTR _IOWR('f', 2, uint8_t)
+#define FASTTRAPIOC_MAKEPROBE _IO('f', 3)
#endif
typedef enum fasttrap_probe_type {
OpenPOWER on IntegriCloud