From owner-freebsd-pf@freebsd.org Sun Mar 5 13:19:10 2017 Return-Path: Delivered-To: freebsd-pf@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B360ACF90C9 for ; Sun, 5 Mar 2017 13:19:10 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 80CEF1689 for ; Sun, 5 Mar 2017 13:19:10 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [172.16.1.189] (s224.GtokyoFL6.vectant.ne.jp [222.228.90.224]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 3F9AD1EF85; Sun, 5 Mar 2017 14:19:06 +0100 (CET) From: "Kristof Provost" To: Ross Cc: freebsd-pf@freebsd.org Subject: Re: sonewconn: pru_attach() failed and kernel panic in PF Date: Sun, 05 Mar 2017 22:19:01 +0900 Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; markup=markdown Content-Transfer-Encoding: 8bit X-Mailer: MailMate (2.0BETAr6080) X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Technical discussion and general questions about packet filter \(pf\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Mar 2017 13:19:10 -0000 On 5 Mar 2017, at 21:42, Kristof Provost wrote: > There’s only a couple of calls to uma_zfree() in > pf_get_translations(). > > These are: > * uma_zfree(V_pf_state_key_z, skp); > * uma_zfree(V_pf_state_key_z, *nkp); > * uma_zfree(V_pf_state_key_z, *skp); > > Going by the inconsistent pointer use the first one is rather suspect. > Looking a bit deeper, pf_get_translation() is only called from one > place, > and it always passes stack variables for skp and nkp, so the first > call > ends up trying to free that, which won’t work too well. > > That’s a bug (and I’ll fix it), but you’re only running into it > because > pf_state_key_clone() returned NULL, which will only happen under > memory > pressure. > The fix is done in r314702. Regards, Kristof