Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Make the ktrace record written by do_sys_sendmsg/do_sys_...
details: https://anonhg.NetBSD.org/src/rev/f20fce6467de
branches: trunk
changeset: 347726:f20fce6467de
user: martin <martin%NetBSD.org@localhost>
date: Tue Sep 13 07:01:07 2016 +0000
description:
Make the ktrace record written by do_sys_sendmsg/do_sys_recvmsg overridable
by the caller. Use this in compat_netbsd32 to log the 32bit version, so
the 32bit userland kdump is happy.
diffstat:
sys/compat/common/uipc_syscalls_43.c | 9 +++--
sys/compat/linux/common/linux_socket.c | 12 ++++---
sys/compat/netbsd32/netbsd32_compat_43.c | 9 +++--
sys/compat/netbsd32/netbsd32_socket.c | 17 ++++++----
sys/compat/osf1/osf1_socket.c | 7 ++-
sys/compat/svr4/svr4_stream.c | 10 +++---
sys/kern/kern_ktrace.c | 6 +-
sys/kern/uipc_syscalls.c | 53 +++++++++++++++++++++----------
sys/sys/ktrace.h | 6 +-
sys/sys/socketvar.h | 10 +++--
10 files changed, 84 insertions(+), 55 deletions(-)
diffs (truncated from 482 to 300 lines):
diff -r 42026fbc3511 -r f20fce6467de sys/compat/common/uipc_syscalls_43.c
--- a/sys/compat/common/uipc_syscalls_43.c Tue Sep 13 00:45:15 2016 +0000
+++ b/sys/compat/common/uipc_syscalls_43.c Tue Sep 13 07:01:07 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_syscalls_43.c,v 1.46 2014/11/09 17:48:07 maxv Exp $ */
+/* $NetBSD: uipc_syscalls_43.c,v 1.47 2016/09/13 07:01:07 martin Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_43.c,v 1.46 2014/11/09 17:48:07 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_43.c,v 1.47 2016/09/13 07:01:07 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -216,7 +216,7 @@
msg.msg_iov = omsg.msg_iov;
msg.msg_flags = (SCARG(uap, flags) & MSG_USERFLAGS) | MSG_IOVUSRSPACE;
- error = do_sys_recvmsg(l, SCARG(uap, s), &msg, &from,
+ error = do_sys_recvmsg(l, SCARG(uap, s), &msg, NULL, 0, &from,
omsg.msg_accrights != NULL ? &control : NULL, retval);
if (error != 0)
return error;
@@ -361,7 +361,8 @@
if (error != 0)
goto bad;
- return do_sys_sendmsg(l, SCARG(uap, s), &msg, SCARG(uap, flags), retval);
+ return do_sys_sendmsg(l, SCARG(uap, s), &msg, SCARG(uap, flags),
+ NULL, 0, retval);
bad:
if (nam != NULL)
diff -r 42026fbc3511 -r f20fce6467de sys/compat/linux/common/linux_socket.c
--- a/sys/compat/linux/common/linux_socket.c Tue Sep 13 00:45:15 2016 +0000
+++ b/sys/compat/linux/common/linux_socket.c Tue Sep 13 07:01:07 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_socket.c,v 1.132 2016/08/01 03:15:30 ozaki-r Exp $ */
+/* $NetBSD: linux_socket.c,v 1.133 2016/09/13 07:01:07 martin Exp $ */
/*-
* Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.132 2016/08/01 03:15:30 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.133 2016/09/13 07:01:07 martin Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -428,7 +428,8 @@
aiov.iov_base = __UNCONST(SCARG(uap, msg));
aiov.iov_len = SCARG(uap, len);
- return do_sys_sendmsg(l, SCARG(uap, s), &msg, bflags, retval);
+ return do_sys_sendmsg(l, SCARG(uap, s), &msg, bflags,
+ NULL, 0, retval);
}
static void
@@ -617,7 +618,8 @@
}
skipcmsg:
- error = do_sys_sendmsg(l, SCARG(uap, s), &msg, bflags, retval);
+ error = do_sys_sendmsg(l, SCARG(uap, s), &msg, bflags,
+ NULL, 0, retval);
/* Freed internally */
ctl_mbuf = NULL;
@@ -779,7 +781,7 @@
}
msg.msg_flags |= MSG_IOVUSRSPACE;
- error = do_sys_recvmsg(l, SCARG(uap, s), &msg, &from,
+ error = do_sys_recvmsg(l, SCARG(uap, s), &msg, NULL, 0, &from,
msg.msg_control != NULL ? &control : NULL, retval);
if (error != 0)
return error;
diff -r 42026fbc3511 -r f20fce6467de sys/compat/netbsd32/netbsd32_compat_43.c
--- a/sys/compat/netbsd32/netbsd32_compat_43.c Tue Sep 13 00:45:15 2016 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_43.c Tue Sep 13 07:01:07 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_43.c,v 1.53 2010/04/23 23:05:40 joerg Exp $ */
+/* $NetBSD: netbsd32_compat_43.c,v 1.54 2016/09/13 07:01:07 martin Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.53 2010/04/23 23:05:40 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.54 2016/09/13 07:01:07 martin Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_43.h"
@@ -451,7 +451,7 @@
msg.msg_iov = iov;
msg.msg_flags = SCARG(uap, flags) & MSG_USERFLAGS;
- error = do_sys_recvmsg(l, SCARG(uap, s), &msg, &from,
+ error = do_sys_recvmsg(l, SCARG(uap, s), &msg, NULL, 0, &from,
NETBSD32PTR64(omsg.msg_accrights) != NULL ? &control : NULL,
retval);
if (error != 0)
@@ -547,7 +547,8 @@
goto out;
}
- error = do_sys_sendmsg(l, SCARG(uap, s), &msg, SCARG(uap, flags), retval);
+ error = do_sys_sendmsg(l, SCARG(uap, s), &msg, SCARG(uap, flags),
+ &omsg, sizeof(omsg), retval);
out:
if (iov != aiov)
diff -r 42026fbc3511 -r f20fce6467de sys/compat/netbsd32/netbsd32_socket.c
--- a/sys/compat/netbsd32/netbsd32_socket.c Tue Sep 13 00:45:15 2016 +0000
+++ b/sys/compat/netbsd32/netbsd32_socket.c Tue Sep 13 07:01:07 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_socket.c,v 1.43 2016/09/08 18:54:03 martin Exp $ */
+/* $NetBSD: netbsd32_socket.c,v 1.44 2016/09/13 07:01:07 martin Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.43 2016/09/08 18:54:03 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.44 2016/09/13 07:01:07 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -193,8 +193,8 @@
msg.msg_iov = iov;
msg.msg_iovlen = msg32.msg_iovlen;
- error = do_sys_recvmsg(l, SCARG(uap, s), &msg, &from,
- msg.msg_control != NULL ? &control : NULL, retval);
+ error = do_sys_recvmsg(l, SCARG(uap, s), &msg, &msg32, sizeof(msg32),
+ &from, msg.msg_control != NULL ? &control : NULL, retval);
if (error != 0)
goto done;
@@ -367,7 +367,8 @@
goto out;
msg.msg_iov = iov;
- error = do_sys_sendmsg(l, SCARG(uap, s), &msg, SCARG(uap, flags), retval);
+ error = do_sys_sendmsg(l, SCARG(uap, s), &msg, SCARG(uap, flags),
+ &msg32, sizeof(msg32), retval);
/* msg.msg_control freed by do_sys_sendmsg() */
if (iov != aiov)
@@ -406,7 +407,8 @@
msg.msg_control = NULL;
msg.msg_flags = SCARG(uap, flags) & MSG_USERFLAGS;
- error = do_sys_recvmsg(l, SCARG(uap, s), &msg, &from, NULL, retval);
+ error = do_sys_recvmsg(l, SCARG(uap, s), &msg, NULL, ~0U,
+ &from, NULL, retval);
if (error != 0)
return error;
@@ -439,5 +441,6 @@
aiov.iov_base = SCARG_P32(uap, buf); /* XXX kills const */
aiov.iov_len = SCARG(uap, len);
msg.msg_flags = 0;
- return do_sys_sendmsg(l, SCARG(uap, s), &msg, SCARG(uap, flags), retval);
+ return do_sys_sendmsg(l, SCARG(uap, s), &msg, SCARG(uap, flags),
+ NULL, ~0U, retval);
}
diff -r 42026fbc3511 -r f20fce6467de sys/compat/osf1/osf1_socket.c
--- a/sys/compat/osf1/osf1_socket.c Tue Sep 13 00:45:15 2016 +0000
+++ b/sys/compat/osf1/osf1_socket.c Tue Sep 13 07:01:07 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_socket.c,v 1.21 2015/08/08 12:02:35 maxv Exp $ */
+/* $NetBSD: osf1_socket.c,v 1.22 2016/09/13 07:01:08 martin Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: osf1_socket.c,v 1.21 2015/08/08 12:02:35 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: osf1_socket.c,v 1.22 2016/09/13 07:01:08 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -130,7 +130,8 @@
bsd_iovec[i].iov_len = osf_iovec.iov_len;
}
- error = do_sys_sendmsg(l, SCARG(uap, s), &bsd_msghdr, flags, retval);
+ error = do_sys_sendmsg(l, SCARG(uap, s), &bsd_msghdr, flags, NULL, 0,
+ retval);
err:
kmem_free(bsd_iovec, iov_len * sizeof(struct iovec));
return error;
diff -r 42026fbc3511 -r f20fce6467de sys/compat/svr4/svr4_stream.c
--- a/sys/compat/svr4/svr4_stream.c Tue Sep 13 00:45:15 2016 +0000
+++ b/sys/compat/svr4/svr4_stream.c Tue Sep 13 07:01:07 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: svr4_stream.c,v 1.86 2015/05/23 15:27:55 rtr Exp $ */
+/* $NetBSD: svr4_stream.c,v 1.87 2016/09/13 07:01:08 martin Exp $ */
/*-
* Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: svr4_stream.c,v 1.86 2015/05/23 15:27:55 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_stream.c,v 1.87 2016/09/13 07:01:08 martin Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -1502,7 +1502,7 @@
aiov.iov_base = NETBSD32PTR(dat.buf);
aiov.iov_len = dat.len;
error = do_sys_sendmsg(l, SCARG(uap, fd), &msg,
- SCARG(uap, flags), retval);
+ SCARG(uap, flags), NULL, 0, retval);
*retval = 0;
return error;
@@ -1734,8 +1734,8 @@
aiov.iov_len = dat.maxlen;
msg.msg_flags = 0;
- error = do_sys_recvmsg(l, SCARG(uap, fd), &msg, &name, NULL,
- retval);
+ error = do_sys_recvmsg(l, SCARG(uap, fd), &msg, NULL, 0,
+ &name, NULL, retval);
if (error) {
DPRINTF(("getmsg: do_sys_recvmsg failed %d\n", error));
diff -r 42026fbc3511 -r f20fce6467de sys/kern/kern_ktrace.c
--- a/sys/kern/kern_ktrace.c Tue Sep 13 00:45:15 2016 +0000
+++ b/sys/kern/kern_ktrace.c Tue Sep 13 07:01:07 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_ktrace.c,v 1.167 2016/07/07 06:55:43 msaitoh Exp $ */
+/* $NetBSD: kern_ktrace.c,v 1.168 2016/09/13 07:01:08 martin Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.167 2016/07/07 06:55:43 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.168 2016/09/13 07:01:08 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -938,7 +938,7 @@
}
void
-ktr_kuser(const char *id, void *addr, size_t len)
+ktr_kuser(const char *id, const void *addr, size_t len)
{
struct ktrace_entry *kte;
struct ktr_user *ktp;
diff -r 42026fbc3511 -r f20fce6467de sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c Tue Sep 13 00:45:15 2016 +0000
+++ b/sys/kern/uipc_syscalls.c Tue Sep 13 07:01:07 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_syscalls.c,v 1.182 2016/07/07 06:55:43 msaitoh Exp $ */
+/* $NetBSD: uipc_syscalls.c,v 1.183 2016/09/13 07:01:08 martin Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.182 2016/07/07 06:55:43 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.183 2016/09/13 07:01:08 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_pipe.h"
@@ -505,7 +505,8 @@
msg.msg_flags = 0;
aiov.iov_base = __UNCONST(SCARG(uap, buf)); /* XXXUNCONST kills const */
aiov.iov_len = SCARG(uap, len);
- return do_sys_sendmsg(l, SCARG(uap, s), &msg, SCARG(uap, flags), retval);
+ return do_sys_sendmsg(l, SCARG(uap, s), &msg, SCARG(uap, flags),
+ NULL, 0, retval);
}
int
@@ -525,12 +526,14 @@
Home |
Main Index |
Thread Index |
Old Index