From owner-freebsd-stable@FreeBSD.ORG Wed Apr 17 20:17:41 2013 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 44778654 for ; Wed, 17 Apr 2013 20:17:41 +0000 (UTC) (envelope-from jdc@koitsu.org) Received: from qmta11.emeryville.ca.mail.comcast.net (qmta11.emeryville.ca.mail.comcast.net [IPv6:2001:558:fe2d:44:76:96:27:211]) by mx1.freebsd.org (Postfix) with ESMTP id 25D7B331 for ; Wed, 17 Apr 2013 20:17:41 +0000 (UTC) Received: from omta05.emeryville.ca.mail.comcast.net ([76.96.30.43]) by qmta11.emeryville.ca.mail.comcast.net with comcast id R5S01l0050vp7WLAB8HhPe; Wed, 17 Apr 2013 20:17:41 +0000 Received: from koitsu.strangled.net ([67.180.84.87]) by omta05.emeryville.ca.mail.comcast.net with comcast id R8Hg1l0071t3BNj8R8Hg1n; Wed, 17 Apr 2013 20:17:40 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id 0B8A373A33; Wed, 17 Apr 2013 13:17:40 -0700 (PDT) Date: Wed, 17 Apr 2013 13:17:40 -0700 From: Jeremy Chadwick To: Chris Forgeron Subject: Re: kern/165903: mbuf leak Message-ID: <20130417201739.GA11022@icarus.home.lan> References: <46D80686C389884BB0C047851038EC456D8BCEBC@AA-EX0.acsi.ca> <20130410235347.GA38492@icarus.home.lan> <20130411000818.GA38803@icarus.home.lan> <46D80686C389884BB0C047851038EC456D8C0EF0@AA-EX0.acsi.ca> <20130413235031.GA8212@icarus.home.lan> <46D80686C389884BB0C047851038EC456D8C0F52@AA-EX0.acsi.ca> <20130415104238.GP76816@FreeBSD.org> <46D80686C389884BB0C047851038EC456D8C3001@AA-EX0.acsi.ca> <20130416164658.GA81268@icarus.home.lan> <46D80686C389884BB0C047851038EC456D8C3FC5@AA-EX0.acsi.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <46D80686C389884BB0C047851038EC456D8C3FC5@AA-EX0.acsi.ca> User-Agent: Mutt/1.5.21 (2010-09-15) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1366229861; bh=RzgrazTzNiOhfyoKFWg969Wvn43vgUxNDq35wthH8IU=; h=Received:Received:Received:Date:From:To:Subject:Message-ID: MIME-Version:Content-Type; b=mYVKEYhtkCvBGbhfrmYGD0F+bKSJsEudNFYtcOgGDqRswYHcBH69zLdiUj++57JVF pG6X3+AG0+JWUlFzT7X6iei5sUauy6ZS9qdLI3l3Tkeea/oWrlzEyUCjk/lq6vWWUF thW/7TgLSPiu2zCSgdrxT7UWe+8S0D2V9zKTLg1SJkXQ2GqAB4/BxDPA4J9HY9dg82 COX2A4v1wdjupFscr2MoOcyUYEBNB+h1b8eGnA+VQwh0cgnMzJZAYNnUry+dYVbfoP FYjJjjphju5P+zFnef2Xqo0t5rl8cQ8ew5KWvuP4fFOy6I4bOwj14exHE2NHr7sWMT 6l1L7GtiWyyrQ== Cc: Gleb Smirnoff , "freebsd-stable@freebsd.org" , Jack Vogel , John Baldwin X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Apr 2013 20:17:41 -0000 On Wed, Apr 17, 2013 at 05:38:12PM +0000, Chris Forgeron wrote: > Hello, > > I'm happy to report that the patch from Gleb has fixed the problem. > > My system had 256 mbuf clusters in use at boot, and after a day, still only has 256 mbuf clusters in use. > > From the patch, I see we are now dropping these packets (?) - Was the issue that the packets were being queued up for further work, but nothing was being done with them? Not exactly. Please open up the source file and follow along. At line 538, a call to mtod() is performed, which is what allocates the memory for the mbuf used for the ARP header. Now go to lines 543 and 549. These are error checks for certain kinds of ARP headers which are either malformed (line 543) or should not be honoured (line 549). When these error checks proved true, the code simply did "return" to get out of the function it was in (in_arpinput()), but never issued m_freem() to free the previously-allocated mbuf, hence leaking mbufs. The patch changes the "return" into "goto drop". The drop label is at line 873, which is where you'll find the m_freem(), followed immediately by the function returning. -- | Jeremy Chadwick jdc@koitsu.org | | UNIX Systems Administrator http://jdc.koitsu.org/ | | Mountain View, CA, US | | Making life hard for others since 1977. PGP 4BD6C0CB |