NetBSD Problem Report #58166

From www@netbsd.org  Wed Apr 17 18:25:04 2024
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 C1F3E1A9238
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 17 Apr 2024 18:25:03 +0000 (UTC)
Message-Id: <20240417182502.F3CD01A923A@mollari.NetBSD.org>
Date: Wed, 17 Apr 2024 18:25:02 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: dead branches in tap(4) close/detach
X-Send-Pr-Version: www-1.0

>Number:         58166
>Category:       kern
>Synopsis:       dead branches in tap(4) close/detach
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 17 18:30:01 +0000 2024
>Closed-Date:    Sun Oct 13 21:26:31 +0000 2024
>Last-Modified:  Sun Oct 13 21:26:31 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, ...
>Organization:
The TapBSD Foundation
>Environment:
>Description:
1. tap_dev_close never fails, should return void => caller branches are dead and should be pruned
2. tap_detach never fails so config_detach(dev, ...) never fails so tap_dev_destroyer can't fail => config_detach should be kasserted, caller branches are dead and should be pruned
3. access to sc->sc_dev is racy with config_detach => should maybe use device_acquire, under some appropriate lock, and config_detach_release; might need a list of tap files for each device to invalidate their sc_dev pointers
>How-To-Repeat:
code inspection
>Fix:
Yes, please!

>Release-Note:

>Audit-Trail:
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58166 CVS commit: src/sys/net
Date: Wed, 17 Apr 2024 18:32:13 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Wed Apr 17 18:32:13 UTC 2024

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

 Log Message:
 tap(4): Prune dead branches around tap_dev_close.

 No functional change intended.

 PR kern/58166


 To generate a diff of this commit:
 cvs rdiff -u -r1.128 -r1.129 src/sys/net/if_tap.c

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

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58166 CVS commit: src/sys/net
Date: Wed, 17 Apr 2024 18:52:25 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Wed Apr 17 18:52:25 UTC 2024

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

 Log Message:
 tap(4): Prune dead branches around tap_dev_destroyer.

 No functional change intended.

 PR kern/58166


 To generate a diff of this commit:
 cvs rdiff -u -r1.129 -r1.130 src/sys/net/if_tap.c

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

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58166 CVS commit: src/sys/net
Date: Wed, 17 Apr 2024 18:52:39 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Wed Apr 17 18:52:39 UTC 2024

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

 Log Message:
 tap(4): Use DETACH_FORCE with config_detach.

 It doesn't make a difference here, because tap_detach never fails,
 but let's make it more obvious at the call site that failure is
 forbidden here.

 No functional change intended.

 PR kern/58166


 To generate a diff of this commit:
 cvs rdiff -u -r1.130 -r1.131 src/sys/net/if_tap.c

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

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58166 CVS commit: [netbsd-10] src/sys/net
Date: Wed, 11 Sep 2024 16:12:50 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Wed Sep 11 16:12:50 UTC 2024

 Modified Files:
 	src/sys/net [netbsd-10]: if_tap.c

 Log Message:
 Pull up following revision(s) (requested by rin in ticket #825):

 	sys/net/if_tap.c: revision 1.129
 	sys/net/if_tap.c: revision 1.130
 	sys/net/if_tap.c: revision 1.131
 	sys/net/if_tap.c: revision 1.132

 tap(4): Prune dead branches around tap_dev_close.
 No functional change intended.
 PR kern/58166

 tap(4): Prune dead branches around tap_dev_destroyer.
 No functional change intended.
 PR kern/58166

 tap(4): Use DETACH_FORCE with config_detach.
 It doesn't make a difference here, because tap_detach never fails,
 but let's make it more obvious at the call site that failure is
 forbidden here.

 No functional change intended.
 PR kern/58166

 tap(4): Just use mutex_enter.
 PR kern/58167


 To generate a diff of this commit:
 cvs rdiff -u -r1.127.4.1 -r1.127.4.2 src/sys/net/if_tap.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: riastradh@NetBSD.org
State-Changed-When: Sun, 13 Oct 2024 21:26:31 +0000
State-Changed-Why:
fixed in HEAD, pulled up to 10, not gonna work on this for 9


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.