From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=182.48.54.220 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796180806; b=29zd3l+2puIker7WV9S1X5xcngs/+czabH4hGb95GDPPiqPtSWeGkrQdfZMgl3Iqf5/b SF+GlTyXfCMn4GijkDBCo9DegNyMiKWNRh2E0UTqVRSpnlEIlvl+Kgd/MbCk161hXrdQi ixd4R3np1y7mqE0NCVYWLJGAJ40iKkUIkdUh/H7gK5XcCOa3FbcSt0XxsKNN/30wBQQ8f icp9LLVq4l35yAkq6Sjc7xMii6hk2wnhQb4Hd36OLpYQgpRI7f1jwh4rAUiBX9i9vbtyW dZgfrrpMkGdY1exJ41zBZbY6LhBPEuN9n/KHNGnBIr+5oky2UI0TPwpGc/g61bxGsgQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796180806; h=DMARC-Filter:Received:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:Date; bh=FMmPuRD8yl17K8dhGb0MUwrYjJNV3GeHqlrpFEmy5jY=; b=nUvPUjvT2mz4z2VqQWYsVzm3UBjDZ3G8NvLklH/zURqIWDJIjGd3pAhBgKhKGfzEKWWO b00/8koSDHZGrjXUhq48rnNgxbLBGkFwRr2xXuv1M/QKOwiE+YU3qH5gkuMjO3y6lvuqk 1jKGMHISUQcOHC/miLHqtLNRSsnCT84tb4C8xFWsGpgwS7BH85ezmcTzXPxCAV0FxqqBa BXkftZYG+JNjiKKp4UWrC71bCcLCXcQ/CiGuvQVIrxd/BNxeoGMp9EqVFymHoFu/Rm00R GNF/jfTQuasyWiIgGw9gLQ+JIYy1CkwdM48DrxzPLk1CKGXEFIUZ40k7U6u8fzIeBLw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=snowrabbit.org; spf=pass smtp.mailfrom=snowrabbit.org; arc=none smtp.remote-ip=182.48.54.220 Received: from bambi.snowrabbit.org (bambi.snowrabbit.org [182.48.54.220]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 447B8606A322; Wed, 2 Dec 2026 03:06:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 447B8606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=snowrabbit.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=snowrabbit.org Received: by bambi.snowrabbit.org (Postfix, from userid 3001) id A8BA4C92FA; Wed, 2 Dec 2026 12:06:38 +0900 (JST) From: Showta Ishizaki To: "Michael S. Tsirkin" , "Eugenio Perez" , sashiko-reviews@lists.linux.dev Cc: virtualization@lists.linux.dev, zakinko@snowrabbit.org Subject: Re: [PATCH RFC net v8 4/6] net: resolve uncommon partial checksums at ingress In-Reply-To: References: <20261126.rfcv8.99797.0.zakinko@snowrabbit.org> <20261126.rfcv8.99797.4.zakinko@snowrabbit.org> Message-ID: <20261202.rfcv8-reply.4.zakinko@snowrabbit.org> Content-Type: text/plain; charset=utf-8 Date: Wed, 2 Dec 2026 12:06:38 +0900 (JST) X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thanks for the careful read on patch 4 -- both are real, and finding 1 was the one I had underestimated until I measured it. Finding 1 (has_eth taken from dev->type, which TUNSETLINK desyncs): fixed. has_eth now also requires dev_has_header(skb->dev), so an IFF_TUN device turned ARPHRD_ETHER by TUNSETLINK (which has no header-create op) is treated as having no link-layer header, and virtio_net_l3_start() reads the L3 header where packet_snd() actually put it. I did not want to take the retention on faith, so I reproduced it. On a TUNSETLINK'd tun I sent, through AF_PACKET + PACKET_VNET_HDR with csum_start=34 and csum_offset=6, a frame that is a genuine IPv4/UDP datagram at offset 0 but whose source-address bytes also read as a header when the first 14 bytes are taken as Ethernet: src 8.0.69.1 makes bytes 12-13 read as 0x0800 and byte 14 as 0x45, and the UDP ports (0x4000, 0x4011) make the bytes at offset 14 parse as an unfragmented IPv4/UDP header with its transport at offset 34. A kprobe on __dev_queue_xmit printed skb->ip_summed (3 = CHECKSUM_PARTIAL, 0 = NONE). On the series as-is (v8): csumprobe: crafted ip_summed=3 csum_start=50 csum_offset=6 csumprobe: legit ip_summed=0 csum_start=36 csum_offset=6 and with the has_eth fix (v9): csumprobe: crafted ip_summed=0 csum_start=50 csum_offset=6 csumprobe: legit ip_summed=3 csum_start=36 csum_offset=6 (csum_start is from skb->head, 16 bytes of headroom ahead of the real offsets 34 and 20.) So exactly as you describe: v8 retains CHECKSUM_PARTIAL on the crafted frame with csum_start at offset 34, pointing into the payload rather than the real UDP checksum at 26, and the mirror image shows the same desync from the other side -- v8 wrongly resolves the plain legitimate frame because it reads it against an Ethernet layout, while v9 keeps it offloaded. The fix settles both. My first attempt did not retain it, which is what sent me to build the frame above: a crafted frame whose source address does not happen to read as 0x0800 fails virtio_net_l4_start() and is resolved on v8 too, so the retention needs the header-shaped bytes you point at. Finding 2 (skb->protocol set after validation): fixed. When virtio_net_l3_start resolves the protocol from the header it now records it into skb->protocol, so virtio_net_hdr_set_proto() can no longer override an IPv6 frame with ETH_P_IP for GSO_UDP_L4. It needs a device with no header_ops->parse_protocol (tun has one), so it is narrow, but the guard is cheap and the gap was real. For regression I reran the 35-case flow-match matrix (OVS 3.5.0): v9 rewrites no matched header, identical to v8, so neither fix disturbs the common paths. Showta