Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: KASSERT "KERNEL_LOCKED_P()" failed (if_ethersubr.c:214) when stopping rpcbind



On Tue, May 20, 2014 at 06:26:17PM +0200, Nicolas Joly wrote:
> 
> Hi,
> 
> Just got hit, on my up-to-date NetBSD/amd64 -current machine, by a
> KASSERT when stopping rpcbind(8). Such as :
> 
> lanfeust# /usr/sbin/rpcbind -d
> rpcbind debugging enabled.
> ^C
> [...KASSSERT...]
> 
> njoly@lanfeust [/misc/crash]> crash -M netbsd.17.core -N netbsd.17
> Crash version 6.99.42,image version 6.99.42.
> System panicked: kernel diagnostic assertion "KERNEL_LOCKED_P()"failed: file 
> "/local/src/NetBSD/src/sys/net/if_ethersubr.c", line 214 
> Backtrace from time of crash is available.

Looks like the KASSERT() I added a few days ago.

Please try the (untested) attached patch, it brings the ipv6 code in line with
ipv4.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--
Index: ip6_flow.c
===================================================================
RCS file: /cvsroot/src/sys/netinet6/ip6_flow.c,v
retrieving revision 1.22
diff -u -p -u -r1.22 ip6_flow.c
--- ip6_flow.c  1 Apr 2014 13:11:44 -0000       1.22
+++ ip6_flow.c  20 May 2014 17:48:48 -0000
@@ -308,13 +308,14 @@ ip6flow_fastforward(struct mbuf **mp)
 
        ip6f->ip6f_uses++;
 
+       KERNEL_LOCK(1, NULL);
        /* Send on its way - straight to the interface output routine. */
        if ((error = (*rt->rt_ifp->if_output)(rt->rt_ifp, m, dst, rt)) != 0) {
                ip6f->ip6f_dropped++;
        } else {
                ip6f->ip6f_forwarded++;
        }
-
+       KERNEL_UNLOCK_ONE(NULL);
        return 1;
 }
 
Index: nd6.c
===================================================================
RCS file: /cvsroot/src/sys/netinet6/nd6.c,v
retrieving revision 1.149
diff -u -p -u -r1.149 nd6.c
--- nd6.c       17 May 2014 20:44:24 -0000      1.149
+++ nd6.c       20 May 2014 17:48:49 -0000
@@ -2257,9 +2257,13 @@ nd6_output(struct ifnet *ifp, struct ifn
                goto bad;
        }
 
+       KERNEL_LOCK(1, NULL);
        if ((ifp->if_flags & IFF_LOOPBACK) != 0)
-               return (*ifp->if_output)(origifp, m, sin6tocsa(dst), rt);
-       return (*ifp->if_output)(ifp, m, sin6tocsa(dst), rt);
+               error = (*ifp->if_output)(origifp, m, sin6tocsa(dst), rt);
+       else
+               error = (*ifp->if_output)(ifp, m, sin6tocsa(dst), rt);
+       KERNEL_UNLOCK_ONE(NULL);
+       return error;
 
   bad:
        if (m != NULL)


Home | Main Index | Thread Index | Old Index