Module Name: src Committed By: riastradh Date: Sun Mar 13 21:32:27 UTC 2022
Modified Files: src/sys/net: if_tun.c Log Message: tun(4): Reduce lock from IPL_NET to IPL_SOFTNET. This is never taken from hardware interrupt handlers any more, as far as I can tell -- only SOFTINT_NET soft interrupt handlers. This avoids trying to take an adaptive lock, proc_lock, in fownsignal while holding a spin lock. Unfortunately, it doesn't entirely fix the problem -- proc_lock is at IPL_NONE, and is held across some not entirely trivial computations like allocating a new pid table. So it would really be better if we had some way to deliver SIGIO without taking proc_lock. Reported-by: syzbot+3dd54993d3e92e697...@syzkaller.appspotmail.com Reported-by: syzbot+aca29415f2f0bf23f...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.167 -r1.168 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.167 src/sys/net/if_tun.c:1.168 --- src/sys/net/if_tun.c:1.167 Sun Mar 13 21:32:15 2022 +++ src/sys/net/if_tun.c Sun Mar 13 21:32:27 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_tun.c,v 1.167 2022/03/13 21:32:15 riastradh Exp $ */ +/* $NetBSD: if_tun.c,v 1.168 2022/03/13 21:32:27 riastradh 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.167 2022/03/13 21:32:15 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.168 2022/03/13 21:32:27 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -216,7 +216,7 @@ tun_init(struct tun_softc *tp, int unit) { tp->tun_unit = unit; - mutex_init(&tp->tun_lock, MUTEX_DEFAULT, IPL_NET); + mutex_init(&tp->tun_lock, MUTEX_DEFAULT, IPL_SOFTNET); cv_init(&tp->tun_cv, "tunread"); selinit(&tp->tun_rsel); selinit(&tp->tun_wsel);