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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 17 18:30:01 +0000 2024
>Last-Modified:  Wed Apr 17 18:55:02 +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!

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

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.