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=1796221444; b=rnI1V4kqu10DVXp8QBnSR9JMrkw7krNIgjFJlPsal6eDLB6IqLeLqV2aMP7kjpgrZwHl Hyc6HNNq/l+AfU4R5iwZ4zX+wFFKrmm9DZWMhyiR/ndWOtIkjcUCjHM/9plKY9aHjBM2y VJ8YyfWYSzYyM7IhT/Q/S7m5W/lzywp0Xto5sx34RmJOM4KU7L5mMintFcrOxszC7E7Tz urXmTPtnMZBi2p2tlxLcXsU/ltQyLHfr4WI5Xwz84QtviuxMSU6K4P77KahwR18JFRlJZ 01Uo6xx2AJmmUTaIGnHziE9zYtqGwna5FjZ/ORjfqa8gsd3zUT8Lr+qQtHHVH6jz68Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221444; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=fXf3w1XH+nRLgPXyn+hjnSZp9Rh5XuVscn2iUPCA4aU=; b=Ao4BYDKwOBYntbtXA68eUMJAvUohrDG/BRl1QT9tIRCMOAUCgZjkkMrAD6hpH89NtSHi yqKyu5uCnx7v3kSOTVXwJPwMwFpuErW+r/S8ed3UB2+yyUZIYkhka5o9NHrJ66+9hb7lj JivnZRxig3xehgCFNY6e2nxIQbLACTv/A3dKk49lWtuvk0BsTiPczM97nfuuvF2fc2qFh 2Q69Mx4yWTZ3eBLb5eQ19yP8DnWi7LKYyMdtCtnozKE0dvLYbynINX8Ltv0Vil4M2LZ1M cRDZjbEbsZzhvE/U5//0oThqRRCcvtfA40fqqT3SGwdV4ia844i9HBW2P3alSgDk/mg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=oQPVeuIY; 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 16A48606A31A for ; Wed, 2 Dec 2026 14:24:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=oQPVeuIY Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6859E1F000C1; Wed, 2 Dec 2026 14:24:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221443; bh=fXf3w1XH+nRLgPXyn+hjnSZp9Rh5XuVscn2iUPCA4aU=; h=Subject:To:Cc:From:Date; b=oQPVeuIYJfzcRrYluoeag0Qq9JE8JC0pgRctCsOW1e0cj5MKDxaI6Y4oJaje0+K9J 0mnUHvoPttolXrfe4M4g0UfMgfHVKOiPRdYZNWnZIuq94zwaw9xgt1QefxIpJS0wJg 3+rwhHDyOdczycWZkyOW6neSLEtFvDusy1u76Y54= Subject: FAILED: patch "[PATCH] net: prevent receive header offset overflow during" failed to apply to 6.1-stable tree To: carges@cloudflare.com,edumazet@kernel.org,idosch@nvidia.com,pabeni@redhat.com Cc: From: Date: Wed, 02 Dec 2026 14:49:28 +0100 Message-ID: <2026120228-uneatable-plastic-08e6@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x b10c986f1769287270de248548476f6dc2275d59 # git commit -s git send-email --to '' --in-reply-to '2026120228-uneatable-plastic-08e6@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From b10c986f1769287270de248548476f6dc2275d59 Mon Sep 17 00:00:00 2001 From: Chris J Arges Date: Wed, 18 Nov 2026 08:32:27 -0600 Subject: [PATCH] net: prevent receive header offset overflow during decapsulation Repeated decapsulation can leave skb->data far from skb->head while the remaining packet data is still valid. Since the skb header positions are 16-bit offsets, a later header update can truncate and make header access use unrelated bytes and eventually crash. Limit receive headroom to 32 KiB. This is well beyond the headroom of normal packets while allowing the networking stack to pull enough headers in a single pass without overflowing 16-bit header offsets. Tunnel decapsulation re-enters __netif_receive_skb_core(), so its check protects nested IPIP and GRE. FOU and GUE bypass receive core, so check their IPv4 and IPv6 resubmission paths too. Together, these checks prevent 16-bit header-offset truncation in cases of repeated decapsulation. Report these rejections with the SKB_RX_HEADROOM drop reason. Fixes: 1a37e412a022 ("net: Use 16bits for *_headers fields of struct skbuff") Cc: stable@kernel.org Suggested-by: Eric Dumazet Signed-off-by: Chris J Arges Reviewed-by: Ido Schimmel Link: https://patch.msgid.link/20261118-prevent_rx_header_offset_overflow-v1-1-92a5be55f994@cloudflare.com Signed-off-by: Paolo Abeni diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 6787fcf6ac3e..adc61f5e3e85 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -268,6 +268,7 @@ SKB_WITH_OVERHEAD((PAGE_SIZE << (ORDER)) - (X)) #define SKB_MAX_HEAD(X) (SKB_MAX_ORDER((X), 0)) #define SKB_MAX_ALLOC (SKB_MAX_ORDER(0, 2)) +#define SKB_MAX_RX_HEADROOM (U16_MAX / 2) /* return minimum truesize of one skb containing X bytes of data */ #define SKB_TRUESIZE(X) ((X) + \ diff --git a/include/net/dropreason-core.h b/include/net/dropreason-core.h index fa2fe8990557..903d6a3a0ff1 100644 --- a/include/net/dropreason-core.h +++ b/include/net/dropreason-core.h @@ -128,6 +128,7 @@ FN(PSP_INPUT) \ FN(PSP_OUTPUT) \ FN(RECURSION_LIMIT) \ + FN(SKB_RX_HEADROOM) \ FNe(MAX) /** @@ -612,6 +613,11 @@ enum skb_drop_reason { * itself. */ SKB_DROP_REASON_RECURSION_LIMIT, + /** + * @SKB_DROP_REASON_SKB_RX_HEADROOM: accumulated receive headroom + * exceeds the header-offset budget. + */ + SKB_DROP_REASON_SKB_RX_HEADROOM, /** * @SKB_DROP_REASON_MAX: the maximum of core drop reasons, which * shouldn't be used as a real 'reason' - only for tracing code gen diff --git a/net/core/dev.c b/net/core/dev.c index 3c58db732761..6140fd9d11cd 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6223,6 +6223,10 @@ static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc, trace_netif_receive_skb(skb); orig_dev = skb->dev; + if (unlikely(skb_headroom(skb) > SKB_MAX_RX_HEADROOM)) { + drop_reason = SKB_DROP_REASON_SKB_RX_HEADROOM; + goto drop; + } skb_reset_network_header(skb); #if !defined(CONFIG_DEBUG_NET) diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 9860178752b8..c74886b1f445 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c @@ -207,6 +207,12 @@ void ip_protocol_deliver_rcu(struct net *net, struct sk_buff *skb, int protocol) ret = INDIRECT_CALL_2(ipprot->handler, tcp_v4_rcv, udp_rcv, skb); if (ret < 0) { + if (unlikely(skb_headroom(skb) > SKB_MAX_RX_HEADROOM)) { + __IP_INC_STATS(net, IPSTATS_MIB_INDISCARDS); + kfree_skb_reason(skb, + SKB_DROP_REASON_SKB_RX_HEADROOM); + return; + } protocol = -ret; goto resubmit; } diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index d332ec60f915..6dc1211eade6 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c @@ -479,6 +479,10 @@ void ip6_protocol_deliver_rcu(struct net *net, struct sk_buff *skb, int nexthdr, ret = INDIRECT_CALL_2(ipprot->handler, tcp_v6_rcv, udpv6_rcv, skb); if (ret > 0) { + if (unlikely(skb_headroom(skb) > SKB_MAX_RX_HEADROOM)) { + SKB_DR_SET(reason, SKB_RX_HEADROOM); + goto discard; + } if (ipprot->flags & INET6_PROTO_FINAL) { /* Not an extension header, most likely UDP * encapsulation. Use return value as nexthdr