Article View: linux.kernel.netdev
Article #24032[PATCH net] vrf: pull the full IPv4 header on xmit
From: Xiang Mei
Date: Sun, 29 Nov 2026 01:34
Date: Sun, 29 Nov 2026 01:34
64 lines
12931 bytes
12931 bytes
A frame sent on a VRF device with AF_PACKET carries an IPv4 header
written by the user. vrf_process_v4_outbound() makes sure the first 20
bytes are there, but never checks that the packet is as long as the
header says it is (ihl * 4).
With a transport-mode ESP SA, xfrm4_transport_output() strips ihl * 4
bytes from the front of the packet. If the packet is shorter than that,
skb->len wraps around to ~4G and ESP walks off the end of the
scatterlist. An unprivileged user can do this inside a user + net
namespace:
Oops: general protection fault, probably for non-canonical address ...
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
RIP: 0010:scatterwalk_ffwd (crypto/scatterwalk.c:191)
Call Trace:
crypto_authenc_encrypt (crypto/authenc.c:201)
crypto_aead_encrypt (crypto/aead.c:91)
esp_output_tail (net/ipv4/esp4.c:600)
esp_output (net/ipv4/esp4.c:675)
xfrm_output_resume (net/xfrm/xfrm_output.c:562 net/xfrm/xfrm_output.c:597)
xfrm_output (net/xfrm/xfrm_output.c:656 net/xfrm/xfrm_output.c:837)
__xfrm4_output (net/ipv4/xfrm4_output.c:28)
xfrm4_output (./include/linux/netfilter.h:314 net/ipv4/xfrm4_output.c:33)
vrf_ip_local_out (./include/net/dst.h:471 drivers/net/vrf.c:485)
vrf_xmit (drivers/net/vrf.c:537 ... drivers/net/vrf.c:568)
dev_hard_start_xmit (net/core/dev.c:4084)
__dev_queue_xmit (net/core/dev.c:5101)
packet_xmit (net/packet/af_packet.c:274)
packet_sendmsg (net/packet/af_packet.c:3209)
__sock_sendmsg (net/socket.c:818)
__sys_sendto (net/socket.c:2283)
__x64_sys_sendto (net/socket.c:2286)
do_syscall_64 (arch/x86/entry/syscall_64.c:89)
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
Kernel panic - not syncing: Fatal exception in interrupt
Drop the frame unless all ihl * 4 header bytes are present, the same
check ip_rcv_core() does for received packets.
Cc: stable@vger.kernel.org
Fixes: 193125dbd8eb ("net: Introduce VRF device driver")
Reported-by: co+bfd69dd4e073f1e9@bugs.sh
Signed-off-by: Xiang Mei <xmei5@asu.edu>
---
drivers/net/vrf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 79d433f49f80..9453c26aca97 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -496,7 +496,8 @@ static netdev_tx_t vrf_process_v4_outbound(struct sk_buff *skb,
struct net *net = dev_net(vrf_dev);
struct rtable *rt;
- if (!pskb_may_pull(skb, ETH_HLEN + sizeof(struct iphdr)))
+ if (!pskb_may_pull(skb, ETH_HLEN + sizeof(struct iphdr)) ||
+ !pskb_may_pull(skb, ETH_HLEN + ip_hdr(skb)->ihl * 4))
goto err;
ip4h = ip_hdr(skb);
--
2.43.0
Technical Details
Message-ID:
<20261129013404.3192386-1-xmei5@asu.edu>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373327-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373327-linux-kernel-netdev=dewy.ru
From: xmei5@asu.edu (Xiang Mei)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] vrf: pull the full IPv4 header on xmit
Date: Sat, 28 Nov 2026 18:34:04 -0700
Organization: Usenet Network
Message-ID: <20261129013404.3192386-1-xmei5@asu.edu>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1076829"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:cRt6YtPP44QhjXSwr+o5kuIOusw= sha256:0rylUx2+VKrC1jWF1y/P8XgWsbeB9ytzzuURpEqJjvo=
sha1:1Df7fjaSl9riDysiU1l7zelsWiA= sha256:Q3PkOviPR0o7kRAF+oy49IH5lrOZACB52pXTsY8HnRw=
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 2BBF2125F90; Sun, 29 Nov 2026 04:34:24 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.151
X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
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=asu.edu
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 CM39im5u5Ox9;
Sun, 29 Nov 2026 04:34:21 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-373327-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=asu.edu
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
by mail.dewy.ru (Postfix) with ESMTPS id 160FF125F8A; Sun, 29 Nov 2026 04:34:12 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sto.lore.kernel.org (Postfix) with ESMTP id 9F395601160; Sun, 29 Nov 2026 01:34:11 +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=1795916050;
b=ne4wv8HgJ/X9U8Q5StOCutAoyLWgB3Clf83e3P7fv1lki2P2oHIq6kRVk4utoIqSiCv/
T4DPH9izkKqhiUYD1nzPFDuPq8LQPybkfbrcgzkHfN5byGcOn4ntRygmHkwn9jveoV+ul
k6JGJnvOCxEy+gwOpW/kykoNdxlcBUufurriomEYHAZAHzGsvH7DZkYZrbYLQK6iOYdOa
igdjWCRxKZkWIiH7IQrJkr12XHxKpjAaK8WBBj0+4gFraTJvH2PE/zpLH/8E4zr19elkT
AIkokWa0Q7szvOy8Qv//CtttylgHuoYeX3Rc18Y0+fFftLfLMZWEvjw8MK3HQ0V/n9Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795916050;
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:X-Mailing-List:
List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding;
bh=+Gwl2Z78yX471IS+y2sqbobXqnd6K73EuIzPO2z8vg8=;
b=nMBlo9rUXW0yxuBTIYJNTTuB4InUe3HWHtTEcqJmi3eeAWW8ZxRoOX/MmJ3fD4N89fGc
H6TbCXDbYMrR/08/D1OC/bvvOJcNWbGuXUA92prs+fs4iT2W/Op22eGttEL8YWEH7bxGa
X2mIixUHGAUmdX+mwyAmAk75xbPng1GNjw7H9B4Jn0ydXgmP1N6cvDvGdgi5StZiYNg3m
xhtSYJ/uGIgcnku8gyRu3mq1xuAZyFG9pRJ5/8443SqT/uzCMN28t6ryvK46onHVr0Bfq
QgLXxPpOyNQgndMTWERF/rj6/EPyXSy8N5Grm/EeJ15eUBbZSTNwQZDWcZIQVBLXHBA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=asu.edu header.i=@asu.edu header.a=rsa-sha256 header.s=google header.b=VWdGjReS;
dmarc=pass header.from=asu.edu;
spf=pass smtp.mailfrom=asu.edu;
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 63A66606A336;
Sun, 29 Nov 2026 01:34:10 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=asu.edu header.i=@asu.edu header.a=rsa-sha256 header.s=google header.b=VWdGjReS
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.179
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1795916049;
b=I2NnRaUF+Q9Y39CGuRYZhU0CMzF2/E5gHhfIY7VEjDLi9RDqxeifPQLTFaC86rjaERHI
XU5l7kGFh1UfUUCN5lZO/TzJc9XcBzu43ZCwXmDW7WoxaJDeIsY1qnVqC3qY+miZmEDzB
AIWOKvfkbEaaFZYP/+MtelTdJGYCEIC/0cZuAChTdUWYnp6mcimD4hZcoZS2ZusCgUQEV
+msru90VE2ARV2PlpdOvduL/W+2JH5dR7hxI+7a/clcfK2hUeei/pkToFT3D2STEAoRvR
D2XwkJjS5GJGHP+y9jn2RNimRajXoaL/CBClcQqMRg+1SJvey8JrAQSodhr5P9Mbpeg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795916049;
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:MIME-Version:Content-Transfer-Encoding;
bh=+Gwl2Z78yX471IS+y2sqbobXqnd6K73EuIzPO2z8vg8=;
b=sd7VeLBuCi4LjbFDSOR3gnlVLocH0fxvFSq3ul1XgeMsnw7cCLVLA/7kdrUTbhxlHVvT
gywTb8nQi6e2z/DR4TZoIIOALP/EuuKPKSBcMNuwe63iCzxsifsAjprYUWxpWan7A9vec
r0dph2MjQPLLxrgFQyz3swwGbjfhskoOUWjo6gT1c/LI+Cv6gdwTgQFZ6ANMWno39Kdvb
d4DBvU0ySub2EkrEe1JpCub0yaT+jDtnV+9P/AraiSR68oe269lQhkr3iDIO39rPAbGUS
4GgLRBMKSClndOYzmUxI/NxRl0a4PAQNDIoK+zB50BQmYrHLYdDrqNhjGujd6UnrQzw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=asu.edu;
spf=pass smtp.mailfrom=asu.edu;
dkim=pass header.d=asu.edu header.i=@asu.edu header.a=rsa-sha256 header.s=google header.b=VWdGjReS;
arc=none smtp.remote-ip=74.125.82.179
X-Received: from mail-dy1-f179.google.com (mail-dy1-f179.google.com [74.125.82.179])
(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 2E69D606A325
for <netdev@vger.kernel.org>; Sun, 29 Nov 2026 01:34:07 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2E69D606A325
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=asu.edu
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=asu.edu
X-Received: by mail-dy1-f179.google.com with SMTP id 5a478bee46e88-33fb4680717so7693854eec.1
for <netdev@vger.kernel.org>; Sat, 28 Nov 2026 17:34:07 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=asu.edu; s=google; t=1795916047; x=1796520847; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
bh=+Gwl2Z78yX471IS+y2sqbobXqnd6K73EuIzPO2z8vg8=;
b=VWdGjReSpqj9tEWAw2x2dn/hFR65MD4BteQXIa5loEHzgme8AMNzbqi7T7GTUoB8sx
GiSxJWoVxN1edhv/GELmtfuIaxfM+wvs4gPA7MDcYQ2eQ0h4Nuk4oYlohfMY7bU+ERqz
+6MoQOtei2GJR3kX+Obci9Uxjrh2J4axWU/Mjg4fa9ATVNZ8jdd1HzgYKsxohgz6F8BH
cYW/iU2sXN5VxKd7VGnaB0lYWstD9Gyp+/skriWLnoXZHXczx5lHz6owKyf053Ll+CMF
YYGeGWOImj7GsB3PS6/QRv6L5MTYpq0RzKsT7cl1CImCDw4UuBGb2W2Nq91aL5763MkC
vOTw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1795916047; x=1796520847;
h=content-transfer-encoding:mime-version: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=+Gwl2Z78yX471IS+y2sqbobXqnd6K73EuIzPO2z8vg8=;
b=yI0QDfMDmjA2A4C3cgVWGPMa8IUcQss5MjFkZzdUZqnyM8XWqOdIYspwa3wnLYOOfa
rYz0lofzEvVpXKNjZq55BsGvhXgNh/OPOqNMTcbgRy/d1Ci35it2AjltXV3BnXT9jbk7
mXM9mhVopVSiPsh7ST4idgHhaRO1YwNdSxm54ufpGj4cLs7f2fIRqgTtjU0CN0QJ9I0D
QiL5nN6fgrU8H/+KkdPEPps/2OIN2g/OSbpQjxv13Zq9GJSc2ltq57rdloUHH1jfCBJ0
f7tX5xMMmh7X3loOlshb2ZzNvPkih8OxY8q5gVqcnlDT7B07AVu4hjnGtAXFIjpMaqsj
aWdg==
X-Gm-Message-State: APuU4Z+xM/tYmjvnvUNpJvmjGjv9FZ4YHZ0mlPEKpIBCrxGOsWlOwgEv
QupflpEr8JegLybWv6KoA31QgRjm2vsooJ798jnpsLLjTCWlwGsgw5iNW+NFpyQ8OQ==
X-Gm-Gg: AZFdTZd5Hnh3xAHvP92hotKbBM2KlDsxLKXd32nep24GYbVS548qWEY9SWIIyuknglR
c3qyu47UERj8SxcToeSX6Zm0ylsy2bk0IY4rVRHu5EjUfmgQwwdDw0hU0OkhInS7Azhdsalf+3b
4YYKL0rwhdU06e4kkdTQeNOsMA+HEYZiZwajWlSh/da9+ktxBLurt3cVW4JdkIfkW/Lw3we/yB+
8WeChZpi6qzJki7S4tZOo057V8jCDEnqTYwdt5OTIo3MPdf7gGmUnH48GR+kUCxzJn6hYcSkpEW
lXdgtqHWKwqE+40ua8yS7w3CHvF+zduyksk8mc0w+nONFGIi+8QD+U99WstRO472rDYZamPoaBg
V8y3TLAvi8Wl0/rMCGAgUCN92QX3/fpc3et9aAQthgI2dqeWfMslHvptqo6AftsG4fza0MSdBeq
TCda61qOkxZvdc9XtdibR3wGCwrHGtyztXbzFYYrqctFapWjA26bGSbJzBzpamveMcZVyIywFhV
3ikdNQ2tFl0KHZ4l9cam2lmf6pkXzRfEdAMBXgWmFIKlXWmYgJfV9nmUMHUHtimIVkJqaBLIvOg
jEfwC2kIpWKSqoOza1iLEsVZ2T/7pdTMf5UlLW6ibgWY/C0OICGO9J5mjLtHuXcxRONg
X-Received: by 2002:a05:7300:ce11:b0:384:fe97:8ccc with SMTP id 5a478bee46e88-3856fb58443mr31803595eec.29.1795916047145;
Sat, 28 Nov 2026 17:34:07 -0800 (PST)
X-Received: from p1.. (209-147-138-4.nat.asu.edu. [209.147.138.4])
by smtp.gmail.com with ESMTPSA id 5a478bee46e88-38567ea2cc5sm78041065eec.29.2026.11.28.17.34.06
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sat, 28 Nov 2026 17:34:06 -0800 (PST)
X-Cc: netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
co+bfd69dd4e073f1e9@bugs.sh,
Xiang Mei <xmei5@asu.edu>
X-Mailer: git-send-email 2.43.0
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