Article View: linux.kernel.netdev
Article #9184[PATCH net 1/3 repost1] net/sched: act_ife: encode configured zero metadata values
From: Jamal Hadi Salim
Date: Sat, 31 Oct 2026 19:35
Date: Sat, 31 Oct 2026 19:35
81 lines
14105 bytes
14105 bytes
Reported by shaos <shawnq1@163.com> with a reproducer for the 32-bit
case, which was reproduced and verified in our test environment.
The issue:
ife_check_meta_u32() and ife_check_meta_u16() both reserve eight bytes
of metadata for a configured value even when that value is zero, but the
matching encoder returns without calling ife_tlv_meta_encode(). The
encoder therefore writes neither the TLV header nor its value, while the
enclosing IFE length still includes the reserved bytes, exposing stale
skb headroom contents to the peer.
The 32-bit helper has been present since the IFE action was introduced
(v4.6); the 16-bit helper was added with the 16-bit metadata helpers used
by the skbtcindex callback (v4.9). Both defects predate the oldest
supported stable kernel (5.10), so they are fixed together in this patch.
Each hunk keeps its own Fixes: tag for provenance.
The fix:
Encode any configured value, including zero; skip the TLV only when
there is neither a configured nor a runtime value. The runtime fallback
is unchanged.
A raw TCA_IFE_METALST netlink request is needed to express the
configured zero: the IFE_META_SKBMARK attribute carries four zero
payload bytes for the u32 helper, and IFE_META_TCINDEX two zero payload
bytes for the 16-bit helper (not an absent or zero-length attribute).
Stock tc cannot build these requests; "use mark 0x0" emits no mark
attribute and "allow mark" emits a zero-length one.
Conditions to recreate the bug:
CONFIG_NET_ACT_IFE=y, CONFIG_NET_IFE_SKBMARK=y,
CONFIG_NET_IFE_SKBTCINDEX=y, CONFIG_NET_CLS_MATCHALL=y,
CONFIG_NET_SCH_INGRESS=y, CONFIG_USER_NS=y, CONFIG_NET_NS=y,
CONFIG_VETH=y. In a fresh user and network namespace create a veth pair
and attach clsact to the egress side. Install a matchall filter whose
ife encode action carries a zero skb mark (or a zero tcindex) in
TCA_IFE_METALST. Send a frame through the veth and inspect the IFE
metadata in the received frame. The metadata region is eight bytes but
holds neither a valid TLV header nor a value; it exposes prior headroom
contents. Setting the value to a nonzero one does not trigger the leak.
The namespace needs CAP_NET_ADMIN; no additional privilege is required.
With the fix the zero TLVs are 0001000800000000 (u32) and
0005000600000000 (u16).
Fixes: ef6980b6becb ("introduce IFE action")
Fixes: 6a5d58b67e20 ("net sched ife action: add 16 bit helpers")
Reported-by: shaos <shawnq1@163.com>
Link: https://lore.kernel.org/netdev/20261022144739.61342-1-shawnq1@163.com/
Cc: stable@vger.kernel.org
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
net/sched/act_ife.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
index 2afd68983ece..0e6aba9aeff1 100644
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -50,8 +50,7 @@ int ife_encode_meta_u16(u16 metaval, void *skbdata, struct tcf_meta_info *mi)
edata = *(u16 *)mi->metaval;
else if (metaval)
edata = metaval;
-
- if (!edata) /* will not encode */
+ else
return 0;
edata = htons(edata);
@@ -94,8 +93,7 @@ int ife_encode_meta_u32(u32 metaval, void *skbdata, struct tcf_meta_info *mi)
edata = *(u32 *)mi->metaval;
else if (metaval)
edata = metaval;
-
- if (!edata) /* will not encode */
+ else
return 0;
edata = htonl(edata);
--
2.43.0
Technical Details
Message-ID:
<SER-NSBD.v1.r1.20261030042947-1@mojatatu.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354133-linux-kernel-netdev=dewy.ruReferences:
<SER-NSBD.v1.r1.20261030042947@mojatatu.com>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-354133-linux-kernel-netdev=dewy.ru
From: jhs@mojatatu.com (Jamal Hadi Salim)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 1/3 repost1] net/sched: act_ife: encode configured zero metadata values
Date: Sat, 31 Oct 2026 15:35:58 -0400
Organization: Usenet Network
Message-ID: <SER-NSBD.v1.r1.20261030042947-1@mojatatu.com>
References: <SER-NSBD.v1.r1.20261030042947@mojatatu.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2536077"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:nY/T7fsMvYhH7JlJSF/FxMCTp+4= sha256:ATuRF5G42OSYOKiG6ezCBgIo9rQeQGbRxQYQZRj4kzc=
sha1:ztxY0J+jg7fGoIYOq9C8CV8/feY= sha256:XThebhCkE/vi6s40dbkJMlMF/l7MIt6PW6tKRPhZGpk=
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 32AF9125CBC; Sat, 31 Oct 2026 22:37:27 +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, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
header.d=mojatatu.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 m1FcIg-4DYVf;
Sat, 31 Oct 2026 22:37:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-354133-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mojatatu.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 5B74D125CB8; Sat, 31 Oct 2026 22:37:17 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id C146B27DBD; Sat, 31 Oct 2026 19:36: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=1793475369;
b=5L02uX/EvBdF4XL6UE4B0hq6NZFFI9mbirOyZ7iZ/EydsihthV+Rchw1a1eKwRFsilvk
DiJiAF16dqV5jBAjbljlM5KjNwM8t6Nh0z1Mchq5YO8vNv93KS6Jxe0Wb2UiuZhBuCFuI
4MTDDc1xcvLuF5/EQGGHSV52nV47avjZo7zTpql0O+OAPrnM/GgXHt6ccnx/KSlR/MB+O
3EgnnBYHZUu2u1kIgYFAnBwR9xXyM7LUvoiqOJhZP3rb7z62B9HM4Xi0Xvt/Djf4wM+L4
nmQzQmXcK/8L4O/77v+NvWQj6QcOjzwNegPmQif2f2HX3nO16MS/kfor0qIEyuIiQDg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793475369;
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=AlMMKxFjFmgo4xA9KOQX+hBrUwig6pdgmm/mOHyMOq4=;
b=z0OYBkuFTKGTgKqaVaQeYsVcw+Uxx4sA/G3R5fMEjJhyfsywrwDOfDNWM2lSXtWPtxoR
LUiYBeNn0BnBYak1C31iY+Ho44cbQrdiw3A1l8tJ0RrmtMNzmFplQZ3nQMXdpIa6YXfqX
i5p0Cq0AiJLt2yimXOlGWCtW+PtqJSxbPZA8mVmmd1dtxaPlAKzIQorzUM0lUPcsG0mOf
4Q45vXz7gWjaBMY8f6YETGLR1S1ARyacwJmAyNsGmjG26kTBKoY7ggOBMOiKgzWrenos0
fOBM2fcPGBHwgczqRC71HBYUmJEMVjyE0HFcidWilVpdGTnHn+YTS5WVtFAnqFXfq/Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b="d0hQ/Feb";
dmarc=none header.from=mojatatu.com;
spf=none smtp.mailfrom=mojatatu.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 82C15606A325;
Sat, 31 Oct 2026 19:36:09 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key, unprotected) header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=d0hQ/Feb
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.222.177
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793475368;
b=PSQISqn/WZjWqe6yfDu7u8HZatjfiMiVn3Y2IqsfQz9PMYGzDEksljpdXcpgIxic9SaZ
ObSaPZzeqGPyCA2RynrKGH3u6l1dA8/g3N2EMABCPCV/ILVj2cjUF7m73rUvfIN3DdJ0+
0UphzqaM99qQVypG9Wd8Fut6vdcQx6xFzNDOm1hCLHbLtrXdOBB3LCqoyucA+TjMEyUEo
vQa5sOgpyc7a3wpUH/O7xYeAfZa2nbmOE9r6bwKylbB5JW+K3q39LAbCgIDSKVcy7x/h9
FByqGqVumAclkB0NToTPjfbWrX85XOtcwhSv1jMPIPIEsGnBj26MABEdeLeIUH1O38w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793475368;
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=AlMMKxFjFmgo4xA9KOQX+hBrUwig6pdgmm/mOHyMOq4=;
b=N55KSdLZJcocwtwZqijV9viyUzZi6E5WwZ+x6dsTzbgjAVJEfWijEuCFbV2yLUXcaK9E
e/gbiRYibhdWm0j4lc6Ms0tCRsXF0ABAt+5co7bEoiAm6D1PMs6Nq8ycydQaDn1453bGV
aHjDluTp6VSc/VTNVC1E4zHSgV2P9x/ZsbBux2n4fQwxPFDUIP53FVGXpJ9AAXCaZ4izk
C3eZ1bvOyeTuU8Mh4DmNhrnYwWd52BARRuLKDrHABRfgAqoAFyCv6DRNWW4uva28tRDLd
c2hBmFtLtXmr41mUPki3XPh3ahmTeoKTNuhUiXU5XWLENyLdObyAhxOMlo3QF420F+Q==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=none header.from=mojatatu.com;
spf=none smtp.mailfrom=mojatatu.com;
dkim=pass header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b="d0hQ/Feb";
arc=none smtp.remote-ip=209.85.222.177
X-Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177])
(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 49768606A330
for <netdev@vger.kernel.org>; Sat, 31 Oct 2026 19:36:08 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 49768606A330
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mojatatu.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=mojatatu.com
X-Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-93e6eb77f0bso172074385a.3
for <netdev@vger.kernel.org>; Sat, 31 Oct 2026 12:36:08 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=mojatatu.com; s=google; t=1793475367; x=1794080167; 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=AlMMKxFjFmgo4xA9KOQX+hBrUwig6pdgmm/mOHyMOq4=;
b=d0hQ/Febmr/nIbkqWhqs3plBZGB8DwI12zp+mNMgaeR8/hFG+GhS6Suuuu5hRTDwwh
jPvXI2Or3et9EJG1vSrW4s5ECw8h5gfYlsDlzcZ1HegSGSfV2/WU4bzgN+LwwrlW0SEu
F9Nuur6c58FW1j6aXpK0dIKsyo/1IjD025+w0=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793475367; x=1794080167;
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=AlMMKxFjFmgo4xA9KOQX+hBrUwig6pdgmm/mOHyMOq4=;
b=PexeAvMXsY4U0p0yYoWf0hf1hl11S746XTff1zy4LicXuM4Axj12N23Lzoe+gEUjK9
t9g9DxaTRTmaWjU780XsIlZ9i6A0pqo91RhwD1p+rn8tUKDYRAt8qaE9MvBswoJd3Y9E
I4iAIs9fveNlBn1t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a05:620a:2b89:b0:93f:4d4e:ff6b with SMTP id af79cd13be357-94421585ce2mr951078885a.12.1793475367158;
Sat, 31 Oct 2026 12:36:07 -0700 (PDT)
X-Received: from mbili.tail33bf8.ts.net ([64.203.83.2])
by smtp.gmail.com with ESMTPSA id af79cd13be357-94425abd317sm446917585a.36.2026.10.31.12.36.05
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sat, 31 Oct 2026 12:36:06 -0700 (PDT)
X-Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
stable@vger.kernel.org,
shaos <shawnq1@163.com>,
Jiri Pirko <jiri@resnulli.us>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Victor Nogueira <victor@mojatatu.com>
X-Mailer: git-send-email 2.34.1
X-In-Reply-To: <SER-NSBD.v1.r1.20261030042947@mojatatu.com>
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