From nobody Mon Apr 01 07:34:36 2024 X-Original-To: dev-commits-src-all@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 4V7N7c3Ydrz5FqpY; Mon, 1 Apr 2024 07:34:36 +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 4V7N7c2ncJz4kMP; Mon, 1 Apr 2024 07:34:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711956876; 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=BhoVhRDOmuklbYJafNPgym+h00R78tBluonLl1lYlmI=; b=vdKVP3OOJ8QGZnHD5E2H5Lr0Xui/tF5yg6pCx5o9vs2v2oyy5zP/QOfn9d1oY0q2OGoL3X 8dLGVKFBbY05a381eSv1qgzhSWHO8U/Ir0k3SpwEsrTMo1/orMc0+7sVUHYQ8b6UjuHK1z BN36I0plzrJc212CfDWW47eKyfqB85KydbCfTQ8rJVJXx6E0EJ8Kp5gEwXR/wQs8ocVdCd JDGVTmS48HBUdJJykLg9I+ynEZjOxJ8U9xfTr3/afeIpeuzZRAvKCO8LUkTz8jzhTLGBt9 ML+Q+cIIAZRF5jU0EJ019XMzXSYVGzWIh+JLOuQW36w8ZqSYc5YdyyVvV9y0HA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711956876; a=rsa-sha256; cv=none; b=QvA93uDRksO08lFq6ZtYSS2wyOj3wET6NkSBoiwtdC7wv+YJTK4Y6iokKHhiWz5HgtQtRi DKYafQVCEvq8p7gB7mVUoKDpyHLcCtULg2Hn0HacHhqfQFioAogh/j7IQc14dNSc5A156R NE7lXAY3f+f9BOA/SR/nx4Wppn7dadzoaIL1V2qQMzFdRUobZSIgGIv6DKK6J6B6tr2jSk EHYzYdv1sWHQeR89R+Zf7gzP7kURPYMcAUFrt4oHA6Vkodpe/TImGNrYxw4MiaWwDctvqK YxMehYn1GOEYVGeT+dXcwvhQvmwHlA2RxZNf0uDwApgU337kMpyX4BfvXnq4KA== 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=1711956876; 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=BhoVhRDOmuklbYJafNPgym+h00R78tBluonLl1lYlmI=; b=cmx6CguvB7BVECXY1ePxVqRCZ09qWo0IiV5oG2AJC+tcy8MyRRzoscHVreumii1MNxwMfg DQhIh1n9cZcqV2V2oGcj3qLT1+Z7xRRQk90dATetGF3y3hj8PBS+ahDeA6GqrK7Xe/djaG dCcbVfqn6iblB/FzMTorAAQh9IymhHp3PvqAZEO8XvSkXX44Y2lEX4TvXMetbnZTpdgZ9D mHSKC9U8qxFBLIcM63LD7ytep2LNnVq3XHcQ2ZAqojLCwxPPhXE6bWLtkQZGw7I2S4U455 Fzhut+XxjlGsEcUH030M30NMBsd7edE4G7Bz8Tiz5DBA9MPtcwPT9U9Rt8DXIQ== 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 4V7N7c2Nnpz1C8Y; Mon, 1 Apr 2024 07:34:36 +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 4317YaG1037708; Mon, 1 Apr 2024 07:34:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4317YaWQ037705; Mon, 1 Apr 2024 07:34:36 GMT (envelope-from git) Date: Mon, 1 Apr 2024 07:34:36 GMT Message-Id: <202404010734.4317YaWQ037705@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 2fed983ceb66 - stable/14 - pf: fix use-after-free List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 2fed983ceb6678fbe2facb20627248a5fae6cf7a Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2fed983ceb6678fbe2facb20627248a5fae6cf7a commit 2fed983ceb6678fbe2facb20627248a5fae6cf7a Author: Kristof Provost AuthorDate: 2024-03-23 16:02:50 +0000 Commit: Kristof Provost CommitDate: 2024-04-01 07:33:32 +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 (cherry picked from commit a1ecbc57011758257b85c3e9f51efc93ac93169d) --- 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 e19370cc7333..b0b0a02afaf4 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -7374,6 +7374,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)