diff options
author | pfg <pfg@FreeBSD.org> | 2014-07-16 02:02:46 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2014-07-16 02:02:46 +0000 |
commit | 5df04fd5373240ddff4eadaa598f642b9c648952 (patch) | |
tree | b7f3839e67e80bbefe2cef274e6bc22aac38cc0a /sys/cddl/contrib | |
parent | 1f33481bdb40d228d6102e815a1bafa70f1cea7c (diff) | |
download | FreeBSD-src-5df04fd5373240ddff4eadaa598f642b9c648952.zip FreeBSD-src-5df04fd5373240ddff4eadaa598f642b9c648952.tar.gz |
MFC r268097:
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.
Use of u8_textprep.c required -Wno-cast-qual for powerpc.
Illumos Revision: 1444d846b126463eb1059a572ff114d51f7562e5
Reference:
https://www.illumos.org/issues/4427
Obtained from: Illumos
Diffstat (limited to 'sys/cddl/contrib')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c | 28 |
1 files changed, 13 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 3be9352..716dabc 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c @@ -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/user.h> #include <sys/dtrace_bsd.h> +#include <sys/u8_textprep.h> #include <cddl/dev/dtrace/dtrace_cddl.h> #endif @@ -2068,8 +2069,7 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag, 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))) @@ -2099,18 +2099,16 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag, * 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 |