On Mon, 12 Feb 2018, Ryota Ozaki wrote:
2. Whenever I try to shutdown the system, I get a networking-related panic. The following is manually transcribed:trap type 4 code 0 rip 0xffffffff802d3f75 cs 0x8 rflags 0x10282 cr2 0x77e0e931c020 ilevel 0x4 rsp 0xffff80090a7e3c80 curlwp 0xffffe4afbb6e8700 pid 926.1 lowest kstack 0xffff80090a7e0c20 kernel: protection fault trap, code = 0 stopped in 926.1 (avahi-daemon) at ip_setmoptions+0x237: movq 360(%rax),%rdi traceback: ip_setmoptions + 0x237 ip_rtloutput + 0x218 udp_ctloutput + 0x82 udp_ctloutput_wrapper + 0x2c sosetopt + 0x67 sys_setsockopt + 0x91 syscall + 0x1ed (syscall #105)Is the panic fixed by the following patch? diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 44d8032f387..2e5e346af91 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1927,9 +1927,13 @@ ip_drop_membership(struct ip_moptions *imo, const struct sockopt *sopt) * Give up the multicast address record to which the * membership points. */ - IFNET_LOCK(imo->imo_membership[i]->inm_ifp); + { + struct ifnet *inm_ifp = imo->imo_membership[i]->inm_ifp; + IFNET_LOCK(inm_ifp); in_delmulti(imo->imo_membership[i]); - IFNET_UNLOCK(imo->imo_membership[i]->inm_ifp); + /* ifp should not leave thanks to solock */ + IFNET_UNLOCK(inm_ifp); + } /* * Remove the gap in the membership array.
Yes it appears to address the problem. Without this patch, the above crash was 100% reproducible (5 out of 5). With this patch applied (and no other changes) I have had 3 consecutive reboots without and problem!
Thanks for the quick turn-around. +------------------+--------------------------+----------------------------+ | Paul Goyette | PGP Key fingerprint: | E-mail addresses: | | (Retired) | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com | | Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org | +------------------+--------------------------+----------------------------+
