NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: PR/53103 CVS commit: src/sys
The following reply was made to PR lib/53103; it has been noted by GNATS.
From: Izumi Tsutsui <tsutsui%ceres.dti.ne.jp@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: martin%netbsd.org@localhost, christos%netbsd.org@localhost, tsutsui%ceres.dti.ne.jp@localhost
Subject: Re: PR/53103 CVS commit: src/sys
Date: Fri, 16 Nov 2018 01:52:53 +0900
martin@ wrote:
> No, we can not break the ABI on release branches (module loading code
> does not check the patch level field on != .99 branches).
>
> We would need a proper fix or hack especially for the branch that avoids this.
>
> Maybe duplicate the function that got an extra argument with a new name
> and use that everywhere the new arg is important?
> So all new compiled modules would also use the new function, but old
> modules still would work using the old version.
http://www.nerv.org/netbsd/?q=id:20180316T172504Z.13d546ff8678da724b3c16167900ffb31d5e12c4
In this original commit, only linux_sys_sendto() in
compat/linux/common/linux_socket.c takes UIO_SYSSPACE.
However, the linux_sys_sendto() calls do_sys_sendmsg(), and it calls
do_sys_sendmsg_so(), then do_sys_sendmsg_so() calls sockargs() with
UIO_USERSPACE if MSG_NAMEMBUF is not set.
I'm not sure if changing sockargs() API was worth enough because
the following dumb patch against linux_sys_sendto() can also avoid the
"sockargs cannot handle msg_name already copied into the kernel space"
problem.
Index: sys/compat/linux/common/linux_socket.c
===================================================================
RCS file: /cvsroot/src/sys/compat/linux/common/linux_socket.c,v
retrieving revision 1.138.6.2
diff -u -p -d -r1.138.6.2 linux_socket.c
--- sys/compat/linux/common/linux_socket.c 12 May 2018 10:29:08 -0000 1.138.6.2
+++ sys/compat/linux/common/linux_socket.c 15 Nov 2018 16:34:13 -0000
@@ -401,6 +401,7 @@ linux_sys_sendto(struct lwp *l, const st
struct msghdr msg;
struct iovec aiov;
struct sockaddr_big nam;
+ struct mbuf *m;
int bflags;
int error;
@@ -415,13 +416,31 @@ linux_sys_sendto(struct lwp *l, const st
msg.msg_control = NULL;
if (SCARG(uap, tolen)) {
+ size_t solen;
+
/* Read in and convert the sockaddr */
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);
+
+ /*
+ * XXX
+ * Copy sockaddr_big to mbuf because sockargs() called from
+ * do_sys_sendmsg_so() can't handle sockaddr in msg_name
+ * already copied into the kernel space.
+ */
+ solen = nam.sb_len;
+ m = m_get(M_WAIT, MT_SONAME);
+ if (solen > MLEN) {
+ MEXTMALLOC(m, solen, M_WAITOK);
+ }
+ m->m_len = solen;
+ memcpy(mtod(m, void *), &nam, solen);
+
+ msg.msg_flags |= MSG_NAMEMBUF;
+ msg.msg_name = m;
+ msg.msg_namelen = solen;
}
msg.msg_iov = &aiov;
---
Izumi Tsutsui
Home |
Main Index |
Thread Index |
Old Index