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=1796418578; b=iF3bKq1nWyojJYR0f5OAHFjNHsWr5C5dLLYGcgAQiyyklU87UJ8kIhOl+Hl16hqfdygr RS9KaEb3rQLP/S1OGdf1UmVaJq4yQYx8LmOHKKixmGiSNUI+HsPkNoq+N6qlyVi9B/aE0 DmLOgrvZ1jtzltfIYGFZtJSqWvNex04Pm/tTrywp/p3kLNC9D0MUra2kS5U76hP88bqVK MIBvBnlTDfK6KCBkBvI9f9AddZdwDkL4SzwORXqWo8J2YuCrKIs0JGjSpd2dKnTXNgn/g WG3pRk7bqKnBeL3d4rrdGGmKln/rVYhoWqc+quAQP+L0gYwoVpKCEPOZec5640C7VfQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796418578; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Kuum09i6MZBbt8RKTClTZClS4CHtHYPbHlfwqbe0KIA=; b=FCfVVH3oeuMrcRBj2gKDiSVdRwgYqkhv1KYqsgKCMH/Mqq2en0qHKblcR6tBGoY9+U8D gQyX4xApCs85nNNBD0G/qW4bzfcYvQhNogV/93a5D0c+KgAV8gFfxRxCQG7vixonP+DpM ZtG6j8thoE4DCepwdCXjGkjpt16G2JRZQNlG6QSCzzPBUkYZWy5IYiKAtRsE13E0UFscA OYwDLFH19cI7RKWr2ybQwviChnBiqgwv9FCwXIPzm0c7ThG2UtS5qs29+FjidhNYoypwE yu+UaCbbkC4rMjENvD/gQjHpccMoKFrSqpK0ba5yylYjl3HogczAXjcfxZs1QZSLjAg== 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=XjAWOrE6; 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 66364606A33B for ; Fri, 4 Dec 2026 21:09:38 +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=XjAWOrE6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E31A1F0093B; Fri, 4 Dec 2026 21:09:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796418578; bh=Kuum09i6MZBbt8RKTClTZClS4CHtHYPbHlfwqbe0KIA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=XjAWOrE6Fbom09EblMFjSMdFRvXbQQZMVYL+Ky7dVrpGb8SdILCNslPBPx6d1MVuc mpdw4RTpEWlEAq/UgRhkZEbdIZ272dLHmE+HkS2ycwqElImkWzwxaoyGuaJN+Ib4aF +b58Cu4TQ7a9cOT2FdeFz8/SzanKxxhLOhxxzwZQqkvy7LuzcyBGgEXPN8GPGx47FU jE2PGy+/oohukiUnHrOC0V1ooJ/8xXTH033Scs045LfWBF7/nqHv/3GFyFgSfwmjug NbL9zWOnhSjg1jsOPK+xK+/tQd6y36bXiQZxi6fnL9U29XcWUVmaqgIYPZpmJgnbWr 7HadWOuW8ZuRg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net 08/10] net: kunit: test unreadable net_iov defrag and skb helpers Reply-To: sashiko-reviews@lists.linux.dev To: "Octavian Purdila" Cc: bpf@vger.kernel.org In-Reply-To: <7cd1ee7c97bba0d276b9a09aa7cdfa38b08c96cc.1796329894.git.tavip@google.com> References: <7cd1ee7c97bba0d276b9a09aa7cdfa38b08c96cc.1796329894.git.tavip@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 21:09:37 +0000 X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] net: kunit: queued init_net frags can outlive netmem_unreadable_env -- commit 21831f6cfd8142662428e0c9b0635f40e76c1bbb Author: Octavian Purdila net: kunit: test unreadable net_iov defrag and skb helpers This commit adds KUnit tests for unreadable net_iov handling in IPv4 and Netfilter IPv6 fragment reassembly, skb_to_sgvec(), skb_send_sock_locked(), and strparser. > 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 [ ... ] > +static void netmem_unreadable_test_ip_defrag(struct kunit *test) > +{ > + struct netmem_unreadable_env *env =3D netmem_unreadable_env_init(test); > + struct sk_buff *frag1, *frag2, *child; > + int err; [ ... ] > + /* IPv4: unreadable first fragment + readable second fragment must fail > + * and release the queued unreadable fragment cleanly. > + */ > + frag1 =3D alloc_ipv4_frag_skb(0x4243, IP_MF); > + frag2 =3D alloc_ipv4_frag_skb(0x4243, 16 >> 3); > + if (!frag1 || !frag2) { > + consume_skb(frag1); > + consume_skb(frag2); > + KUNIT_FAIL_AND_ABORT(test, "failed to allocate IPv4 frags"); > + } > + netmem_unreadable_add_frag(frag1, env, 0, 16); > + skb_put_zero(frag2, 16); > + > + local_bh_disable(); > + err =3D ip_defrag(&init_net, frag1, IP_DEFRAG_LOCAL_DELIVER); > + local_bh_enable(); > + if (err !=3D -EINPROGRESS) { > + if (!err) > + consume_skb(frag1); > + consume_skb(frag2); > + KUNIT_FAIL_AND_ABORT(test, "frag1 ip_defrag failed: %d", err); > + } > + > + local_bh_disable(); > + err =3D 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] Can a queued fragment referencing env->niov outlive env and trigger a use-after-free when the fragment timer expires? When ip_defrag() queues frag1 into init_net, frag1 holds env->niov_nm pointing to &env->niov under an asynchronous ip_expire() timer. If init_net fragment memory exceeds high_thresh before frag2 arrives, inet_frag_find() returns NULL before looking up frag1's queue: net/ipv4/inet_fragment.c:inet_frag_find() { ... if (!high_thresh || frag_mem_limit(fqdir) > high_thresh) return NULL; ... } frag2 then returns -ENOMEM without killing frag1's queue, and the test exits while frag1 is still queued in init_net. On exit, netmem_unreadable_env_cleanup() clears pp_magic, destroys env->pool, and exits env->binding.ref before KUnit frees env. When ip_expire() later purges frag1, skb_release_data() -> skb_netmem_unref() reads freed env->niov and falls through to percpu_ref_put(&env->binding.ref) on freed memory in softirq context. The same lifetime issue affects the other IPv4 subtests and the nf_ct_frag6_gather(&init_net, ...) subtests. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796329894.gi= t.tavip@google.com?part=3D8