Revert r268007, and re-adapt MFV r260708:

4427 pid provider rejects probes with valid UTF-8 names

Use of u8_textprep.c required -Wno-cast-qual for powerpc.

MFC after:	2 weeks
This commit is contained in:
pfg 2014-07-01 15:36:05 +00:00
parent 68790c5590
commit 9761db2de6
2 changed files with 17 additions and 15 deletions

View File

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

View File

@ -20,9 +20,13 @@ CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/powerpc
.PATH: ${SYSDIR}/cddl/contrib/opensolaris/uts/powerpc/dtrace .PATH: ${SYSDIR}/cddl/contrib/opensolaris/uts/powerpc/dtrace
.endif .endif
.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/common/unicode
SRCS+= u8_textprep.c
CFLAGS+= -DSMP CFLAGS+= -DSMP
.include <bsd.kmod.mk> .include <bsd.kmod.mk>
CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h
CWARNFLAGS+= -Wno-cast-qual
CWARNFLAGS+= -Wno-unused CWARNFLAGS+= -Wno-unused