From nobody Sun Oct 13 11:53:17 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 4XRJf55m9qz5Yqdd; Sun, 13 Oct 2024 11:53:17 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XRJf553Rzz4s0T; Sun, 13 Oct 2024 11:53:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728820397; 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=vZVICGEMmrXECoAK044rC1yl8NbKD7FC8hLW/4e4VC8=; b=EOTFRccJ03D898AkTZsMdCNAd533m3H2hQIM8HoHbyLTkaAPtrQiTNfda7wnchaNQITozx 4XiwTSShDsh5E1iNrZO6kIj0jjaveTXqLv08cVgmhYM94nkw+iRzvlM3DXnJPELuvf7Ym9 Y6oqVpGJkHzWCyFgfaw/DZvnPCQDvWRE2OPRhdwPpoCYEWy2B6S9qXvjVeozWxO2IHfW/P m83+5eBcGNbrg56nRgwogOEKmAFwD6+tovOcBe3WrIi25YtL+224n7yL92ukbCyHDX8Khb qmIMTIsvIZNXHuR21sq7ZHlqiKBnjr5E8ARGLZowr7zn5HMITUyVwpwB5d52rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728820397; 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=vZVICGEMmrXECoAK044rC1yl8NbKD7FC8hLW/4e4VC8=; b=oNf/tTZUYHUDNTOI4FLRoTKPkDz4BIgXRh7NYDdVsJJBSYhxUd9AeGKwBGYikjLw5BFFxt YmlmXbH+uC2ooAMhKbkgsZ72qXM84B9nz8NOIA+rHdGxjk01fwXW0p1LynGoIvRG7w3z7o 2Gr6U6wpzz04i1uoiac1+E9G+pIPEpnS8BiAm70D9HCEJK2ftqwJIoZdOjS45UduKLh5NN +SkAFDLJeJ6X+9EmycdrXk3Ls3SJBqoG9f39PzCbgskj5BnC86wIAvjmIAp/JCFjUh1c96 KtRwNxJmfMVqqAbVGkc5ND+3J1Ti9E+9bqlNimDwkWVmm7C4Rjrk7UJ1fEa5AA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728820397; a=rsa-sha256; cv=none; b=GPOt/OK+dOngyyZ8sMon1H83p5dXP6bCTcJZKBIRQJx7IEgKjaFmLq/7SUA3zs5yDXmzx4 cyj2EtNDa8MNwcJvm9RtX/pXo9J7EcH/iyYJslQXBXitcFRyZCoWVmz8j3VSaLY9I6GMyw /8CwiV1gqUfrd5PuTmLw6SrRWL1ietPZ72+RKtI6vDm150bfxhJC7V3DXy4B+rERlW+HBU UAsT8aptIcUf7ifxbC37xeg9Bvc9bNblqM9tB3COi+okv2XRc6+mtM9z3VW5DtSMfDgSZ9 eyhT5XKECo+UWkgSxlWvfAjOadipDZd+aknOiC7G1tCjfWIjOsYTgIfFGTKNAg== 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 4XRJf54gPjzt14; Sun, 13 Oct 2024 11:53:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49DBrHOS059833; Sun, 13 Oct 2024 11:53:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49DBrHwK059830; Sun, 13 Oct 2024 11:53:17 GMT (envelope-from git) Date: Sun, 13 Oct 2024 11:53:17 GMT Message-Id: <202410131153.49DBrHwK059830@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: e85d2c1b0e10 - main - pf: ensure pd->src/pd->dst are valid 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-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: e85d2c1b0e10b1cabd559bc5a45ac4c0286b2d66 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e85d2c1b0e10b1cabd559bc5a45ac4c0286b2d66 commit e85d2c1b0e10b1cabd559bc5a45ac4c0286b2d66 Author: Kristof Provost AuthorDate: 2024-10-12 08:40:53 +0000 Commit: Kristof Provost CommitDate: 2024-10-13 11:51:53 +0000 pf: ensure pd->src/pd->dst are valid When we reassemble a packet we potentially invalidate the pd->src and pd->dst pointers as they point into the packet. Reset those after reassembly. Reported by: markj, KASAN Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index f5b90424d246..bd8b709e396e 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -8708,11 +8708,15 @@ pf_setup_pdesc(sa_family_t af, int dir, struct pf_pdesc *pd, struct mbuf **m0, return (-1); } + /* Update pointers into the packet. */ + h = mtod(pd->m, struct ip6_hdr *); + pd->src = (struct pf_addr *)&h->ip6_src; + pd->dst = (struct pf_addr *)&h->ip6_dst; + /* * Reassembly may have changed the next protocol from fragment * to something else, so update. */ - h = mtod(pd->m, struct ip6_hdr *); pd->virtual_proto = pd->proto = h->ip6_nxt; pd->off = 0;