🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21458

Re: [PATCH net] udp: gro: do not match tunnel-processed and plain packets

#21458
From: Aviral Srivastava
Date: Tue, 24 Nov 2026 01:38
62 lines
13924 bytes
Thanks for the review. Both points lead to changes, I will send a v2.

[Medium] Fixes tag covers only the out-of-bounds read

Agreed. The port match through udp_hdr(p) dates from e20cf8d3f1f7 and
the merge does not depend on 4b0ebbca3e16. I checked it on v6.6.162,
which does not have 4b0ebbca3e16 (arm64 QEMU, KASAN, netns over veth):

- vxlan with inner TCP, UDP_GRO socket on the port, plain datagram
  with the same outer TTL, TOS and DF as the vxlan packet: 2000 of
  2000 datagrams end up inside the inner TCP segments on the vxlan
  device, none reach the UDP socket. No KASAN report.
- Same with consecutive IP IDs and no DF: 2000 of 2000.
- Same with the plain datagram's TTL off by one: 0 merged. Differing
  ports, no tunnel device, GRO off: 0 merged.
- With the v1 hunk applied to v6.6.162: 0 merged in every case, and
  UDP in vxlan/geneve still aggregates.

On v6.6 the L3 gate is the flush/flush_id state from 5babae777c61,
computed on the two real outer headers, so ordinary header values are
enough there. v2 carries both tags, e20cf8d3f1f7 first, and Cc: stable.
The hunk applies to 6.6.y, 6.1.y, 5.15.y and 5.10.y as is.

[Low] encap_mark is cleared by FOU/GUE

The observation is right and the comment and changelog in v1 are wrong
on this. I do not think an is_fou comparison is needed, though:

- When FOU/GUE carry IPIP, SIT or GRE (or vxlan), the inner handler
  sets encap_mark again and the transport header moves to the inner L4
  header. Those are covered by the v1 check: they give the same KASAN
  report against plain UDP before the patch and none after.
- When FOU/GUE carry UDP directly, encap_mark is 0, but nothing moves
  the transport header or the network offsets, so udp_hdr(p) is the
  outer UDP header, the same layer as for a plain packet. A plain
  datagram with those ports resolves to the FOU socket itself in the
  GRO lookup, so it does not reach udp_gro_receive_segment().

I ran held plain UDP followed by FOU/GUE-direct UDP with matching inner
ports, and the reverse order, with a wildcard, a single-tunnel and a
connected FOU socket, with a UDP_GRO socket, rx-udp-gro-forwarding and
rx-gro-list: no cross merge and no KASAN report, with or without the
patch. The only merge with differing is_fou I could produce needs the
FOU port to be deleted while a packet is held; it is at the same header
layer and in bounds.

v2 keeps the code and rewords the comment and changelog to say what
encap_mark guarantees at that point.

Separately, UDP carried directly in FOU/GUE never aggregates in
udp_gro_receive_segment(), because the inner header is compared with
the held packet's outer one. That is not a regression and not changed
by this patch.

The v1 notes also said "28 and 29" KASAN reports. That was the dmesg
ring limit, the console logs of those runs have 1023 and 308. And the
changelog said the merged datagram is not seen by the forward and
egress netfilter hooks; the hooks do see the aggregate, what is skipped
are rules matching the datagram itself. Both are corrected in v2.

pw-bot: cr
Technical Details
Message-ID: <20261124013804.96778-1-aviralyash27@gmail.com>
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369942-linux-kernel-netdev=dewy.ru
References: <20261122183951.73210-1-aviralyash27@gmail.com> <179545921450.3135.6404804724515356262@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369942-linux-kernel-netdev=dewy.ru
From: aviralyash27@gmail.com (Aviral Srivastava)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] udp: gro: do not match tunnel-processed and plain packets
Date: Mon, 23 Nov 2026 17:38:04 -0800
Organization: Usenet Network
Message-ID: <20261124013804.96778-1-aviralyash27@gmail.com>
References: <20261122183951.73210-1-aviralyash27@gmail.com> <179545921450.3135.6404804724515356262@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="4027634"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ZR8JYYD42KL24MjVxb/F6eSFbVs= sha256:MpYJu5QxgsMPJP3xS45FdhIUSbVLBDkyi4PZPvg5LbI=
	sha1:mElgfGR2xv2rOLqV4UjjSVUTPso= sha256:Zw9aFf6wQfaNxxBAhYVI5kRzV26raAQ2Rx9W15LiUd4=
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 913F0125DC9; Tue, 24 Nov 2026 04:38:31 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
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 dUGjV2VIBCdz;
	Tue, 24 Nov 2026 04:38:28 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369942-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 3C4BB125DC8; Tue, 24 Nov 2026 04:38:19 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 59DB1334A7; Tue, 24 Nov 2026 01:38:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795484297;
	b=BEvtdqj3K5K6OfUEf45gKBf3b3no62deCrYUNAEaIIryMgP/vtXHqR3vw9rZFuHMw/67
	 LdqUUKoXEyFyOJa09r5n/rjMBUAAAcmbBec7UwArR5eEEok34pYj5aJ0zV7no2iEbb3im
	 tRFrRkfaRs/in0N/sEFkBQkVLDLa4+BGatoW2/8Mfu8o6dkx21Vir3afHtzQ9zvCVAud9
	 UPAzWzRw4NIluIFGlS8Fa7IO5K5wLl2quZBrwdwflH6DLdOKbfwQLy/BpPUvAGl5U5ixo
	 eDMz+/hZJbpUr8A41iK6TWM/FIc+GfID/B4N7d0p31dMcDwQEx0/iQzISK3qhui9urQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795484297;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=9ttHp2mukC/tGMOBmjKlOmnQPb5GQ9cwK7fnwbrYrro=;
	b=nlpJ5lNDUfTKoGImJMsk1gN3KFKbFDh/BVRPNqeUW0aHPiYlJvCTMR949L/hPKDnrwyu
	 0uqhcrR9nQsQt3xh9knbC/RsNfIfUeV7sW+xtWsuPSNmfTgWCtPGUPshqpCC2/BURimRz
	 9UD9UsxyguvNbVNgug6I1AJbMr5wlCHgC3MQys+e7oS1Y5K877hQrz/xzeFXNPexXj0eD
	 vou03GBwovIFxYy23iW7IocQEH1pEEjDLdSKH3IfwO4/VJ4a5dKTiFrsDkXZNy/drF0Yn
	 AEfJlhs0f3UpngpDk/VCDWE1O8NpkA3v46gOnJsmhR33pOVqhP3wL7i7ewlPK6OB+oQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=HalbCFD1;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 3142D606A32D;
	Tue, 24 Nov 2026 01:38:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=HalbCFD1
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.173
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795484296;
	b=3szaKUcx7KEhD/x/p/vYY7zgKNFOJykcFHjNVUOnVQChUVcxr+q0zf7atr+wzNXDKdxt
	 oq/yloBoDLyeOzf7YoLGGWfx0XloYSJ2WOdgSJDicMNIR8m/0fmmb3pO7M92WzEzG8UBv
	 ALeg0cM48+7c/mKx0lIdcB4cKxB+w9sgG3CqwJDvPt947T3RF8rRLoqFlXoVlPyCaqtbB
	 E2j7gYFP4u3jg7DgIupZpyeOD0q8coQoZArS20yDMO6Lf75KOHKqf1sXxh1spax55uA62
	 MC5wcQFoTb4UHz9yqVXY6Nkzx49TUpHmMf1SwhtVlRhzfW6qXKLwo9PzlxssxlJZtSA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795484296;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=9ttHp2mukC/tGMOBmjKlOmnQPb5GQ9cwK7fnwbrYrro=;
	b=pDWGNPeJNQ2oIa+ij2+KzI6zVf6h7nwaBPr7e9P0APlVPGcHZUJgHYV5igmKDw6G6H66
	 0PQUTYYTA3iAmIokQVJHCmeFlr3VF2Wu12cF9xJxdM7Itclts8RuzQqIYi1HuoxbdwY75
	 54LoovoX/wD8xT3Lq5z4JF6+eISvdDBKL5MnPvXHC/1zjyBxQeWVD0qH9k2HrfN1ubEL6
	 RClBtROM8L5M67ZKofXxvZBGMhsnyHvfS9r59lwYYuRuR0Zjw+O0BBDacWnSwffiYkw9d
	 +KgNEnDh4Cgli58OxGxlGuiZwyFcTtxVOJOaxyc43eEawYTTJb5yg4CTp6N8twWrBdw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=HalbCFD1;
	arc=none smtp.remote-ip=209.85.128.173
X-Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2BBA606A31E
	for <netdev@vger.kernel.org>; Tue, 24 Nov 2026 01:38:15 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F2BBA606A31E
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-8b4c685c751so34091737b3.1
        for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 17:38:15 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1795484295; x=1796089095; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=9ttHp2mukC/tGMOBmjKlOmnQPb5GQ9cwK7fnwbrYrro=;
        b=HalbCFD1Lw2UXPOv9DcbVAZIgTEpte5A7w0gB77Ia2AhhvTFnr+Cavmw04K6IXkBis
         gK/IW/J4QWjG1qGtWv6eIxLs0IhA6CR6s/oKp9ufURlCQcxuI6uDqx6DvLgI53F9E7aY
         m4c4zLFVzR5BW4DG5w+DBrp8KQ4VulJq2ihZ4T+ovhanQdgKA1SzBBVbcxPyv234pXhR
         YQBVwVjB5p5L5KgA0AffA2ScuCMwuul7g3vv26euOWsnMD9GmsT+grXBZDZZkaIV21Gh
         g0EQPgOTVAFOMQhJw22qn0uXQJzPOrGhFz2ka3EBMQcSNSp4eqjzTNb8vwFzinaH9ap+
         dOug==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795484295; x=1796089095;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=9ttHp2mukC/tGMOBmjKlOmnQPb5GQ9cwK7fnwbrYrro=;
        b=dAFY6DVT6lxT6YWOulUee9SuhdQYnC9dQEei7qHaXfdqDM4jcTGDElt4gq7/zEmzKL
         16J4W0iSb8SC1vLnOLbV9XSDE6+F6PaLE5Z+qktelw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
	EzSdJuSKhmygcAr8HxljRu6G2HVx7rhK9ARZ3GKoiUlketqX94t0l+9WF9OPPlfvkQMU+SLpqMD
	UHSNhIE5SgQNg7txCvVRIgvd32
X-Received: by 2002:a05:690c:4a02:b0:8b0:f1c0:60b1 with SMTP id 00721157ae682-8b5204a7d4bmr41571617b3.60.1795484294996;
        Mon, 23 Nov 2026 17:38:14 -0800 (PST)
X-Received: from localhost.localdomain ([2600:1702:7bd1:1ca0:6d54:522c:b8ac:678d])
        by smtp.gmail.com with ESMTPSA id 956f58d0204a3-67df3353258sm6455451d50.9.2026.11.23.17.38.12
        (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
        Mon, 23 Nov 2026 17:38:13 -0800 (PST)
X-Cc: netdev-bot+sashiko@kernel.org,
	davem@davemloft.net,
	edumazet@kernel.org,
	kuba@kernel.org,
	pabeni@redhat.com,
	willemb@google.com,
	horms@kernel.org
X-Mailer: git-send-email 2.55.0
X-In-Reply-To: <179545921450.3135.6404804724515356262@kernel.org>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list