NetBSD Problem Report #50522

From www@NetBSD.org  Fri Dec 11 07:48:40 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.NetBSD.org [199.233.217.200])
	(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 AF374A667A
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 11 Dec 2015 07:48:40 +0000 (UTC)
Message-Id: <20151211074839.B0911A667C@mollari.NetBSD.org>
Date: Fri, 11 Dec 2015 07:48:39 +0000 (UTC)
From: k-nakahara@iij.ad.jp
Reply-To: k-nakahara@iij.ad.jp
To: gnats-bugs@NetBSD.org
Subject: gif(4) ioctl causes panic while someone is using the gif(4) interface.
X-Send-Pr-Version: www-1.0

>Number:         50522
>Category:       kern
>Synopsis:       gif(4) ioctl causes panic while someone is using the gif(4) interface.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 11 07:50:00 +0000 2015
>Closed-Date:    Fri Dec 11 08:47:25 +0000 2015
>Last-Modified:  Mon Jan 04 07:55:01 +0000 2016
>Originator:     Kengo NAKAHARA
>Release:        7.99.24
>Organization:
>Environment:
NetBSD 7.99.24 (GENERIC)
>Description:
While someone transmits and receive over gif0, "ifconfig gif0 tunnel other_src
other_dst" and "ifconfig gif0 deletetunnel" would cause panic.

Here is the backtrace.
====================
fatal page fault in supervisor mode
trap type 6 code 0 rip ffffffff808d4494 cs 8 rflags 10202 cr2 4 ilevel 4 rsp fffffe810e8d8da8
curlwp 0xfffffe827f72a420 pid 0.3 lowest kstack 0xfffffe810e8d52c0
kernel: page fault trap, code=0
Stopped in pid 0.3 (system) at  netbsd:in_gif_input+0xb4:       cmpl    %esi,4(%
rax)
in_gif_input() at netbsd:in_gif_input+0xb4
encap4_input() at netbsd:encap4_input+0x187
ipintr() at netbsd:ipintr+0x8d0
softint_dispatch() at netbsd:softint_dispatch+0xd3
====================
>How-To-Repeat:
(1) setup gif the tested NetBSD machine and the peer machine

(2) do "ping -f" over gif(4) from the peer machine

(3) repeat "ifconfig tunnel" and "ifconfig deletetunnel" on the tested NetBSD
    machine, such as the following code
====================
#!/bin/sh

cat > test_gif_load.sh <<-EOF
ifconfig gif0 tunnel 192.168.0.250 192.168.0.18 &
ifconfig gif0 tunnel 192.168.0.250 192.168.0.18 &
ifconfig gif0 deletetunnel & 
ifconfig gif0 tunnel 192.168.0.250 192.168.0.18 &
ifconfig gif0 tunnel 192.168.0.250 192.168.0.18 &
ifconfig gif0 deletetunnel & 
EOF

while true; do echo hogs >/dev/null; done &
while true; do sh test_gif_load.sh ; done
====================

(4) wait a minute, it causes panic


# I think a single CPU machine does not panic by this, maybe.
>Fix:
I fix this bug soon.

>Release-Note:

>Audit-Trail:
From: "Kengo NAKAHARA" <knakahara@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50522 CVS commit: src/sys
Date: Fri, 11 Dec 2015 07:59:14 +0000

 Module Name:	src
 Committed By:	knakahara
 Date:		Fri Dec 11 07:59:14 UTC 2015

 Modified Files:
 	src/sys/net: if_gif.c if_gif.h
 	src/sys/netinet: in_gif.c
 	src/sys/netinet6: in6_gif.c

 Log Message:
 PR kern/50522: gif(4) ioctl causes panic while someone is using the gif(4) interface.

 It is required to wait other CPU's softint completion before disestablishing
 the softint handler.


 To generate a diff of this commit:
 cvs rdiff -u -r1.101 -r1.102 src/sys/net/if_gif.c
 cvs rdiff -u -r1.19 -r1.20 src/sys/net/if_gif.h
 cvs rdiff -u -r1.65 -r1.66 src/sys/netinet/in_gif.c
 cvs rdiff -u -r1.62 -r1.63 src/sys/netinet6/in6_gif.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: knakahara@NetBSD.org
State-Changed-When: Fri, 11 Dec 2015 08:47:25 +0000
State-Changed-Why:
>Stated::

From: "Kengo NAKAHARA" <knakahara@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/50522 CVS commit: src/sys/net
Date: Mon, 4 Jan 2016 07:50:08 +0000

 Module Name:	src
 Committed By:	knakahara
 Date:		Mon Jan  4 07:50:08 UTC 2016

 Modified Files:
 	src/sys/net: if_gif.c if_gif.h

 Log Message:
 Revert extra wating codes.

 PR kern/50522 is actually fixed by sys/kern/kern_softint.c:r1.42, so waiting
 codes in if_gif.c is not required.


 To generate a diff of this commit:
 cvs rdiff -u -r1.102 -r1.103 src/sys/net/if_gif.c
 cvs rdiff -u -r1.20 -r1.21 src/sys/net/if_gif.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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.