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=1796510737; b=3TkEg7SQxQi6nstx099veGPy689FPUh/vVzYZxNiR6clras09KtjEmNZtoFATUvOO6aP SCuU9+yhmnyiSrR3zjX165k9kIgLcOjfDXIU8l7+are+kbIwo3eYxjqBwjWSHpV2jvuhY /14G9nFWxXRVm3xG/iuM1tn3pX71M63HxU5sOOIZB6Oveet1PU8jBs6ZmwfvtYje6Sye5 THoVy2H1e5L0pSNi2NS5OuFhTpUtD31fFZ1ym83iEaWT8pAus09bFcZnCC2DnLSfKw+4w cSM4JTD8Olnqkcey5XzqxH0QyRv/TaDQ3WqHCz8SoI+B/FQqGezvPDW/pu+PRR2pdog== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796510737; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=L4iskmTY4n29kPM8jVf6Do1WpbkBGOmv/9UhkfFL2v0=; b=oVqEYhiJeDFAO6iphH9FL4bFdWk02hu9G9Mmxjg4q7AKHx3oNnDPB2v4W86yaq8/WT3Y /td0hPQsPFwN36O/+WLWWI9R+hzv4ZeUT0dyZSK1pxHMF6ao8u6wEJ+Pd9kT4AKyCCFKr XsUgVy98II29wXI4+yIwVLGjHc67/+PQR22PpGSsTUkNSfRV1Kyrz7PMsFL5rb7vNr8IX jhpqJZFM0hXTZNMkFCNo5luOVH5RI1SwmCyWOLGIlw0u8Rzvmuy9XwIEUVC6yIM79bIMp ca8aYPJ32gpP9XSed45iortMY4z0CuQZNZCxajo/2Pj1iqOEfFYv6rS711v7H58R1Tw== 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=da8V9qDI; 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 97D44606A322; Sat, 5 Dec 2026 22:45:37 +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=da8V9qDI Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17F161F0092B; Sat, 5 Dec 2026 22:45:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796510737; bh=L4iskmTY4n29kPM8jVf6Do1WpbkBGOmv/9UhkfFL2v0=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=da8V9qDIAi0AtQx9u2E/E+PXy10QEVWdJ3vPs1+t7/GeFX4AV6yHRm18qfqWlUyNw fadI8VmierCO7dllbL2b6obclvhoi9yqVH4CbK1dH9l+rfyZoGuFuwkCv4MLnKS2Jv WWdaRmBKKNIN3IL6zivcFuSvWa504+V+CFq5oHPsJFl62RCRzIl8TttU0uQW5WadT6 XJb6U6gnwtjtqfZXUOK0uJR65jeg9VzU843/s5U+mHJyjDZmTi77ElJ7CS32Or2aXj a1uZZKdGIBpezNDyEa9qt2Oz2IlRUjZNmsLhQ0KTeLmltUOL7DTsUSQ9zqj+0msqQB xu1GWgFIWy5NA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net-next v5 1/2] net: keep the TCP fixed-ID flags on the header they describe Reply-To: sashiko-reviews@lists.linux.dev To: "Julius Bairaktaris" Cc: linux-rdma@vger.kernel.org, bpf@vger.kernel.org In-Reply-To: <1b35c02798f3e7c08bf0dda52cc2078161fa85e4.1796423663.git.julius@bairaktaris.de> References: <1b35c02798f3e7c08bf0dda52cc2078161fa85e4.1796423663.git.julius@bairaktaris.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 22:45:36 +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] xfrm: missing skb_header_unclone() before gso_type write in xfrm_output() -- commit 7dbada5cb7d60d1b2e2e417d84df7662ed0b13cc Author: Julius Bairaktaris net: keep the TCP fixed-ID flags on the header they describe This commit reassigns SKB_GSO_TCP_FIXEDID to the innermost IPv4 header and replaces SKB_GSO_TCP_FIXEDID_INNER with SKB_GSO_TCP_FIXEDID_OUTER for the outermost header of encapsulated packets. It updates GRO, GSO, tunnel, BPF, xfrm, and driver paths to set, propagate, or clear the outer flag accordingly. [ ... ] > diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c > index 60ffe9549c094..00a1f69cf9cc0 100644 > --- a/net/xfrm/xfrm_output.c > +++ b/net/xfrm/xfrm_output.c [ ... ] > @@ -807,7 +808,26 @@ int xfrm_output(struct sock *sk, struct sk_buff *skb) > sp->xvec[sp->len++] =3D x; > xfrm_state_hold(x); > =20 > + /* > + * inner_protocol is only valid on an encapsulated skb: a tunnel > + * that decapsulated the packet leaves it set, and so does > + * iptunnel_handle_offloads() on a packet without offloads. > + * Clear it, so that the mode output records this packet's > + * inner headers. > + */ > + if (!encap) > + skb->inner_protocol =3D 0; > xfrm_get_inner_ipproto(skb, x); > + /* > + * Transport and BEET mode keep the IPv4 header and its ID, so > + * the header that SKB_GSO_TCP_FIXEDID describes is the outer > + * one as well. > + */ > + if (!encap && > + (x->props.mode =3D=3D XFRM_MODE_TRANSPORT || > + x->props.mode =3D=3D XFRM_MODE_BEET) && > + (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_FIXEDID)) > + skb_shinfo(skb)->gso_type |=3D SKB_GSO_TCP_FIXEDID_OUTER; > skb->encapsulation =3D 1; > =20 > if (skb_is_gso(skb)) { [Severity: Medium] Can this mutate skb_shinfo(skb)->gso_type on a header-cloned skb without calling skb_header_unclone() first? An xfrmi device advertises NETIF_F_GSO_SOFTWARE, so a TCPv4 GRO packet with SKB_GSO_TCP_FIXEDID reaches xmit_one() unsegmented. If an AF_PACKET tap is attached, dev_queue_xmit_nit() clones it before xfrmi_xmit() -> xfrm_output(), leaving both skbs sharing skb_shared_info. CPU0 CPU1 xmit_one() dev_queue_xmit_nit() skb_clone() -> packet_rcv() xfrmi_xmit() -> ... xfrm_output() packet_recvmsg() skb_shinfo(skb)->gso_type |=3D virtio_net_hdr_from_skb() SKB_GSO_TCP_FIXEDID_OUTER reads skb_shinfo(skb2)->gso_type <-- data race Modifying gso_type in place causes a data race with concurrent readers on the clone and leaks the flag into sibling clones sharing skb_shared_info. Calling skb_header_unclone(skb, GFP_ATOMIC) before updating gso_type (as iptunnel_handle_offloads() does) avoids this for both SKB_GSO_TCP_FIXEDID_OUTER and the SKB_GSO_ESP write just below. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796423662.gi= t.julius@bairaktaris.de?part=3D1