diff options
| author | christos <christos@NetBSD.org> | 2018-03-16 17:25:04 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2018-03-16 17:25:04 +0000 |
| commit | cd81eded9f4f5d91df8536d06ddcbc85d78b1c82 (patch) | |
| tree | 0a13b67225d17dc649b284827a0fce832ec78fcc /sys/compat | |
| parent | 8c3f691180463cf475f8ae02eb034232fd7b6c1c (diff) | |
PR/53103: Timo Buhrmester: linux emulation of sendto(2) broken
The sockargs refactoring broke it, because sockargs only works with a user
address. Added an argument to sockargs to indicate where the address is
coming from. Welcome to 8.99.14.
Diffstat (limited to 'sys/compat')
| -rw-r--r-- | sys/compat/common/uipc_syscalls_43.c | 7 | ||||
| -rw-r--r-- | sys/compat/linux/common/linux_socket.c | 15 | ||||
| -rw-r--r-- | sys/compat/netbsd32/netbsd32_compat_43.c | 6 |
3 files changed, 17 insertions, 11 deletions
diff --git a/sys/compat/common/uipc_syscalls_43.c b/sys/compat/common/uipc_syscalls_43.c index 0710fec95be..e2428460d9e 100644 --- a/sys/compat/common/uipc_syscalls_43.c +++ b/sys/compat/common/uipc_syscalls_43.c @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_syscalls_43.c,v 1.47 2016/09/13 07:01:07 martin Exp $ */ +/* $NetBSD: uipc_syscalls_43.c,v 1.48 2018/03/16 17:25:04 christos 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.47 2016/09/13 07:01:07 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_43.c,v 1.48 2018/03/16 17:25:04 christos Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -343,7 +343,8 @@ compat_43_sys_sendmsg(struct lwp *l, const struct compat_43_sys_sendmsg_args *ua msg.msg_iovlen = omsg.msg_iovlen; msg.msg_iov = omsg.msg_iov; - error = sockargs(&nam, omsg.msg_name, omsg.msg_namelen, MT_SONAME); + error = sockargs(&nam, omsg.msg_name, omsg.msg_namelen, + UIO_USERSPACE, MT_SONAME); if (error != 0) return (error); diff --git a/sys/compat/linux/common/linux_socket.c b/sys/compat/linux/common/linux_socket.c index ca39738ffd7..20f2b0918cd 100644 --- a/sys/compat/linux/common/linux_socket.c +++ b/sys/compat/linux/common/linux_socket.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_socket.c,v 1.139 2017/11/22 10:19:14 ozaki-r Exp $ */ +/* $NetBSD: linux_socket.c,v 1.140 2018/03/16 17:25:04 christos 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.139 2017/11/22 10:19:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.140 2018/03/16 17:25:04 christos Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -401,6 +401,7 @@ linux_sys_sendto(struct lwp *l, const struct linux_sys_sendto_args *uap, registe struct msghdr msg; struct iovec aiov; struct sockaddr_big nam; + struct mbuf *m; int bflags; int error; @@ -419,9 +420,13 @@ linux_sys_sendto(struct lwp *l, const struct linux_sys_sendto_args *uap, registe error = linux_get_sa(l, SCARG(uap, s), &nam, SCARG(uap, to), SCARG(uap, tolen)); if (error) - return (error); - msg.msg_name = &nam; - msg.msg_namelen = SCARG(uap, tolen); + return error; + error = sockargs(&m, &nam, nam.sb_len, UIO_SYSSPACE, MT_SONAME); + if (error) + return error; + msg.msg_flags |= MSG_NAMEMBUF; + msg.msg_name = m; + msg.msg_namelen = nam.sb_len; } msg.msg_iov = &aiov; diff --git a/sys/compat/netbsd32/netbsd32_compat_43.c b/sys/compat/netbsd32/netbsd32_compat_43.c index dd007a1c56c..dafb0f823de 100644 --- a/sys/compat/netbsd32/netbsd32_compat_43.c +++ b/sys/compat/netbsd32/netbsd32_compat_43.c @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_compat_43.c,v 1.54 2016/09/13 07:01:07 martin Exp $ */ +/* $NetBSD: netbsd32_compat_43.c,v 1.55 2018/03/16 17:25:04 christos 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.54 2016/09/13 07:01:07 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.55 2018/03/16 17:25:04 christos Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_43.h" @@ -529,7 +529,7 @@ compat_43_netbsd32_osendmsg(struct lwp *l, const struct compat_43_netbsd32_osend msg.msg_flags = MSG_NAMEMBUF; error = sockargs(&nam, NETBSD32PTR64(omsg.msg_name), omsg.msg_namelen, - MT_SONAME); + UIO_USERSPACE, MT_SONAME); if (error != 0) goto out; |
