Article View: linux.kernel.netdev
Article #3172Re: [PATCH net-next 2/4] net: use ip4_parse() in receive validation
From: netdev-bot+sashiko
Date: Wed, 14 Oct 2026 10:59
Date: Wed, 14 Oct 2026 10:59
86 lines
8443 bytes
8443 bytes
Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The commit message overstates how many sites were converted. -- net: use ip4_parse() in receive validation This patch converts br_validate_ipv4(), ip_rcv_core() and nf_reject_iphdr_validate() to use ip4_parse(). They previously did an open-coded pskb_may_pull() followed by version and ihl checks. The returned thoff is then used in the later length checks. > Convert the sites that pull and do version and ihl checks on the ipv4 > header and validate the packet transport offset to use ip4_parse. > > Sites that validate a read-only copy instead of pulling - the nft > and nft_inner header_pointer validators, ip_check_defrag()'s > skb_copy_bits, the flow dissector - stay open-coded for now. [Severity: Low] This isn't a bug, but is this description complete? A few sites still call pskb_may_pull() and then open-code the version and ihl checks. The read-only copy exclusion list above does not cover them. nft_set_pktinfo_ipv4_ingress() in include/net/netfilter/nf_tables_ipv4.h: if (!pskb_may_pull(pkt->skb, sizeof(*iph))) return -1; iph = ip_hdr(pkt->skb); if (iph->ihl < 5 || iph->version != 4) goto inhdr_error; This has the same pattern as br_validate_ipv4(). The header_pointer validator in that file is __nft_set_pktinfo_ipv4_validate(), not this function. ip_mc_check_iphdr() in net/ipv4/igmp.c: if (!pskb_may_pull(skb, offset)) return -EINVAL; iph = ip_hdr(skb); if (iph->version != 4 || ip_hdrlen(skb) < sizeof(*iph)) return -EINVAL; offset += ip_hdrlen(skb) - sizeof(*iph); if (!pskb_may_pull(skb, offset)) return -EINVAL; This looks like it maps directly onto ip4_parse(skb, skb_network_offset(skb), &thoff). nf_ct_bridge_pre() in net/bridge/netfilter/nf_conntrack_bridge.c calls pskb_may_pull(skb, sizeof(struct iphdr)). nf_ct_br_ip_check() then checks: if (iph->ihl < 5 || iph->version != 4) return -1; All three sites are still open-coded at the end of the series, after "net: account for ingress-resolved virtio net hdr state". At that point the only ip4_parse() callers are br_validate_ipv4(), ip_rcv_core(), nf_reject_iphdr_validate() and include/linux/virtio_net.h. A smaller point: ip_rcv_core() still sets the transport header from ihl, even though thoff is now in scope: skb->transport_header = skb->network_header + iph->ihl*4; This has no functional effect. Should these sites be converted, or should the commit message list them as staying open-coded? -- Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1791887415.git.mst%40redhat.com
Technical Details
Message-ID:
<179197556904.434549.14572204986148873620@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346174-linux-kernel-netdev=dewy.ruReferences:
<05eb0a83a9975e8e042caeeb4fca5fad30e02fb4.1791887415.git.mst@redhat.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346174-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next 2/4] net: use ip4_parse() in receive validation Date: Wed, 14 Oct 2026 10:59:29 +0000 Organization: Usenet Network Message-ID: <179197556904.434549.14572204986148873620@kernel.org> References: <05eb0a83a9975e8e042caeeb4fca5fad30e02fb4.1791887415.git.mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2275289"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:TIZAr3F69zUWryYC5p27kFN6Rq8= sha256:tIZ665NqD2fb3y2JeVBm4mbJzPSCgETvqPKEa6JwDw8= sha1:JzN4YHoVeUVcBUX4uf3wHsWBo4g= sha256:b0qFHfvLCxrXK8aT/kC2H5YyUzUUMHhbfwUw+7n/UKY= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 985631100B8; Wed, 14 Oct 2026 14:00:04 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -1.439 X-Spam-Status: No, score=-1.439 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mv8-qfsDeP9N; Wed, 14 Oct 2026 14:00:00 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-346174-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id A5B3E1100BE; Wed, 14 Oct 2026 13:59:51 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sto.lore.kernel.org (Postfix) with ESMTP id ADF48612A75; Wed, 14 Oct 2026 10:59:38 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D12B344D8C; Wed, 14 Oct 2026 10:59:31 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EXpMUoUr" X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88BA54F4745; Wed, 14 Oct 2026 10:59:30 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791975571; cv=none; b=IlV1LvcC4+FYhmcnGqofXHlRd5rfHEIV37YqabuJHULYrfmnxxCniFHtwYE2XG425SN0K9GHtSbD8PBr8HnKvVxIruEjf67zevUDhZuFqApsmzPCGhDmt09pHJXjWVBWhOpHjlNuQqJYEXt1Lb7vRYiMwCMqI8qvl45YiaNKO5U= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791975571; c=relaxed/simple; bh=zEdvw00+OB4u3D7ZFXgEPWff6JkcvwQSmWwuMgxuYH4=; h=Subject:From:To:Cc:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=bcaWH1rfk4Exjwx2n8/5+K+A75/Px23+lrI94DwEKLqHPlQOMIzwIcC9VgA/NKlUBv05ZZJ3V+AcLYWEHDgsQwJ3NtZLvSv1dn1mLhLb/Jp3/1gxW1vcgMZC30C7UVVKUBuEywfwxvsaSYqRawhn8BiF0alIGHSX909KAkTrG/M= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EXpMUoUr; arc=none smtp.client-ip=100.103.45.18 X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81FBC1F00898; Wed, 14 Oct 2026 10:59:29 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1791975570; bh=Xe468sh/L6Nr7iH3EsYlMcP//McKXHnPmdwCKiwKL1o=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=EXpMUoUrF+3mWSiYPqkw5L0PV7XegaluoDDpLY5ATdzEIIalbcrwQUxgZ6hMh6qrC arbd/6nu54c1RmfF3WoPG2oQsTCHZKFfVn5HDwJK3tbPFv4Ekic7XnxyMssQW/UYyI 4oUgM3xVoEf6FNdY8dyf17SThGtFzj6B+NDC2g9TyKxMXW+4eelSpw5ZxtYLGvnYLU ngY4gpHi1dNg7R8pMnk7BTB2tUUGB5Opu9xTBCENHCeAA6VA8WR9tNfovTtxIdYUnh eME6uGuoD0/iggZU8nzvze3fuHsRx4EyX31hXHS3dzz4J+ysFRENcP+WxQdjFePLqX sWV28hzsKhFDw== X-Cc: linux-kernel@vger.kernel.org, willemdebruijn.kernel@gmail.com, jasowangio@gmail.com, eperezma@redhat.com, xuanzhuo@linux.alibaba.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, virtualization@lists.linux.dev, maxk@qualcomm.com, rusty@rustcorp.com.au, horms@kernel.org X-In-Reply-To: <05eb0a83a9975e8e042caeeb4fca5fad30e02fb4.1791887415.git.mst@redhat.com> X-sashiko-severity: Low X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>