Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-3-0]: src/sys Pull up following revision(s) (requested by adrianp...
details: https://anonhg.NetBSD.org/src/rev/6c0a17d7debb
branches: netbsd-3-0
changeset: 579318:6c0a17d7debb
user: ghen <ghen%NetBSD.org@localhost>
date: Tue Oct 24 16:33:33 2006 +0000
description:
Pull up following revision(s) (requested by adrianp in ticket #1564):
sys/compat/darwin/darwin_ktrace.c: revision 1.6 via patch
sys/compat/darwin/darwin_iohidsystem.c: revision 1.35 via patch
sys/compat/freebsd/freebsd_misc.c: revision 1.26 via patch
sys/kern/kern_ktrace.c: revision 1.110 via patch
sys/sys/ktrace.h: revision 1.45 via patch
make ktruser enforce the maximum buffer length, and return an error.
ktruser checks for length now.
ktruser now returns an error if the buffer length is too big.
diffstat:
sys/compat/darwin/darwin_iohidsystem.c | 6 +++---
sys/compat/darwin/darwin_ktrace.c | 8 +++-----
sys/compat/freebsd/freebsd_misc.c | 12 ++++--------
sys/kern/kern_ktrace.c | 22 ++++++++++++----------
sys/sys/ktrace.h | 4 ++--
5 files changed, 24 insertions(+), 28 deletions(-)
diffs (176 lines):
diff -r 92554fb1fa2d -r 6c0a17d7debb sys/compat/darwin/darwin_iohidsystem.c
--- a/sys/compat/darwin/darwin_iohidsystem.c Tue Oct 24 08:37:09 2006 +0000
+++ b/sys/compat/darwin/darwin_iohidsystem.c Tue Oct 24 16:33:33 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: darwin_iohidsystem.c,v 1.28 2005/02/26 23:10:18 perry Exp $ */
+/* $NetBSD: darwin_iohidsystem.c,v 1.28.4.1 2006/10/24 16:33:33 ghen Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: darwin_iohidsystem.c,v 1.28 2005/02/26 23:10:18 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: darwin_iohidsystem.c,v 1.28.4.1 2006/10/24 16:33:33 ghen Exp $");
#include "ioconf.h"
#include "wsmux.h"
@@ -721,7 +721,7 @@
#ifdef KTRACE
if (KTRPOINT(l->l_proc, KTR_USER))
- ktruser(l->l_proc, "notify_iohidsystem", NULL, 0, 0);
+ (void)ktruser(l->l_proc, "notify_iohidsystem", NULL, 0, 0);
#endif
mr->mr_refcount++;
diff -r 92554fb1fa2d -r 6c0a17d7debb sys/compat/darwin/darwin_ktrace.c
--- a/sys/compat/darwin/darwin_ktrace.c Tue Oct 24 08:37:09 2006 +0000
+++ b/sys/compat/darwin/darwin_ktrace.c Tue Oct 24 16:33:33 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: darwin_ktrace.c,v 1.2 2004/07/28 22:24:06 manu Exp $ */
+/* $NetBSD: darwin_ktrace.c,v 1.2.16.1 2006/10/24 16:33:33 ghen Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: darwin_ktrace.c,v 1.2 2004/07/28 22:24:06 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: darwin_ktrace.c,v 1.2.16.1 2006/10/24 16:33:33 ghen Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -65,7 +65,5 @@
syscallarg(size_t) len;
} */ *uap = v;
- ktruser(l->l_proc, "darwin", SCARG(uap, addr), SCARG(uap, len), 0);
-
- return 0;
+ return ktruser(l->l_proc, "darwin", SCARG(uap, addr), SCARG(uap, len), 0);
}
diff -r 92554fb1fa2d -r 6c0a17d7debb sys/compat/freebsd/freebsd_misc.c
--- a/sys/compat/freebsd/freebsd_misc.c Tue Oct 24 08:37:09 2006 +0000
+++ b/sys/compat/freebsd/freebsd_misc.c Tue Oct 24 16:33:33 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: freebsd_misc.c,v 1.21.2.2 2005/09/13 16:46:53 tron Exp $ */
+/* $NetBSD: freebsd_misc.c,v 1.21.2.2.2.1 2006/10/24 16:33:33 ghen Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: freebsd_misc.c,v 1.21.2.2 2005/09/13 16:46:53 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_misc.c,v 1.21.2.2.2.1 2006/10/24 16:33:33 ghen Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
@@ -234,12 +234,8 @@
if (!KTRPOINT(p, KTR_USER))
return 0;
- if (SCARG(uap, len) > KTR_USER_MAXLEN)
- return EINVAL;
-
- ktruser(p, "FreeBSD utrace", SCARG(uap, addr), SCARG(uap, len), 0);
-
- return 0;
+ return ktruser(p, "FreeBSD utrace", SCARG(uap, addr), SCARG(uap, len),
+ 0);
#else
return ENOSYS;
#endif
diff -r 92554fb1fa2d -r 6c0a17d7debb sys/kern/kern_ktrace.c
--- a/sys/kern/kern_ktrace.c Tue Oct 24 08:37:09 2006 +0000
+++ b/sys/kern/kern_ktrace.c Tue Oct 24 16:33:33 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_ktrace.c,v 1.96 2005/02/09 16:15:16 christos Exp $ */
+/* $NetBSD: kern_ktrace.c,v 1.96.6.1 2006/10/24 16:33:33 ghen Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.96 2005/02/09 16:15:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.96.6.1 2006/10/24 16:33:33 ghen Exp $");
#include "opt_ktrace.h"
#include "opt_compat_mach.h"
@@ -640,13 +640,17 @@
p->p_traceflag &= ~KTRFAC_ACTIVE;
}
-void
+int
ktruser(struct proc *p, const char *id, void *addr, size_t len, int ustr)
{
struct ktrace_entry *kte;
struct ktr_header *kth;
struct ktr_user *ktp;
caddr_t user_dta;
+ int error;
+
+ if (len > KTR_USER_MAXLEN)
+ return ENOSPC;
p->p_traceflag |= KTRFAC_ACTIVE;
kte = pool_get(&kte_pool, PR_WAITOK);
@@ -662,7 +666,7 @@
ktp->ktr_id[KTR_USER_MAXIDLEN-1] = '\0';
user_dta = (caddr_t)(ktp + 1);
- if (copyin(addr, (void *)user_dta, len) != 0)
+ if ((error = copyin(addr, (void *)user_dta, len)) != 0)
len = 0;
kth->ktr_len = sizeof(struct ktr_user) + len;
@@ -670,6 +674,7 @@
ktraddentry(p, kte, KTA_WAITOK);
p->p_traceflag &= ~KTRFAC_ACTIVE;
+ return error;
}
void
@@ -1212,13 +1217,10 @@
if (!KTRPOINT(p, KTR_USER))
return (0);
-
- if (SCARG(uap, len) > KTR_USER_MAXLEN)
- return (EINVAL);
+
+ return ktruser(p, SCARG(uap, label), SCARG(uap, addr),
+ SCARG(uap, len), 1);
- ktruser(p, SCARG(uap, label), SCARG(uap, addr), SCARG(uap, len), 1);
-
- return (0);
#else /* !KTRACE */
return ENOSYS;
#endif /* KTRACE */
diff -r 92554fb1fa2d -r 6c0a17d7debb sys/sys/ktrace.h
--- a/sys/sys/ktrace.h Tue Oct 24 08:37:09 2006 +0000
+++ b/sys/sys/ktrace.h Tue Oct 24 16:33:33 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ktrace.h,v 1.41 2005/02/26 22:25:34 perry Exp $ */
+/* $NetBSD: ktrace.h,v 1.41.12.1 2006/10/24 16:33:33 ghen Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -234,7 +234,7 @@
void ktrsyscall(struct proc *, register_t, register_t,
const struct sysent *, register_t []);
void ktrsysret(struct proc *, register_t, int, register_t *);
-void ktruser(struct proc *, const char *, void *, size_t, int);
+int ktruser(struct proc *, const char *, void *, size_t, int);
void ktrmmsg(struct proc *, const void *, size_t);
void ktrkmem(struct proc *, int, const void *, size_t);
void ktrmool(struct proc *, const void *, size_t, const void *);
Home |
Main Index |
Thread Index |
Old Index