Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jun 2014 14:23:30 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r267869 - in head/sys: cddl/contrib/opensolaris/uts/common/dtrace modules/dtrace/fasttrap
Message-ID:  <201406251423.s5PENU4e049416@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Wed Jun 25 14:23:30 2014
New Revision: 267869
URL: http://svnweb.freebsd.org/changeset/base/267869

Log:
  MFV	r260708
  
  4427 pid provider rejects probes with valid UTF-8 names
  
  This make use of Solaris' u8_validate() which we happen to
  use since r185029 for ZFS.
  
  Illumos Revision:	1444d846b126463eb1059a572ff114d51f7562e5
  
  Reference:
  https://www.illumos.org/issues/4427
  
  Obtained from:	Illumos
  MFC after:	2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
  head/sys/modules/dtrace/fasttrap/Makefile

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c	Wed Jun 25 13:33:31 2014	(r267868)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c	Wed Jun 25 14:23:30 2014	(r267869)
@@ -28,9 +28,9 @@
  * Use is subject to license terms.
  */
 
-#if defined(sun)
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-#endif
+/*
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ */
 
 #include <sys/atomic.h>
 #include <sys/errno.h>
@@ -63,6 +63,7 @@
 #if !defined(sun)
 #include <sys/dtrace_bsd.h>
 #include <sys/eventhandler.h>
+#include <sys/u8_textprep.h>
 #include <sys/user.h>
 #include <vm/vm.h>
 #include <vm/pmap.h>
@@ -2256,8 +2257,7 @@ fasttrap_ioctl(struct cdev *dev, u_long 
 		fasttrap_probe_spec_t *probe;
 		uint64_t noffs;
 		size_t size;
-		int ret;
-		char *c;
+		int ret, err;
 
 		if (copyin(&uprobe->ftps_noffs, &noffs,
 		    sizeof (uprobe->ftps_noffs)))
@@ -2286,18 +2286,16 @@ fasttrap_ioctl(struct cdev *dev, u_long 
 		 * Verify that the function and module strings contain no
 		 * funny characters.
 		 */
-		for (c = &probe->ftps_func[0]; *c != '\0'; c++) {
-			if (*c < 0x20 || 0x7f <= *c) {
-				ret = EINVAL;
-				goto err;
-			}
+		if (u8_validate(probe->ftps_func, strlen(probe->ftps_func),
+		    NULL, U8_VALIDATE_ENTIRE, &err) < 0) {
+			ret = EINVAL;
+			goto err;
 		}
 
-		for (c = &probe->ftps_mod[0]; *c != '\0'; c++) {
-			if (*c < 0x20 || 0x7f <= *c) {
-				ret = EINVAL;
-				goto err;
-			}
+		if (u8_validate(probe->ftps_mod, strlen(probe->ftps_mod),
+		    NULL, U8_VALIDATE_ENTIRE, &err) < 0) {
+			ret = EINVAL;
+			goto err;
 		}
 
 #ifdef notyet

Modified: head/sys/modules/dtrace/fasttrap/Makefile
==============================================================================
--- head/sys/modules/dtrace/fasttrap/Makefile	Wed Jun 25 13:33:31 2014	(r267868)
+++ head/sys/modules/dtrace/fasttrap/Makefile	Wed Jun 25 14:23:30 2014	(r267869)
@@ -8,6 +8,9 @@ KMOD=		fasttrap
 SRCS=		fasttrap.c fasttrap_isa.c opt_compat.h
 SRCS+=		vnode_if.h
 
+.PATH:		${.CURDIR}/../../../cddl/contrib/opensolaris/common/unicode
+SRCS+=		u8_textprep.c
+
 CFLAGS+=	-I${SYSDIR}/cddl/compat/opensolaris \
 		-I${SYSDIR}/cddl/contrib/opensolaris/uts/common \
 		-I${SYSDIR}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406251423.s5PENU4e049416>