NetBSD Problem Report #49410
From root@gateway.kardel.name Sat Nov 22 15:34:43 2014
Return-Path: <root@gateway.kardel.name>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 3A635A6664
for <gnats-bugs@gnats.NetBSD.org>; Sat, 22 Nov 2014 15:34:43 +0000 (UTC)
Message-Id: <20141122153435.94B515710D1@gateway.kardel.name>
Date: Sat, 22 Nov 2014 15:34:35 +0000 (UTC)
From: kardel@netbsd.org
Reply-To: kardel@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: -current: panic: "KERNEL_LOCKED_P()" failed: file ".../if_loop.c", line 221
X-Send-Pr-Version: 3.95
>Number: 49410
>Category: kern
>Synopsis: -current MROUTING enabled kernel panics in if_loop.c:221 with KERNEL_LOCKED_P assertion
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Nov 22 15:35:00 +0000 2014
>Closed-Date: Wed Nov 26 10:21:11 +0000 2014
>Last-Modified: Mon Dec 01 10:40:01 +0000 2014
>Originator: Charlie Root
>Release: NetBSD 7.99.1
>Organization:
>Environment:
System: NetBSD gateway.kardel.name 7.99.1 NetBSD 7.99.1 (GATEWAY) #21: Sat Nov 22 13:49:32 CET 2014 kardel@pip.kardel.name:/fs/raid1a/src/NetBSD/cur/src/obj.amd64/sys/arch/amd64/compile/GATEWAY amd64
Architecture: x86_64
Machine: amd64
>Description:
A -current kernel with multicast support panics due to locking error.
panic: kernel diagnostic assertion "KERNEL_LOCKED_P()" failed: file "/fs/raid1a/src/NetBSD/cur/src/sys/net/if_loop.c", line 221
cpu1: Begin traceback...
vpanic() at netbsd:vpanic+0x13c
kern_assert() at netbsd:kern_assert+0x4f
looutput() at netbsd:looutput+0x39e
ip_output() at netbsd:ip_output+0x8b0
igmp_sendpkt.isra.1() at netbsd:igmp_sendpkt.isra.1+0x117
igmp_fasttimo() at netbsd:igmp_fasttimo+0xb3
pffasttimo() at netbsd:pffasttimo+0x31
callout_softclock() at netbsd:callout_softclock+0x1d0
softint_dispatch() at netbsd:softint_dispatch+0xd3
>How-To-Repeat:
pick -current kernel with MROUTING enabled and run with
multicast services like mrouted and multiple interfaces
and watch it panic while trying to reach multi user.
>Fix:
With MROUTING disabled the kernel will survive the startup
but that is not the solution.
>Release-Note:
>Audit-Trail:
From: Ryota Ozaki <ozaki-r@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/49410: -current: panic: "KERNEL_LOCKED_P()" failed: file
".../if_loop.c", line 221
Date: Sun, 23 Nov 2014 20:12:49 +0900
On Sun, Nov 23, 2014 at 12:35 AM, <kardel@netbsd.org> wrote:
>>Number: 49410
>>Category: kern
>>Synopsis: -current MROUTING enabled kernel panics in if_loop.c:221 with KERNEL_LOCKED_P assertion
>>Confidential: no
>>Severity: serious
>>Priority: high
>>Responsible: kern-bug-people
>>State: open
>>Class: sw-bug
>>Submitter-Id: net
>>Arrival-Date: Sat Nov 22 15:35:00 +0000 2014
>>Originator: Charlie Root
>>Release: NetBSD 7.99.1
>>Organization:
>>Environment:
> System: NetBSD gateway.kardel.name 7.99.1 NetBSD 7.99.1 (GATEWAY) #21: Sat Nov 22 13:49:32 CET 2014 kardel@pip.kardel.name:/fs/raid1a/src/NetBSD/cur/src/obj.amd64/sys/arch/amd64/compile/GATEWAY amd64
> Architecture: x86_64
> Machine: amd64
>>Description:
> A -current kernel with multicast support panics due to locking error.
>
> panic: kernel diagnostic assertion "KERNEL_LOCKED_P()" failed: file "/fs/raid1a/src/NetBSD/cur/src/sys/net/if_loop.c", line 221
> cpu1: Begin traceback...
> vpanic() at netbsd:vpanic+0x13c
> kern_assert() at netbsd:kern_assert+0x4f
> looutput() at netbsd:looutput+0x39e
> ip_output() at netbsd:ip_output+0x8b0
> igmp_sendpkt.isra.1() at netbsd:igmp_sendpkt.isra.1+0x117
> igmp_fasttimo() at netbsd:igmp_fasttimo+0xb3
> pffasttimo() at netbsd:pffasttimo+0x31
> callout_softclock() at netbsd:callout_softclock+0x1d0
> softint_dispatch() at netbsd:softint_dispatch+0xd3
>>How-To-Repeat:
> pick -current kernel with MROUTING enabled and run with
> multicast services like mrouted and multiple interfaces
> and watch it panic while trying to reach multi user.
>>Fix:
> With MROUTING disabled the kernel will survive the startup
> but that is not the solution.
Thank you for the report. A possible fix is the below patch.
I'm still checking whether the place I put KERNEL_LOCK is appropriate
or not, anyway it should fix the assertion failure.
Regards,
ozaki-r
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index a92c61b..4d31253 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1713,5 +1713,7 @@ ip_mloopback(struct ifnet *ifp, struct mbuf *m,
const struct sockaddr_in *dst)
ip->ip_sum = 0;
ip->ip_sum = in_cksum(copym, ip->ip_hl << 2);
+ KERNEL_LOCK(1, NULL);
(void)looutput(ifp, copym, sintocsa(dst), NULL);
+ KERNEL_UNLOCK_ONE(NULL);
}
From: Frank Kardel <kardel@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: kern/49410: -current: panic: "KERNEL_LOCKED_P()" failed: file
".../if_loop.c", line 221
Date: Sun, 23 Nov 2014 12:59:32 +0100
Thanks - it fixes that issue AFAICS.
On 11/23/14 12:15, Ryota Ozaki wrote:
>
> diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
> index a92c61b..4d31253 100644
> --- a/sys/netinet/ip_output.c
> +++ b/sys/netinet/ip_output.c
> @@ -1713,5 +1713,7 @@ ip_mloopback(struct ifnet *ifp, struct mbuf *m,
> const struct sockaddr_in *dst)
>
> ip->ip_sum = 0;
> ip->ip_sum = in_cksum(copym, ip->ip_hl << 2);
> + KERNEL_LOCK(1, NULL);
> (void)looutput(ifp, copym, sintocsa(dst), NULL);
> + KERNEL_UNLOCK_ONE(NULL);
> }
>
From: "Ryota Ozaki" <ozaki-r@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/49410 CVS commit: src/sys/netinet
Date: Wed, 26 Nov 2014 10:18:38 +0000
Module Name: src
Committed By: ozaki-r
Date: Wed Nov 26 10:18:38 UTC 2014
Modified Files:
src/sys/netinet: ip_output.c
Log Message:
Call looutput with holding KERNEL_LOCK
This fixes diagnostic assertion "KERNEL_LOCKED_P()" in if_loop.c.
PR kern/49410
To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/sys/netinet/ip_output.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: ozaki-r@NetBSD.org
State-Changed-When: Wed, 26 Nov 2014 10:21:11 +0000
State-Changed-Why:
The report confirmed the fix.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/49410 CVS commit: [netbsd-7] src/sys/netinet
Date: Mon, 1 Dec 2014 10:35:37 +0000
Module Name: src
Committed By: martin
Date: Mon Dec 1 10:35:37 UTC 2014
Modified Files:
src/sys/netinet [netbsd-7]: ip_output.c
Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #277):
sys/netinet/ip_output.c: revision 1.233
Call looutput with holding KERNEL_LOCK
This fixes diagnostic assertion "KERNEL_LOCKED_P()" in if_loop.c.
PR kern/49410
To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.230.2.1 src/sys/netinet/ip_output.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
-current of 20141122
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.