Re: sosend netlock assertion crash

2017-07-13 Thread Martin Pieuchot
On 13/07/17(Thu) 18:10, Alexander Bluhm wrote:
> On Thu, Jul 13, 2017 at 10:01:09AM -0600, Todd C. Miller wrote:
> > On Thu, 13 Jul 2017 17:41:19 +0200, Alexander Bluhm wrote:
> > 
> > > My laptop just crashed while running some php ports regress tests.
> > > The kernel complained that it did not hold the netlock in sounlock()
> > > after the out label in sosend().  The assert is correct, let's fix
> > > the obvious offender.
> > 
> > Alternately, we could just initialize s to -42.
> 
> I still hope that this -42 hack will go away eventually.

It will.  The first step is to run the diff I sent to get rid of the
splsotnet()/splx() in the NET_LOCK().



Re: sosend netlock assertion crash

2017-07-13 Thread Alexander Bluhm
On Thu, Jul 13, 2017 at 10:01:09AM -0600, Todd C. Miller wrote:
> On Thu, 13 Jul 2017 17:41:19 +0200, Alexander Bluhm wrote:
> 
> > My laptop just crashed while running some php ports regress tests.
> > The kernel complained that it did not hold the netlock in sounlock()
> > after the out label in sosend().  The assert is correct, let's fix
> > the obvious offender.
> 
> Alternately, we could just initialize s to -42.

I still hope that this -42 hack will go away eventually.

bluhm



Re: sosend netlock assertion crash

2017-07-13 Thread Todd C. Miller
On Thu, 13 Jul 2017 17:41:19 +0200, Alexander Bluhm wrote:

> My laptop just crashed while running some php ports regress tests.
> The kernel complained that it did not hold the netlock in sounlock()
> after the out label in sosend().  The assert is correct, let's fix
> the obvious offender.

Alternately, we could just initialize s to -42.

 - todd



sosend netlock assertion crash

2017-07-13 Thread Alexander Bluhm
Hi,

My laptop just crashed while running some php ports regress tests.
The kernel complained that it did not hold the netlock in sounlock()
after the out label in sosend().  The assert is correct, let's fix
the obvious offender.

ok?

bluhm

Index: kern/uipc_socket.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/kern/uipc_socket.c,v
retrieving revision 1.193
diff -u -p -r1.193 uipc_socket.c
--- kern/uipc_socket.c  8 Jul 2017 09:19:02 -   1.193
+++ kern/uipc_socket.c  13 Jul 2017 15:34:52 -
@@ -396,8 +396,9 @@ sosend(struct socket *so, struct mbuf *a
resid = top->m_pkthdr.len;
/* MSG_EOR on a SOCK_STREAM socket is invalid. */
if (so->so_type == SOCK_STREAM && (flags & MSG_EOR)) {
-   error = EINVAL;
-   goto out;
+   m_freem(top);
+   m_freem(control);
+   return (EINVAL);
}
if (uio && uio->uio_procp)
uio->uio_procp->p_ru.ru_msgsnd++;