From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0CD4D282F35 for ; Thu, 23 Apr 2026 08:19:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776932351; cv=none; b=VSzoAtaJr4wGroi7pGNfV0cJeZW82jJ6Oz0Wq7C/FVxKeRHAmb3tvbWXcsYi11KzXniceIKb2Nbd1QxJKV7ffQN8qR4dOBpH4EjDwn3fdIdEJDCKQgYChljF+6LONvsnsPqaINodwKsr/pFfttd6LVRTc9yf7QaJheCqXeDNHwo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776932351; c=relaxed/simple; bh=kfICvPZDPVSD9QYfF9FgrUrY50v6Hg4W4+I23gYyFy0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TRGhHqMEuTsCq3G9Lxk4ASdWfO3M9cgFhFzOfp7wqh4rH8B+6dIKhHDQZYqsDRtLtY7o8A11Uuwr+reAQS5oZNHsoYMOTrzMBt7+8AiRsfZvBs70xIyfhLUQ+Zt2ID2LAHLKNKoGS9H9aggIMwwnMwjPRiU1KufFsF7TNM7zfhc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=BJjzjklI; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=iz50G3cr; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BJjzjklI"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="iz50G3cr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776932349; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iXxT8EijkFiVXC92HQalIcnlNjOggo4M9bQ+pHHzC6A=; b=BJjzjklI2lYSmphYFL9qkAcHdEdPz/31U+oFX8Z4x7udi3U4pWi4zTWXQ9oUlQ+1qZQcT0 HjQlFlFIRGhyrcFJ36QeHgi6UaEX5yUBXT+QszyRP6mS1fhMwWByUYFAHQRhAa6foe3XzJ eIlIPYNrTdIXTP7KhUdbBVnNzGp3IqI= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-483-_HXaNGqqPD2suWNY7O_HCg-1; Thu, 23 Apr 2026 04:19:07 -0400 X-MC-Unique: _HXaNGqqPD2suWNY7O_HCg-1 X-Mimecast-MFC-AGG-ID: _HXaNGqqPD2suWNY7O_HCg_1776932346 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-488ba2f4094so35588915e9.1 for ; Thu, 23 Apr 2026 01:19:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1776932346; x=1777537146; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=iXxT8EijkFiVXC92HQalIcnlNjOggo4M9bQ+pHHzC6A=; b=iz50G3cryWZfXzQt6Oex/7XLq6gk/Ld+YTh4JGR/a8X2xri37DrN7/X8o9EiMnMosx j7sqaLm94lapiG2t25P1RRg8m7o0v/jmXnG1mbhUyn101KK7mHwFE3SPrjinTZJZy5XQ GpsjsajrP++dn1vKt1H8dl6nuj/1KrGSpd92IT0G0gsM+35k1/KVlSHIrCsNTv2ei6ED myRIrZffaUfluoTr6LpmtZa8gBRzV9Tmp2D83AIcSBomWXIZT8DZ0kWz4PjUdYzI9mEi lCYW6KMJGGNgO84dY0NLN45CqfS26XHq7HTYnM83Cf6G+sZYFm7I6vvVcTAmZk8In8sv tp9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776932346; x=1777537146; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iXxT8EijkFiVXC92HQalIcnlNjOggo4M9bQ+pHHzC6A=; b=j6GJZ4WE4tT5iCfJ86oH1KgSQkDxaKve8eFfmw2mIM0AlEb77FYxhoNXlCkeKHAo32 4wmF8vXp7ZWH9nyCU5vm3dZIJdJ4STkn4QgSsevdv10RBXHdyLsXfNfHmaD5gsxdvMue t9BNWHiBm6IvB0hRuVP/qrOWf4KhbmevMHVEfAndVVYhxsL6ty1vUf8WI8Q4e+nLhjFM fxFf+hHEUM/Je9Ku9I09h6W3RvICl3adPOGSwtNSZm/kvLSi4+u1iHORbGwp7NZ5hR6b IEZ5C5BmiLhZEzVak65UTZwB4HQ6OLiJJ6UyxmDU7kEjIHq/Xn9+ZHfT+v+R6X3achMo Cvvg== X-Forwarded-Encrypted: i=1; AFNElJ9ezGiPsiNsCtYu3BPcFp/I6rbnt82LM/7f/akfo9NBIPvPXr9yS8ihYzwyamfIgN5f1PF8lcBiteur1D4=@vger.kernel.org X-Gm-Message-State: AOJu0YyXOevoyGa9XHG3cFNRqofinzpJ+GGiHLI4VOavGmuJHzy2IrVZ XQSse7ifQyinTpj9NQGeVfQPOnLhV7oWM0ufCvh06ReAKXqcAfyYOqf9Md2axnIXHzjTldoiFCp Qdnw+tkfXyZgr9Ia7BD0O6RfhHw+nLM0pFDzQZFmQAj+OkXepyOlOsfpz5xMPg9G7NA== X-Gm-Gg: AeBDiesf2eAoXzZrQBCkysp/q599XrpV4WEaL5BvXXAoPl1/K5ddyp0+g9jdaGUTYmy /o+Jyn0AqIvvtM5Ko3dg5ntV4j3qcMfxI/Oc02/DMaCVYefoTCdA+sT1oHRS8J0DLK5Tm8VcKlK FdMMKCpDCqNsG4V+pfYHljloVxvx8p3i7UPqLx4FTplqUKCYSefFB7GfTzL14GA94oH4Umkxmn6 fo/UScio2CzoHNgq8aUiBvd75yuYWyIdThNZSNi5n3crIgLOzLPDqwbZ1ccrtm7lAK9zzzW9PNB MyhZIaE7Prcl3oSQP67TntstfnqCGNgIPT2rCFxtxHc1Rucrw0IAUsGav7kh+esSeFT77GVX6zL J3rahxWkGW4B0nPitesa2aasvX8LeegSrt+R3jVlN8mLGmFykPAsOH/tfxUmYeEbWi5k= X-Received: by 2002:a05:600c:4707:b0:488:bfc3:efc with SMTP id 5b1f17b1804b1-488fb6e8eb5mr370527375e9.0.1776932346361; Thu, 23 Apr 2026 01:19:06 -0700 (PDT) X-Received: by 2002:a05:600c:4707:b0:488:bfc3:efc with SMTP id 5b1f17b1804b1-488fb6e8eb5mr370527005e9.0.1776932345888; Thu, 23 Apr 2026 01:19:05 -0700 (PDT) Received: from [192.168.88.32] ([150.228.93.216]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4891df9e50asm241951845e9.0.2026.04.23.01.19.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Apr 2026 01:19:05 -0700 (PDT) Message-ID: <4f467b95-d135-4c1a-9f44-09138ff2d592@redhat.com> Date: Thu, 23 Apr 2026 10:19:04 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net v2] net: iptunnel: fix stale transport header after GRE/TEB decap To: Jiayuan Chen , Eric Dumazet Cc: netdev@vger.kernel.org, syzbot+83181a31faf9455499c5@syzkaller.appspotmail.com, "David S. Miller" , David Ahern , Jakub Kicinski , Simon Horman , Pravin B Shelar , Tom Herbert , linux-kernel@vger.kernel.org References: <20260419090817.127334-1-jiayuan.chen@linux.dev> Content-Language: en-US From: Paolo Abeni In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 4/19/26 3:01 PM, Jiayuan Chen wrote: > [...] >>> +662,18 @@ static inline int iptunnel_pull_offloads(struct sk_buff *skb) >>> return 0; >>> } >>> >>> +static inline void iptunnel_rebuild_transport_header(struct sk_buff *skb) >>> +{ >>> + if (!skb_is_gso(skb)) >>> + return; >>> + >>> + skb->transport_header = (typeof(skb->transport_header))~0U; >>> + skb_probe_transport_header(skb); >>> + >>> + if (!skb_transport_header_was_set(skb)) >>> + skb_gso_reset(skb); >> I do not think this makes sense. >> What is a valid case for this packet being processed further? >> The buggy packet must be dropped, instead of being mangled like this. > Hi Eric, > > The reproducer builds a gre frame whose inner Ethernet header is > all-zero. Tracing the skb through RX: > > 1. At GRE decap exit, skb_transport_offset(skb) < 0 is the rule, not the > exception. > > It is negative for every packet leaving the tunnel, including perfectly > well-formed inner IPv4 traffic > because the tunnel leaves skb->transport_header at the outer L4 offset while > pskb_pull() has already advanced skb->data past it. Is it? the transport header is an offset on top of skb->head, pskb_pull changes head only if the header is not in the linear part (and the transport offset is already invalid). > skb_transport_header_was_set() stays true, so downstream > code that trusts that flag now trusts a stale, negative offset. > > 2. GRO repairs it — but only for protocols it knows. > > In dev_gro_receive(), skb->protocol is dispatched through the offload > table. For ETH_P_IP, > inet_gro_receive() calls skb_set_transport_header(skb, > skb_gro_offset(skb)), and the offset > becomes valid again. But for malformed skb, dev_gro_receive just bypass it. So only malformed packets cause trouble, right? > 3. Both kinds then reach __netif_receive_skb_core(). > > So the skb that qdisc/tc/BPF segmenters later see has an > invariant violation — _was_set == true but offset < 0 — that the core > layer has no intention of catching for us. > > My reading of this is that the tunnel decap path is producing an skb > that doesn't > honor the contract __netif_receive_skb_core() expects from its > producers, and that > it doesn't really make sense to ask GRE to parse or validate the inner > L4 in order > to fix this. > > I'm thinking at the end of GRE decap, before handing the skb to > gro_cells_receive(), > call skb_reset_transport_header(skb). My take is that you need to address the issue earlier than the current patch, dropping the malformed packets. /P