From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796422081; b=eJ0NWDCGxlBbzbvfMRiZ3bLYaPiD/+EE/Y9W8D+wZxi9G0Fkltw0G4qh7sWmTRJiDT/d X0W8lKjBTuHgEVOP61056cfW7nCJBTq1LaHj6AmHMApTaCkJ+vK8N/We4GjwLPcDqmVId 9jI9dQz9s2ABwAp0VGNgFuNUUZRoHYE+Ck46gC8bRPQsb1XZ/8vdIyTqoaa6eZmsGbVny 81zi+IoH/vrtu6gdqBMUTHg4mwwnmLnux4CEk9w/sp9bx0JzJlmBtp2usOIfJRj3x/9YO NH8osrAVWn1dGrFGSGnhynd395L9naY90x3uoNgToS9c3D8PW5ebRNKvcjq8krpzdvg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796422081; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=bxTy/041PuY3NXICmumZpsXV0j0OBEGQvdekK+dgdec=; b=rocD6LF0JEnjqSi0hor//q1Re01rLTD4VWACHACHY0DN7xQlGKPWurw+DprhdAPtdTrO pJXPEoigCbt3yTAnXcXNaw2vxnzErXojbXnX556+1y+hE5WFyk8a/+gbFXNkvq5u31tE/ mhWgz1Nh+SJqy15x4V8j3VmXD8Xuu9uQSVhpbQQyIkDRwudasQIUVuDu+llaG8PaWfeb4 yq7IrzqepdCgoP6MYTtom6Ya6lIXgPKhWG5F1DN6xf932vizykFT2wIUDcciQZ4EqzKT0 8eTaSxAVvj+VrR5++CpBoa2jMt5NL0ys0Vs36KsXAqZfCH6yiBl0G29PcCIVmAQoTXQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ULReVywO; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A82C606A337; Fri, 4 Dec 2026 22:08:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ULReVywO Received: by smtp.kernel.org (Postfix) with ESMTPSA id B770C1F00A07; Fri, 4 Dec 2026 22:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796422081; bh=bxTy/041PuY3NXICmumZpsXV0j0OBEGQvdekK+dgdec=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=ULReVywOwK35nT8p5CiIr22HnP6T9g6VyCLP5Rt5SXpnJDUeb0bUbFDYn8lYcZ9mA CesPa/lnDch/JjuPCuoBDIKAxKYvXLaKbOy791R4KZ6GTRBMlvJ2ASTtcIrXSXR58X I0OZNEJyUo9w1Q2KUByEM0c/1ndxexwd9ckEOm8gjoXWpnN+W4jDkHQ+cquBAlUezs xwoFy7wtpAMFILV+rLuNvzw7mdzupeg00gyQhfR0eate7f3Fi2zMeNfm4pjyF2dGN8 AmlzT8Fhy3oiCHquvsyhatIX3gedP68Y0M07jaPesLGF0sFt7gN7PjMyUbbSLPfOmv qzOTjbbwgi6xQ== Subject: Re: [PATCH net 08/10] net: kunit: test unreadable net_iov defrag and skb helpers From: netdev-bot+sashiko@kernel.org To: tavip@google.com Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, andrew+netdev@lunn.ch, ncardwell@google.com, kuniyu@google.com, dsahern@kernel.org, idosch@nvidia.com, john.fastabend@gmail.com, jakub@cloudflare.com, jiayuan.chen@linux.dev, sd@queasysnail.net, shuah@kernel.org, almasrymina@google.com, sdf@fomichev.me, kaiyuanz@google.com, ilias.apalodimas@linaro.org, hawk@kernel.org, mcroce@microsoft.com, herbert@gondor.apana.org.au, ecree.xilinx@gmail.com, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org Date: Fri, 04 Dec 2026 22:07:59 +0000 Message-ID: <179642207933.3146.17718828051155213496@kernel.org> In-Reply-To: <7cd1ee7c97bba0d276b9a09aa7cdfa38b08c96cc.1796329894.git.tavip@google.com> References: <7cd1ee7c97bba0d276b9a09aa7cdfa38b08c96cc.1796329894.git.tavip@google.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 3 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] netmem_unreadable_test_ip_defrag() (net/core/net_test.c) puts fragment skbs into the global init_net reassembly queues: the IPv4… - [Low] The commit "net: skbuff, skmsg, strparser: reject unreadable frags" says it was "reproduced and verified with the accompanying… - [Low] The Netfilter IPv6 sub-cases of netmem_unreadable_test_ip_defrag() are wrapped in `#if… - [Low] The IPv4 part of netmem_unreadable_test_ip_defrag() reassembles in the live init_net ipfrag fqdir with fixed keys. -- net: kunit: test unreadable net_iov defrag and skb helpers This commit adds KUnit tests to net_test for unreadable net_iov handling in IPv4 and Netfilter IPv6 fragment reassembly, skb_to_sgvec(), skb_send_sock_locked() and strparser. The tests also check that the page_pool and binding reference counts stay balanced. > diff --git a/net/core/net_test.c b/net/core/net_test.c > index b939cc93e9050..8da6c5ab4430c 100644 > --- a/net/core/net_test.c > +++ b/net/core/net_test.c [ ... ] > @@ -1962,6 +1971,377 @@ static void netmem_unreadable_test_napi_reuse(struct kunit *test) [ ... ] > +static struct sk_buff *alloc_ipv4_frag_skb(u16 id, u16 frag_off) > +{ [ ... ] > + iph->id = htons(id); > + iph->protocol = IPPROTO_UDP; > + iph->saddr = htonl(0x7f000001); > + iph->daddr = htonl(0x7f000001); [Severity: Low] These fragments go into the live init_net ipfrag fqdir with a fixed key. The key is saddr = daddr = 127.0.0.1, protocol UDP, IDs 0x4242 to 0x4245, and user IP_DEFRAG_LOCAL_DELIVER. Also, netmem_unreadable_test_ip_defrag() re-enables BH between the two ip_defrag() calls. Can real local-delivery fragments with the same key join or disturb the test's queue in that window? Loopback UDP with a reduced lo MTU or locally injected raw fragments could do this. If a readable real fragment lands in one of the test's unreadable queues, the mixed-readability check drops the real packet and the test result is wrong. A queue left over from an earlier failed run with the same ID could also break the next run. The IPv6 sub-cases don't seem to have this problem. The in-tree callers of nf_ct_frag6_gather() all use conntrack-range users rather than 0. Would a dedicated netns, or less predictable addresses or IDs, isolate these tests? > +#if IS_REACHABLE(CONFIG_NF_DEFRAG_IPV6) > +static struct sk_buff *alloc_ipv6_frag_skb(u32 id, u16 frag_off) [ ... ] > +static void netmem_unreadable_test_ip_defrag(struct kunit *test) > +{ > + struct netmem_unreadable_env *env = netmem_unreadable_env_init(test); > + struct sk_buff *frag1, *frag2, *child; > + int err; > + > + /* IPv4: readable first fragment + unreadable second fragment must fail > + * and tear down the fragment queue. > + */ [ ... ] > + local_bh_disable(); > + err = ip_defrag(&init_net, frag2, IP_DEFRAG_LOCAL_DELIVER); > + local_bh_enable(); > + KUNIT_EXPECT_EQ(test, err, -EINVAL); > + if (!err) > + consume_skb(frag2); [Severity: Medium] What happens to the queued fragments if this second ip_defrag() call returns -EINPROGRESS? KUNIT_EXPECT_EQ() doesn't abort the test. The live queue still owns fragments that hold page_pool references to env->niov, and nothing in the test kills that queue. At teardown, netmem_unreadable_env_cleanup() runs: netmem_clear_pp_magic(env->niov_nm); netmem_set_pp(env->niov_nm, NULL); page_pool_destroy(env->pool); percpu_ref_exit(&env->binding.ref); KUnit then frees env, and with it the embedded struct net_iov. When the frag queue timer fires later (ipfrag_time for IPv4, IPV6_FRAG_TIMEOUT for nf IPv6), the purge path would run: inet_frag_rbtree_purge() kfree_skb() skb_release_data() napi_pp_put_page() Wouldn't that read the freed niov and binding memory from softirq context, possibly after net_test.ko has been unloaded? This doesn't need a kernel regression to happen. ip_frag_queue() checks ip_frag_too_far() before the readability check: if (!(IPCB(skb)->flags & IPSKB_FRAG_COMPLETE) && unlikely(ip_frag_too_far(qp)) && unlikely(err = ip_frag_reinit(qp))) { Suppose more than ipfrag_max_dist fragments from 127.0.0.1 are processed between the two calls. ip_frag_reinit() then resets the queue, frag2 is queued alone, and ip_frag_queue() returns -EINPROGRESS. A regression in the reassembly code under test that leaves the queue incomplete would have the same result. The other IPv4 sub-cases that expect 0 and the nf_ct_frag6_gather() sub-cases follow the same pattern. Could the test make sure any remaining queue is killed before the env is torn down? [ ... ] > +#if IS_REACHABLE(CONFIG_NF_DEFRAG_IPV6) > + /* Netfilter IPv6: mixed readability must fail and kill the queue. */ [Severity: Low] NF_DEFRAG_IPV6 is a promptless tristate. With NET_TEST=y and NF_DEFRAG_IPV6=m, IS_REACHABLE() is false and this block is compiled out. NET_TEST in net/Kconfig only depends on KUNIT and selects neither option. The CONFIG_STREAM_PARSER block in netmem_unreadable_test_sg_and_strp() has the same issue. STREAM_PARSER is def_bool n and is only enabled when BPF_STREAM_PARSER, AF_KCM or ESPINTCP selects it. In those configs, netmem_unreadable_test_ip_defrag() and netmem_unreadable_test_sg_and_strp() still report PASS without running the IPv6 or strparser checks. Would an #else branch with kunit_mark_skipped(), or a Kconfig dependency for NET_TEST, make that visible? [ ... ] > +static void netmem_unreadable_test_sg_and_strp(struct kunit *test) > +{ [Severity: Low] This isn't a bug in this patch. It concerns the earlier commit in the series, "net: skbuff, skmsg, strparser: reject unreadable frags", which says it was: "reproduced and verified with the accompanying net_test KUnit tests" This test covers skb_to_sgvec(), skb_send_sock_locked(), and strp_recv() through strp_data_ready(). It doesn't reach the skmsg changes in that commit: - the new reject branch in sk_psock_verdict_apply(), which reports EFAULT and clears SK_PSOCK_TX_ENABLED - the new -EMSGSIZE propagation in sk_psock_skb_ingress_enqueue() No psock is created anywhere in net/core/net_test.c. Should that commit message say what the tests actually cover, or should sockmap coverage be added here? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1796329894.git.tavip%40google.com