From nobody Thu Oct 31 20:33:20 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 4XfbKs232Cz5cL6S; Thu, 31 Oct 2024 20:33:21 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XfbKr6fx7z4WQ1; Thu, 31 Oct 2024 20:33:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730406800; 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=1YD9Znzlos0wIidboZih5o07ji6UIjP1fwWMqmCFg64=; b=o2oUXcJ1ny1qzayKRIuaVdIAS5b2VT246l+BVM8yL4UMw0WHhovEIeIzX0c8cJpSRB4Az0 QKXx7VsvXHSSx/aDp2XCYt7/3kLk3DF9pY/cSTQ0o1P2d0zMw98OvkF1Kjfq3P1FME3uiw eVhZq+NClLEWiy+nStPK8ItU7GcLVFvKJFRYjgTP+IvR16h0xk38uBhqD2+BVM0qTctDhi jHS5MHE6h+FZFcWMNcgcYM1IYJRqm9BaZnKHRvLD5t2mrS827yILZyd4J76X8ouvWKdB9T kTfCdoOytMofk7N4DZMB9E2V8kXch4g/67aH+2Jbf8Kzux3k8qMJ/aexQYwHTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730406800; 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=1YD9Znzlos0wIidboZih5o07ji6UIjP1fwWMqmCFg64=; b=kUrLefcShM+m10iP69CDZM1bRoMxfQ1Gz0OzJPt/qW+TugkaLgPp4tvUY2tRXekC1nn2qJ sFToOppnIXo1mh8L4fJ+B/Ep+ixapFx7ws0iJ+/wCVRILGR43xN6+JZybcxasNfZfoqDvp hj+JyPp4v4q//7IAMgMx4CkmfTsYWkm/JJh1rC0idLa/v2T8e52CjwIFaOboO9/Wr8s2Dl 8/CCurAKTVMWqRLbioRyk7s8mYiM10AgONd4mvxis9WRZqGLZ2j/DUIkDbmFUnn3PdhmMz i2IGE49APLiq9Keuw9TpCeiRzTrdJl+Ys7Nok0MIJXYHEFHx3+S7y6DkVev3gg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730406800; a=rsa-sha256; cv=none; b=mEwB2Fj3I4MwuH2SmHJj3xHG7cPkraP6xlpcHQMq2T0v8qAMt54WFZ2dW1ittSzP1CbGRF pkBPm7b5xnPXmN5VQ0cwRrh3gXUHKmPv05WYqNgZcR7z4IIm45hMhfR6xOhfcSBOxNZL5c vvuIcC1SYu3s5wUpVBvpiBakQ5U2cC2lx26bciB3Z7kQtr7M7P/QYpRt3d9FqdYvI/WBb5 0ZD5FsIZmv2zIzuCrVtuKfO7G3owF7lObU45cRWd/Y/Gl2+U8FqS//qhMrYs9Cp1lk8cJW yanPwHNyuhtyYhqXrwvKJBRnkXmk6ovdltN+an7iaUkal/xIOUymZmjW3PZmQg== 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 4XfbKr6DhczrQQ; Thu, 31 Oct 2024 20:33:20 +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 49VKXKnp081905; Thu, 31 Oct 2024 20:33:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49VKXK29081902; Thu, 31 Oct 2024 20:33:20 GMT (envelope-from git) Date: Thu, 31 Oct 2024 20:33:20 GMT Message-Id: <202410312033.49VKXK29081902@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 28aafeb83c08 - main - netinet*: Add assertions for some places that don't support M_EXTPG mbufs 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28aafeb83c085b83d03c8f2f2fe0a785f640c026 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=28aafeb83c085b83d03c8f2f2fe0a785f640c026 commit 28aafeb83c085b83d03c8f2f2fe0a785f640c026 Author: John Baldwin AuthorDate: 2024-10-31 20:32:32 +0000 Commit: John Baldwin CommitDate: 2024-10-31 20:32:32 +0000 netinet*: Add assertions for some places that don't support M_EXTPG mbufs Found while auditing calls to M_WRITABLE to see if M_EXTPG could be removed from its checks. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D46785 --- sys/netinet/igmp.c | 1 + sys/netinet/ip_mroute.c | 4 ++++ sys/netinet/ip_options.c | 2 ++ sys/netinet6/ip6_mroute.c | 5 +++++ 4 files changed, 12 insertions(+) diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index 454668c2aadc..5082b6294ebb 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -1471,6 +1471,7 @@ igmp_input(struct mbuf **mp, int *offp, int proto) m = *mp; ifp = m->m_pkthdr.rcvif; *mp = NULL; + M_ASSERTMAPPED(m); IGMPSTAT_INC(igps_rcv_total); diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index afa199ce0691..501b3e0d9a43 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -1311,6 +1311,8 @@ X_ip_mforward(struct ip *ip, struct ifnet *ifp, struct mbuf *m, u_long hash; int hlen; + M_ASSERTMAPPED(m); + CTR3(KTR_IPMF, "ip_mforward: delete mfc orig 0x%08x group %lx ifp %p", ntohl(ip->ip_src.s_addr), (u_long)ntohl(ip->ip_dst.s_addr), ifp); @@ -1562,6 +1564,7 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp, struct mfc *rt, vifi_t xmt_vif) vifi_t vifi; int plen = ntohs(ip->ip_len); + M_ASSERTMAPPED(m); MRW_LOCK_ASSERT(); NET_EPOCH_ASSERT(); @@ -1745,6 +1748,7 @@ phyint_send(struct ip *ip, struct vif *vifp, struct mbuf *m) int hlen = ip->ip_hl << 2; MRW_LOCK_ASSERT(); + M_ASSERTMAPPED(m); /* * Make a new reference to the packet; make sure that diff --git a/sys/netinet/ip_options.c b/sys/netinet/ip_options.c index 41f77a7491f2..a9d6836d9e97 100644 --- a/sys/netinet/ip_options.c +++ b/sys/netinet/ip_options.c @@ -514,6 +514,8 @@ ip_insertoptions(struct mbuf *m, struct mbuf *opt, int *phlen) *phlen = 0; return (m); /* XXX should fail */ } + KASSERT((m->m_flags & M_EXTPG) == 0, ("%s: mbuf %p is unmapped", + __func__, m)); if (p->ipopt_dst.s_addr) ip->ip_dst = p->ipopt_dst; if (!M_WRITABLE(m) || M_LEADINGSPACE(m) < optlen) { diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index 3e849e5b36dd..f3c68d61f245 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -1073,6 +1073,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m) GET_TIME(tp); #endif /* UPCALL_TIMING */ + M_ASSERTMAPPED(m); MRT6_DLOG(DEBUG_FORWARD, "src %s, dst %s, ifindex %d", ip6_sprintf(ip6bufs, &ip6->ip6_src), ip6_sprintf(ip6bufd, &ip6->ip6_dst), ifp->if_index); @@ -1364,6 +1365,8 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt) u_int32_t iszone, idzone, oszone, odzone; int error = 0; + M_ASSERTMAPPED(m); + /* * Don't forward if it didn't arrive from the parent mif * for its origin. @@ -1527,6 +1530,8 @@ phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m) int error __unused = 0; u_long linkmtu; + M_ASSERTMAPPED(m); + /* * Make a new reference to the packet; make sure that * the IPv6 header is actually copied, not just referenced,