tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: suprious reboot on netbsd-6:i386 with PAE
On Thu, Dec 05, 2013 at 11:20:16PM +1100, matthew green wrote:
> breaking binary compat like this is really unacceptable.
> can someone please file a PR about it. we should not have
> to patch and rebuild apps!
Attached is a patch that seems to solve the problem at mine. Dovecot
works again and kdump does not dumps core anymore.
I am not sure I did the (nam->m_len > MLEN && !ext) case correctly, though.
And we now report the path length including the trailing zero, I do not
know if it is right or nor.
--
Emmanuel Dreyfus
manu%netbsd.org@localhost
Index: sys/kern/uipc_usrreq.c
===================================================================
RCS file: /cvsroot/src/sys/kern/uipc_usrreq.c,v
retrieving revision 1.148
diff -U8 -r1.148 uipc_usrreq.c
--- sys/kern/uipc_usrreq.c 29 Oct 2013 09:53:51 -0000 1.148
+++ sys/kern/uipc_usrreq.c 5 Dec 2013 14:01:58 -0000
@@ -343,27 +343,31 @@
if (unp->unp_conn && unp->unp_conn->unp_addr)
sun = unp->unp_conn->unp_addr;
} else {
if (unp->unp_addr)
sun = unp->unp_addr;
}
if (sun == NULL)
sun = &sun_noname;
- nam->m_len = sun->sun_len;
+
+ nam->m_len = sun->sun_len + 1; /* +1 for trailin \0 */
+
if (nam->m_len > MLEN && !ext) {
sounlock(so);
MEXTMALLOC(nam, MAXPATHLEN * 2, M_WAITOK);
solock(so);
ext = true;
} else {
KASSERT(nam->m_len <= MAXPATHLEN * 2);
memcpy(mtod(nam, void *), sun, (size_t)nam->m_len);
break;
}
+
+ mtod(nam, char *)[nam->m_len] = '\0'; /* trailin \0 */
}
}
/*ARGSUSED*/
int
uipc_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
struct mbuf *control, struct lwp *l)
{
Home |
Main Index |
Thread Index |
Old Index