Article View: linux.kernel.netdev
Article #12377[PATCH net 1/2] ipv4: unshare headers before recompiling IP options in ipv4_send_dest_unreach()
From: Eric Dumazet
Date: Fri, 06 Nov 2026 23:43
Date: Fri, 06 Nov 2026 23:43
43 lines
9526 bytes
9526 bytes
__ip_options_compile() updates Record Route and Timestamp options in
place. ipv4_send_dest_unreach() can receive skbs whose data is shared
with clones (for example TC-mirred copies), and pskb_network_may_pull()
does not unshare an already linear IPv4 header.
Concurrent link-failure processing of such clones can therefore change
an option pointer after it has been checked. For example, a Record Route
pointer can advance during fib_compute_spec_dst() (called from
spec_dst_fill()), causing the following write to overwrite the next
option's length. __ip_options_echo() then trusts that length when
building the ICMP reply, which can overflow both the stack reply-option
buffer and the cork-option allocation.
Make the header private before recompiling options, as ip_rcv_options()
already does. If the copy fails, do not send the ICMP error.
Fixes: ed0de45a1008 ("ipv4: recompile ip options in ipv4_link_failure")
Reported-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
---
The issue was found by an AI code review agent. It was not reproduced,
and the fix was only build-tested.
net/ipv4/route.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 3a90c8d28b940bf615c165d9b30ac634943586e1..4d8fcc95c2f460585437b1f6fea4e4fd11d3a2f6 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1269,7 +1269,8 @@ static void ipv4_send_dest_unreach(struct sk_buff *skb)
memset(&parm, 0, sizeof(parm));
if (ip_hdr(skb)->ihl > 5) {
- if (!pskb_network_may_pull(skb, ip_hdr(skb)->ihl * 4))
+ if (!pskb_network_may_pull(skb, ip_hdr(skb)->ihl * 4) ||
+ skb_unclone(skb, GFP_ATOMIC))
return;
parm.opt.optlen = ip_hdr(skb)->ihl * 4 - sizeof(struct iphdr);
--
2.53.0
Technical Details
Message-ID:
<20261106234313.2537882-2-edumazet@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358239-linux-kernel-netdev=dewy.ruReferences:
<20261106234313.2537882-1-edumazet@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358239-linux-kernel-netdev=dewy.ru From: edumazet@kernel.org (Eric Dumazet) Newsgroups: linux.kernel.netdev Subject: [PATCH net 1/2] ipv4: unshare headers before recompiling IP options in ipv4_send_dest_unreach() Date: Sat, 7 Nov 2026 00:43:12 +0100 Organization: Usenet Network Message-ID: <20261106234313.2537882-2-edumazet@kernel.org> References: <20261106234313.2537882-1-edumazet@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="4003532"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:CgT5yLETqNUI+jqbzKGupKye3bU= sha256:l5RIJ9Xj+TL2IWiTxpC9v99FetwU15BIm9bHd28uGX0= sha1:jqvkeDG9RluRwmNunu5R1Px0buw= sha256:YBNQm5EKFLzD7HVYc/v1kEGbdzNShlynUWMYVRZINkg= 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 4FA23113356; Sat, 7 Nov 2026 02:44:03 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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=kernel.org 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 E7uhqpDqQXhX; Sat, 7 Nov 2026 02:44:00 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-358239-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 23FB2113357; Sat, 7 Nov 2026 02:43:52 +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 77A772A878; Fri, 6 Nov 2026 23:43:30 +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=1794008609; b=gAQ+5IR1H7HH+cXffaHc0YP19fggEG8u2PdEd89cBAczTHspxAsR3+8wdJlwc50Ha8u+ 3EGf0g1BWAGto/t2P/D0MY9kdLCrgN1ZpptNUw1PLDTaOMw6Dnvnl0SfprkB52P96Cwuf eHt3gJB29nr9EE+QARMSpQyg/bAu0QknTyWHJhCbmNxKlyw9mPsVaKpz82zAQx5cSsbrN I/VouClGBwt7f/ZUQkhQuiKvKfOwet2xFwy+KhFopd9SsNx43MFT5qs/P8IH8wnJuDHGL VZfTiMV959FMrUCWWJnLarwDyDnnBKCEU1pDQKiSS7yRWx8UW10FyOVIilBFokb3ytg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794008609; h=X-Original-To:Received:Received:DKIM-Signature: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=9Uc9ujiAJcEN2LTqEw0E1qXlp9Q1RJ8VZbRCmeOuBn0=; b=hpU0sMVVe7104XzLVaGdkQTVydggSHxP2q8+uKbiEdZQd5CdRrpi/fg0trYBJR1P0G5r rr466lUdwSsno8wS30q7cfz18IMBnGBLFAG+YpLadWtv0bTIGwry2zuy7pStHNxHf/DSf FQIhbt2ODCBEuKkxHVQ+9Zeie/mN2BMkwG5HgJxDUbCF7NyghiQIXgZFdVhCT6EyxiOxt DYcWwFTn7kVpZ8Xr5Pt7BWvAO8nBATJhzsN/sUPwaMJWYQK4H+cFoBS6Y3gsJByjw2ycY /X9vbwb2pEyg993zZ7QgBLbY/Vg2P08azbz871WXpLMiILQtFKnE1bLnFh6cym04iGw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QdAWfGxx; 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 98A69606A336; Fri, 6 Nov 2026 23:43:29 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QdAWfGxx X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794008603; b=Ngw1O0qcodzEI5sKO9NXX8QB1xgHoCAxumKPNYMUNPgWDmg5j+mhfppAU8o3VWlVPRCb UuMY6KLl2UxfhJyUIq5LRReMu0VjpUd2LCzYNLfNzKQxiu9SgaWpC3YG7ItTLZT/7tD9k 9l+R1SqJ94/BRmWlmNkPYmC1swT7e3QTXRUi2D7dDAI0qj4AKALtG1jB5kLl7MQxJ96Ja kVDROzF3nRQZUCk1q97BpqCayBRXR+FciMe3mH4JYrYv0J9QxxAcDg/Jhs2YSvn3dfl0U RhZKcsduWwl/xJCFI0wEMV9bQqdyZS74mdoI4tY1lTZNv99JuFhpwUAAAW118OzcIfA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794008603; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=9Uc9ujiAJcEN2LTqEw0E1qXlp9Q1RJ8VZbRCmeOuBn0=; b=SNDCZ5ov47Hc69UqFuyV6kSr3kK+GCgrTMH2UHvJGCSGsOMnhW6XjvcXc8gION9gNajx Tb802kSIJs23QkGpahorQMDX5Nnt8f/4mXm1/Jh/hj/08XIPvyTjEgJcscHfp+UPcdGnB FLyk0nL9FUJY01Nh+oRBIuUlTCNRVAMD77aS7B8t4jworYhdycUIc8PTavj2vfXbV1d9g YrEAB7zKO6GI2cJxaZ7pC7aTikRuODbnBoZylDmZ1BQEN2IBQIH5f5Hw+dyUvk/snD61f dh2nJCryChtobbCs0nihy56JpEJoC7tjazdx9l476ZHZyeG0sMsdP67l9KT2ZW2L4vw== X-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=QdAWfGxx; arc=none smtp.remote-ip=100.103.45.18 X-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 6F119606A32E; Fri, 6 Nov 2026 23:43:23 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9764E1F0089F; Fri, 6 Nov 2026 23:43:20 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794008602; bh=9Uc9ujiAJcEN2LTqEw0E1qXlp9Q1RJ8VZbRCmeOuBn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QdAWfGxxKAMlGtEOD8rKz64Eq8It75VoWtmqflYlsi7jbnI8bZWLwEM0LW0YbonXo pjmpPTrz4eBxoa2yMRi0h16GStB8uCLp7AvmgEilvKFQLYszE0Gdl5ukKXNrsMNS2d VEj6WbZhOYz7EozZqOv+1w3VUUuttxS1ouS9cwCGVhERKXf4OmzUpv54ASkZRx8M8H r4nu9UfpKsrid/jwHCLkkFiFWVpnneVOrT9S8MX/55BkhI9VARuPO7tx68FES3Ugef FBI6M97R3e6UIxKXQPq+9zH03yEyvur/goXzx5SDavxxbxG+MzQ1AJwRy0bg48tEp7 MIBE/z9fgE6CQ== X-Cc: Eric Dumazet <edumazet@kernel.org>, Simon Horman <horms@kernel.org>, David Ahern <dsahern@kernel.org>, Ido Schimmel <idosch@nvidia.com>, Paul Moore <paul@paul-moore.com>, linux-security-module@vger.kernel.org, Kyle Zeng <kylebot@openai.com>, netdev@vger.kernel.org X-Mailer: git-send-email 2.53.0 X-In-Reply-To: <20261106234313.2537882-1-edumazet@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