From nobody Mon Mar 25 04:44:50 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4V30hy4RJtz5FHtX; Mon, 25 Mar 2024 04:44:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4V30hy33k7z4KB5; Mon, 25 Mar 2024 04:44:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711341890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BtoszNQxdbfBe/cPBxo/tg2+doBZr9/F5rmsV6NdTfQ=; b=R9VNjv/pXgx6+1nyY+cKlvtTfXMsa1+5S0dReR+fDFSppIsaUAZbhPeuDDfZe2y0YZVJH4 QhH+n6LSzwlv7x5gNkyl+Q6mpVlo1vdBT1qvsCXni2knrPZsLAJKWW4PZOVXxcWJbDcIcQ wVPADzECJjQsTcNEWx81D9KHZc0z3UYFEddrsRrf/jOTPWFIHfR3DNTZbPV35MTLatx3N5 Udqf5gpzLkedhpWq4igTGLHPUKik9Z6Z/4/CjGe3wOgW7CZfpKPhQMdE8yBJTRdCXlusyh KId2+WsTbQaN8JzJJyXFclOAdWX/a3eeGHj5dJ/lvceZZXSGprrlzC/ey6cRjw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711341890; a=rsa-sha256; cv=none; b=e7n4M+nYuEuarRLARNa/e9ZPxlZzFzXSiYta34A0XEoVBiV8NozrU35Fax2346KYqpYmA0 rGqczdze86Q8Fmh/j6GcaTvl/13UZ7O7FhwLPxZOvlVmYFHDkDjzNSnUsZyMX2SmhsieIZ spIx8cyfxQ6HO6hOpPWUHgkQlBd6XIhGszFT2cSaTiLDfietVLEbhX6fKvUmLlx9Oia8W6 mBumXfIt9W6S6/VwaQyFGo0qgrfFtEw0Ou78mP1vauAMWuaUjjcXd2VyjdZjExzkph5hvS voJPBhlp0DLL+dWd080lv84dxEnIyZwTy/SmNtiJux5ueN47sNUTCdKz/FSXAQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711341890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BtoszNQxdbfBe/cPBxo/tg2+doBZr9/F5rmsV6NdTfQ=; b=nZdoPu+Ik+NAnY5fcuN440JdemnLf1Ote7nXXHNmxpL7H1yYnMW2U/nsQi3E3yhQ9In2DR HMhAgMQ4kCnBIOl1P08QB/lgxgTSs/SLgXKGALw9UvFNpWK8SBSLY/66qOv86aUVrpazqF 8PqKCke53BZXqwg6mLPmJt2p/6vWTG0kLrTeu8faJRN8F2XOzQ62ZWOvptNCLDBTUYVzg6 rif9kY5LD1hBPoKXpcQy7NKtMxBK5zjszn+dKkI37jkMlNmwoQfSM2tXjmTmgjYsMGXqZw qkl7RGsNERk620mwW9SP0MJE+t+DFyqX6lJSnuUVagCVuVLnmD6+WZLDEaKQiw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4V30hy2YD6z12X4; Mon, 25 Mar 2024 04:44:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 42P4iocC049743; Mon, 25 Mar 2024 04:44:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42P4iooM049740; Mon, 25 Mar 2024 04:44:50 GMT (envelope-from git) Date: Mon, 25 Mar 2024 04:44:50 GMT Message-Id: <202403250444.42P4iooM049740@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: a1ecbc570117 - main - pf: fix use-after-free List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a1ecbc57011758257b85c3e9f51efc93ac93169d Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a1ecbc57011758257b85c3e9f51efc93ac93169d commit a1ecbc57011758257b85c3e9f51efc93ac93169d Author: Kristof Provost AuthorDate: 2024-03-23 16:02:50 +0000 Commit: Kristof Provost CommitDate: 2024-03-25 04:44:23 +0000 pf: fix use-after-free If we fragment the packet in pf_route() the first transmitted packet will free the pf_mtag we have stored in pf_pdesc (pd). Ensure we update that pointer for every packet to avoid using a freed pointer in pf_dummynet_route(). Reported by: CI KASAN, markj MFC after: 1 week --- sys/netpfil/pf/pf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index d7536e44623e..50dc67b72439 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -7450,6 +7450,7 @@ pf_route(struct mbuf **m, struct pf_krule *r, struct ifnet *oifp, if (error == 0) { m_clrprotoflags(m0); md = m0; + pd->pf_mtag = pf_find_mtag(md); error = pf_dummynet_route(pd, s, r, ifp, sintosa(&dst), &md); if (md != NULL)