From owner-freebsd-net@FreeBSD.ORG Tue Sep 8 15:11:30 2009 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06EC0106566B for ; Tue, 8 Sep 2009 15:11:30 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id C987D8FC0C for ; Tue, 8 Sep 2009 15:11:29 +0000 (UTC) Received: from compute1.internal (compute1.internal [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id 20F8069019; Tue, 8 Sep 2009 11:11:28 -0400 (EDT) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Tue, 08 Sep 2009 11:11:29 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:date:from:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; s=smtpout; bh=2f4QJCq9r1NgKRuXGwFrEIbFqSQ=; b=Mr3MaB5o9yuIw6oqgjbvcopzPiaog3y1KTZnIL1tDjrfIizsyKi6C6atQYBvbEjO/F3iDFv78Yhxh6TOWHgNsaE6wlkYOtvUl8Ou4tphwkAOL5ZOCxsmjLiMPppfPc2Ui84ZUVovOFdlyIP9YUsZoqL+7ZAhfoG5RHpZjOxd4Ic= X-Sasl-enc: 3tYi5CCTlf9YMs/vmXQmndCcYQaQcmi3Pu4n7GuMsuaF 1252422688 Received: from [192.168.123.18] (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id 2F146682E6; Tue, 8 Sep 2009 11:11:28 -0400 (EDT) Message-ID: <4AA6741B.9020403@incunabulum.net> Date: Tue, 08 Sep 2009 16:11:23 +0100 From: Bruce Simpson User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Shteryana Shopova References: <4AA65663.8050106@incunabulum.net> <4AA65861.8@incunabulum.net> <61b573980909080654x50670168x39001267ad81c6a3@mail.gmail.com> In-Reply-To: <61b573980909080654x50670168x39001267ad81c6a3@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: "freebsd-net@FreeBSD.org" , stef@memberwebs.com Subject: Re: Panic in imo_match_source (netinet/in_mcast.c) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2009 15:11:30 -0000 Shteryana Shopova wrote: > Hi, > > I actually managed to get the same kernel dump using the following > sample code - http://people.freebsd.org/~syrinx/mcast/mcast_crash.c > and the crash is 100% reproducable. A temporary fix is here - > http://people.freebsd.org/~syrinx/mcast/in_mcast.c-20090908-01.diff > but I actually prefer that we go over the logic in inp_join_group() > again before proposing a patch for head as this is the second assert > panic I am seeing it causes in the last few days. I can try making up > a proper fix if Bruce is busy, but it will take a day or two until I'm > able to fully test it. > Good catch. Yes, IP_ADD_MEMBERSHIP on an existing exclusive mode group with filters is an error. The comment calls it out, but you are right, a normal case could hit the KASSERT. The code in the start of inp_join_group() handles all join requests, by mapping 3 possible sets of inbound ioctls onto 1, to make the ioctl processing code smaller. So I could rephrase the fix to: explicitly check for ssa->ss.ss_family being AF_UNSPEC before trying to perform a search with ssa as the key, as this will be set by the code above. Or commit your fix, which is a bit more explicit. The assertion in imo_match_source() existed to catch v4/v6 operations being mixed in similar code paths. Originally I'd planned to keep v4 and v6 code together, but as time went on, it became clear that just branching the code for v6 was the right way to keep the code managable. v6 and v4 have a bunch of special conditions for address handling which just plain need to stay separate...