Date: Mon, 18 Nov 2013 03:24:51 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258291 - in head/sys/cddl/contrib/opensolaris/uts/common: dtrace sys Message-ID: <201311180324.rAI3Op8i095995@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Mon Nov 18 03:24:50 2013 New Revision: 258291 URL: http://svnweb.freebsd.org/changeset/base/258291 Log: The fasttrap ioctl used to create probes takes a variable-sized argument. It was not being correctly copied into the kernel on FreeBSD, and as a result, probes with multiple probe sites were not being created properly. To fix this, change the ioctl definition so that the fasttrap ioctl handler is responsible for copying in userland data. Submitted by: Prashanth Kumar <pra_udupi@yahoo.co.in> MFC after: 1 month Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Mon Nov 18 01:28:29 2013 (r258290) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Mon Nov 18 03:24:50 2013 (r258291) @@ -2064,20 +2064,16 @@ fasttrap_ioctl(struct cdev *dev, u_long 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 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 Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h Mon Nov 18 01:28:29 2013 (r258290) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fasttrap.h Mon Nov 18 03:24:50 2013 (r258291) @@ -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 {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311180324.rAI3Op8i095995>