On Sat, May 19, 2018 at 02:02:35PM +0200, Alexander Bluhm wrote:
> On Sat, May 19, 2018 at 12:57:19PM +0200, Peter J. Philipp wrote:
> > panic: kernel diagnostic assertion...(cut)
> 
> This is an important line.
> panic: kernel diagnostic assertion "_kernel_lock_held()" failed in file "/us
> Then the photo is cut, but I can guess what is next.

It just panic'ed again 5 min ago.  I took another photo this time made sure 
that the full screen is in the visor.  I can send it hold on, let me extract it 
from my phone... done:

http://centroid.eu/private/p5190002.jpg

hopefully it doesn't panic again while I write this.  I'm going to attempt
testing your patch, given it doesn't panic. 

Thanks!
-peter


> > soassertlocked(ffffffff815c8c03) at soassertlocked+0x73
> > sorwakeup(ffff800032d930c8) at sorwakeup+0xf
> > pfkeyv2_sendmessage(b0, 
> > ffff800000137c00,4,ffff80000124d700,ffff800032d93128,2aa6da05f83cead1) at 
> > pfkeyv2_sendmessage+0x20b
> 
> I would say as long we have no per socket locking, we must grab
> either net lock or kernel lock when accessing the socket.  For pf
> key sockets it is kernel lock, so just add it there.
> 
> bluhm
> 
> Index: net/pfkeyv2.c
> ===================================================================
> RCS file: /data/mirror/openbsd/cvs/src/sys/net/pfkeyv2.c,v
> retrieving revision 1.179
> diff -u -p -r1.179 pfkeyv2.c
> --- net/pfkeyv2.c     16 May 2018 13:19:00 -0000      1.179
> +++ net/pfkeyv2.c     19 May 2018 11:50:53 -0000
> @@ -381,12 +381,15 @@ pfkey_sendup(struct keycb *kp, struct mb
>       } else
>               m = m0;
>  
> +     KERNEL_LOCK()
>       if (!sbappendaddr(so, &so->so_rcv, &pfkey_addr, m, NULL)) {
>               m_freem(m);
> +             KERNEL_UNLOCK();
>               return (ENOBUFS);
>       }
>  
>       sorwakeup(so);
> +     KERNEL_UNLOCK();
>       return (0);
>  }
>  

Reply via email to