Module Name:    src
Committed By:   martin
Date:           Sat Sep 21 12:17:27 UTC 2024

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

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

        sys/net/if_tun.c: revision 1.177

tun(4): Mark tunread_filtops `FILTEROP_MPSAFE`

Filter handlers have already been MP-safe since 2018:
https://mail-index.netbsd.org/source-changes/2018/08/06/msg097317.html

Note that we do not expect deadlocks similar to bpf(4) (PR kern/58531),
b/w KERNEL_LOCK and spin mutex for TX queue.

For tun(4), filt_tunread() acquires adaptive mutex. This is forbidden
when spin mutex is already held.

Such a path must have already been detected if present.

Thanks ozaki-r@ for discussion.


To generate a diff of this commit:
cvs rdiff -u -r1.173.4.2 -r1.173.4.3 src/sys/net/if_tun.c

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

Modified files:

Index: src/sys/net/if_tun.c
diff -u src/sys/net/if_tun.c:1.173.4.2 src/sys/net/if_tun.c:1.173.4.3
--- src/sys/net/if_tun.c:1.173.4.2	Mon Mar 11 19:28:45 2024
+++ src/sys/net/if_tun.c	Sat Sep 21 12:17:27 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tun.c,v 1.173.4.2 2024/03/11 19:28:45 martin Exp $	*/
+/*	$NetBSD: if_tun.c,v 1.173.4.3 2024/09/21 12:17:27 martin Exp $	*/
 
 /*
  * Copyright (c) 1988, Julian Onions <j...@cs.nott.ac.uk>
@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.173.4.2 2024/03/11 19:28:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.173.4.3 2024/09/21 12:17:27 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1098,7 +1098,7 @@ filt_tunread(struct knote *kn, long hint
 }
 
 static const struct filterops tunread_filtops = {
-	.f_flags = FILTEROP_ISFD,
+	.f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE,
 	.f_attach = NULL,
 	.f_detach = filt_tunrdetach,
 	.f_event = filt_tunread,

Reply via email to