From owner-freebsd-pf@FreeBSD.ORG Wed Mar 11 09:51:32 2015 Return-Path: Delivered-To: freebsd-pf@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EA946E72; Wed, 11 Mar 2015 09:51:32 +0000 (UTC) Received: from forward9l.mail.yandex.net (forward9l.mail.yandex.net [IPv6:2a02:6b8:0:1819::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Certum Level IV CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E5B8EF9; Wed, 11 Mar 2015 09:51:32 +0000 (UTC) Received: from smtp4m.mail.yandex.net (smtp4m.mail.yandex.net [77.88.61.131]) by forward9l.mail.yandex.net (Yandex) with ESMTP id 12BC7E6106D; Wed, 11 Mar 2015 12:51:27 +0300 (MSK) Received: from smtp4m.mail.yandex.net (localhost [127.0.0.1]) by smtp4m.mail.yandex.net (Yandex) with ESMTP id 8C78FBE024D; Wed, 11 Mar 2015 12:51:27 +0300 (MSK) Received: from unknown (unknown [2a02:6b8:0:6::bb]) by smtp4m.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id y0Wxc8ucME-pRrGMLlh; Wed, 11 Mar 2015 12:51:27 +0300 (using TLSv1.2 with cipher AES128-SHA (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1426067487; bh=kNzI0PidRFEBJWZWrqYnjpYeztxd/V63k4tk9HLYR08=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type; b=rx8lzbGjHVKb0ryGf9NLd7w6EIBzIZkmt8wHDMQGF/H44rEKU14yQcUVVeyKeo7e5 H1ApzNvW8A4JCqmeBi22muCs/NekA1wLQRlzAUsNGwLEOdOAJOHBhlbSVYloqMtPcq 7lfbDVNK+UVI/sntUWop44FPdu2DPKPWA18kBM4M= Authentication-Results: smtp4m.mail.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: <55000FDF.10007@yandex.ru> Date: Wed, 11 Mar 2015 12:50:23 +0300 From: "Andrey V. Elsukov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Kristof Provost , freebsd-net@FreeBSD.org Subject: Re: [PATCH] Fix panic with pf fastroute References: <1426064691-1238-1-git-send-email-kristof@sigsegv.be> <20150311083916.GQ1975@vega.codepro.be> In-Reply-To: <20150311083916.GQ1975@vega.codepro.be> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="b1wKiEvkW8XJSfeC9L6BIOf9LHC7irkac" Cc: freebsd-pf@FreeBSD.org X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.18-1 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: Wed, 11 Mar 2015 09:51:33 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --b1wKiEvkW8XJSfeC9L6BIOf9LHC7irkac Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 11.03.2015 11:39, Kristof Provost wrote: > The pf code in pf_route6() neglected to set the mbuf pointer to NULL > after the call to ip6_output(). As a result we end up trying to continu= e > processing on an mbuf which has already been freed. > --- > sys/netpfil/pf/pf.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c > index b32288b..7c3ddb8 100644 > --- a/sys/netpfil/pf/pf.c > +++ b/sys/netpfil/pf/pf.c > @@ -5470,6 +5470,7 @@ pf_route6(struct mbuf **m, struct pf_rule *r, int= dir, struct ifnet *oifp, > PF_STATE_UNLOCK(s); > m0->m_flags |=3D M_SKIP_FIREWALL; > ip6_output(m0, NULL, NULL, 0, NULL, NULL, NULL); > + *m =3D NULL; > return; > } It looks like there are some code paths that do a copy of original mbuf. Are you sure this doesn't introduce mbuf leak? --=20 WBR, Andrey V. Elsukov --b1wKiEvkW8XJSfeC9L6BIOf9LHC7irkac Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVAA/fAAoJEAHF6gQQyKF6k+wH/3IVNGOcDTE1yMQBB7IB+Dac i0uxybhQLncftcifJQaya6ytzXny96x+B727Rmlo8Jnscsmn3IwYYpnA+9dduWPX xE3/cSM0h5Qg0JB/h4XHvcZdAsqqZYfDOCF48uul68ZwuyKS8rYWs7C/WsydeRlk WKETd1+7M0A+g9HtDGLRUiFTD2XcZkP9cWhlw92za3HuQkz+Y+5N0H5i+I+YyTf7 hw3SISURf6bRc6owvVyUHiECebnBuJk2FKvioVFs8uXo5IJjZ33AZJw/U76GhJB4 an6qzGkgO4Qt/IjTUjtdBgmhs44oQ4tnAOsdr5OeF7TkjSPPbgfeEJiEH2E5jYs= =qZb3 -----END PGP SIGNATURE----- --b1wKiEvkW8XJSfeC9L6BIOf9LHC7irkac--