NetBSD Problem Report #56292

From www@netbsd.org  Fri Jul  2 03:06:53 2021
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id B83321A921F
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  2 Jul 2021 03:06:53 +0000 (UTC)
Message-Id: <20210702030648.F015D1A923B@mollari.NetBSD.org>
Date: Fri,  2 Jul 2021 03:06:48 +0000 (UTC)
From: s-yamaguchi@iij.ad.jp
Reply-To: s-yamaguchi@iij.ad.jp
To: gnats-bugs@NetBSD.org
Subject: panic on adding a vlan interface to bridge member
X-Send-Pr-Version: www-1.0

>Number:         56292
>Category:       kern
>Synopsis:       panic on adding a vlan interface to bridge member
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 02 03:10:00 +0000 2021
>Closed-Date:    Tue Jul 13 02:53:10 +0000 2021
>Last-Modified:  Tue Jul 13 02:53:10 +0000 2021
>Originator:     Shoichi Yamaguchi
>Release:        -current (2021-06-28 20:40 UTC)
>Organization:
Internet Initiative Japan Inc.
>Environment:
NetBSD hidden 9.99.85 NetBSD 9.99.85 (GENERIC) #0: Mon Jun 28 17:52:13 UTC 2021  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64

>Description:
[ 194.5663314] prevented execution of 0x0 (SMEP)
[ 194.5663314] fatal page fault in supervisor mode
[ 194.5663314] trap type 6 code 0x10 rip 0 cs 0x8 rflags 0x10202 cr2 0 ilevel 0x4 rsp 0xffff8c007887db78
[ 194.5663314] curlwp 0xffffac60a3df0b40 pid 483.483 lowest kstack 0xffff8c00788792c0
[ 194.5663314] panic: trap
[ 194.5663314] cpu0: Begin traceback...
[ 194.5663314] vpanic() at netbsd:vpanic+0x156
[ 194.5663314] device_printf() at netbsd:device_printf
[ 194.5663314] startlwp() at netbsd:startlwp
[ 194.5663314] alltraps() at netbsd:alltraps+0xc3
[ 194.5764958] bridge_ioctl() at netbsd:bridge_ioctl+0x333
[ 194.5764958] doifioctl() at netbsd:doifioctl+0x30e
[ 194.5764958] sys_ioctl() at netbsd:sys_ioctl+0x56d
[ 194.5764958] syscall() at netbsd:syscall+0x196
[ 194.5764958] --- syscall (number 54) ---
[ 194.5764958] netbsd:syscall+0x196:
[ 194.5764958] cpu0: End traceback...
[ 194.5764958] rebooting...

bridge(4) has been changing mtu of the adding interface by calling
ether_ioctl(). The function calls ifp->if_init(), but vlan(4) has 
not use the function pointer. 
>How-To-Repeat:
# ifconfig vlan0 create
# ifconfig vlan0 vlan 1 vlanif iavf0
# ifconfig vlan0 up
# ifconfig bridge0 create
# ifconfig bridge0 mtu 1495
# brconfig bridge0 add vlan0
>Fix:
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 8d639221dae..2fa245e478d 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -861,7 +861,7 @@ bridge_ioctl_add(struct bridge_softc *sc, void *arg)
                        memset(&ifr, 0, sizeof(ifr));
                        ifr.ifr_mtu = sc->sc_if.if_mtu;
                        IFNET_LOCK(ifs);
-                       error = ether_ioctl(ifs, SIOCSIFMTU, &ifr);
+                       error = ifs->if_ioctl(ifs, SIOCSIFMTU, &ifr);
                        IFNET_UNLOCK(ifs);
                        if (error != 0)
                                goto out;

>Release-Note:

>Audit-Trail:
From: "Shoichi YAMAGUCHI" <yamaguchi@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56292 CVS commit: src/sys/net
Date: Fri, 2 Jul 2021 03:30:46 +0000

 Module Name:	src
 Committed By:	yamaguchi
 Date:		Fri Jul  2 03:30:46 UTC 2021

 Modified Files:
 	src/sys/net: if_bridge.c

 Log Message:
 Use if_ioctl() for changing MTU, not ether_ioctl to prevent panic

 Fix PR kern/56292


 To generate a diff of this commit:
 cvs rdiff -u -r1.180 -r1.181 src/sys/net/if_bridge.c

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

From: "Shoichi YAMAGUCHI" <yamaguchi@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56292 CVS commit: src/tests/net/if_vlan
Date: Fri, 2 Jul 2021 04:38:11 +0000

 Module Name:	src
 Committed By:	yamaguchi
 Date:		Fri Jul  2 04:38:11 UTC 2021

 Modified Files:
 	src/tests/net/if_vlan: t_vlan.sh

 Log Message:
 Added tests for changing a MTU when the vlan(4) is added to bridge(4)

 The tests is for PR kern/56292


 To generate a diff of this commit:
 cvs rdiff -u -r1.17 -r1.18 src/tests/net/if_vlan/t_vlan.sh

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

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 10 Jul 2021 04:35:12 +0000
State-Changed-Why:
Is this fixed?


State-Changed-From-To: feedback->closed
State-Changed-By: yamaguchi@NetBSD.org
State-Changed-When: Tue, 13 Jul 2021 02:53:10 +0000
State-Changed-Why:
fixed


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.