Article View: linux.kernel.netdev
Article #9397[PATCH net v2 1/4] net/sched: act_ife: encode configured zero metadata values
From: Jamal Hadi Salim
Date: Mon, 02 Nov 2026 00:37
Date: Mon, 02 Nov 2026 00:37
82 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 3946a9589bb8..6b23a3965121 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.v2.r0.20261101171325-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-354385-linux-kernel-netdev=dewy.ruReferences:
<SER-NSBD.v2.r0.20261101171325@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-354385-linux-kernel-netdev=dewy.ru
From: jhs@mojatatu.com (Jamal Hadi Salim)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 1/4] net/sched: act_ife: encode configured zero metadata values
Date: Sun, 1 Nov 2026 19:37:03 -0500
Organization: Usenet Network
Message-ID: <SER-NSBD.v2.r0.20261101171325-1@mojatatu.com>
References: <SER-NSBD.v2.r0.20261101171325@mojatatu.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2807692"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Yx32zJ4J/W6Q2lha0Q5s1jVWqWU= sha256:OT+/zJsaQPELeZFxnvFAIMMI5Go2ix1FhOMzDFDKvWY=
sha1:YbIZ4yAHmq1gP4E3Cigs28UqQbk= sha256:eVwk+vEdO2lLErSaJwfbSbxdo/1xkZFbxHmdSACrDZo=
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 3D79A1123D2; Mon, 2 Nov 2026 03:37:53 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 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] 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 eRE9vEtTiMn2;
Mon, 2 Nov 2026 03:37:50 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-354385-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 171401123BD; Mon, 2 Nov 2026 03:37:42 +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 E7CFA27C9D; Mon, 2 Nov 2026 00:37:20 +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=1793579840;
b=cH9qXwRVtgZ5psHa67joq8Z78PYJ53qLKueoIzQ3gsX8S/o8n13YiegnUJh5SFPSaIwu
arLLeild1DeRxZrOOBzRanaUAQzyt82QPb/y/3RsLdUoiyE1YJ0sVgJlsh8skGFakPjOR
aaN8OAWSqis2jOdGaWfslZ9rFuUtQIAgAmQXADPMd1IYE/78nb6IV28plPhLhLvfldB9c
h1AgiXTAtBFJn17trw9ksIXipXhLH3FbKyqf2Nyyub6xcjEfLOo9CIa145K2NTPKh7vv4
Q5qtFUeGsU/2A3xbnYuT6hVJpEpFDHbnwTbfHY7s61ULxP6p/qIpxNtnYBnemtIUtUw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793579840;
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=6KogHPxXZesrjjVkrlJVMb4Eo3ELPLnD2xsloqw8RZM=;
b=BNIKIx3iw9xz9T6BOfXsfEdHrc46++pw6nsSARLDTmEeGpR1UDL30EwG2ZtLffcLcd73
Xhm7OGETViBQJEUgrloYfRE4p05QpRuzewds2BZZwyk8dfDpjJXY/FSYBBSJLxUt9ssb1
sNFnkYfapagvAvY8KdU6ehDemMB+xB/0I+5EuYzxe9QVeo5z8Dc+KxZYpKJtfiBkyg4lL
O3hbILtntfCL6n5h5AD0AOV1X5LxR1DYAHXW5JgirHKJKu6SdnCHamU/qx1MsHbvqkcry
EzMSWAyAhnlmox1m6S4rjAPrD9vAGXLj1D+h/ED+vErakDDXujc59gK0/jcdHWJ1BKA==
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=cqlHdd19;
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 0E5DC606A32D;
Mon, 2 Nov 2026 00:37:20 +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=cqlHdd19
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.41
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793579834;
b=Z7sSY4bFWpg5FeyfCed8LrF+wzyTS0gMRWFr9qF56IVDJUlXQ0NYEn93CGRKJ/YGNaX2
847GVAlqzmYzhXwRlelsfWiUf36i6PhlJ41EbuKGMEKLWSRmv+ReVydqUn2Vtd0jsCao5
Wf4cdDMV5YrKpK5RJTsMUozm8z/P5xsYibp6vWY51En/786pauTHmiRJoTe5XVJNDyiAW
rzVhjQ4mljSiQcZ++FmEVklK2dgZLwqIsGfDtfNs2Hp4iukI79VU+x+T2PWmFiCx91ffh
dQBfnoJS+8N6+Zrkw7OBpvJFQyuYzVk1aJCi7+emR6A+2Gr2Ox2gJ776OsSHCHCuFVA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793579834;
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=6KogHPxXZesrjjVkrlJVMb4Eo3ELPLnD2xsloqw8RZM=;
b=PWc3jjdFgWAySjOtbamm6iW7nA92jeedYW1tmKCHuJdDHqICojqn+DSdVC5HSbdCofOD
YeK1RrRnKD6Pfz5BxExaNaxTQoR07KfxchG/S497pGdrgx2PteiSQi0sJabkVcatkED79
WJBNlhT0+8MRtue/W3NZuNIhw52uf0mWmnvLtiOur/E0zn1LeZtNImAD2pleTJW8OTMZh
ikxFKGo2g4gyB0pLACWm1ElsNLQArJ6rdbGWjOqbqr2WyWu4GXiUAiLPSwcE3UEtrR2rn
/kZl1MlCCwuvxfNRySyDcDQXyE7+fSpVIBU9qzLdS7Oj00f7E6x+ElP5p/9l/2ddCrQ==
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=cqlHdd19;
arc=none smtp.remote-ip=209.85.219.41
X-Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41])
(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 C6BB3606A334
for <netdev@vger.kernel.org>; Mon, 2 Nov 2026 00:37:13 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C6BB3606A334
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-qv1-f41.google.com with SMTP id 6a1803df08f44-91c79a9a739so40194146d6.1
for <netdev@vger.kernel.org>; Sun, 01 Nov 2026 16:37:13 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=mojatatu.com; s=google; t=1793579833; x=1794184633; 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=6KogHPxXZesrjjVkrlJVMb4Eo3ELPLnD2xsloqw8RZM=;
b=cqlHdd19IIRGaf3lGxatlIyX1riEouhuFUnPqZYVXG0a3svGrr34ocv1h19tWrNIUB
myfwN4CY1vhyAkJMLVP13CyAvDx/iAxE8Nu15187ANtPU8WMcOaXhCetV7yvbsoUbuBQ
YH6svszhVEibUdivohKdUBiPgMInmoAupe6XQ=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793579833; x=1794184633;
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=6KogHPxXZesrjjVkrlJVMb4Eo3ELPLnD2xsloqw8RZM=;
b=nebnOIGDQpk2jVoownqdfQyMed9pqDVuucdUUzAhxYzh+BBGhl7sm4A2J1g0t8fzZ9
2AIWGhVka0seMa52z/yW3ofUtT5ghvdzYHYEHBBHU4iHzRRHSHcBjod1xySJp7n6NT8X
FjYe8SjCs9YICo9fq3NXevMphsbyoh5qB4abZxGIFPIhCifx/lGPM/zZ3wPKI4S97GJt
TGEypso7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17f8mr151929446d6.11.1793579832593;
Sun, 01 Nov 2026 16:37:12 -0800 (PST)
X-Received: from mbili.tail33bf8.ts.net ([64.203.83.2])
by smtp.gmail.com with ESMTPSA id 6a1803df08f44-91ca7f23754sm77043066d6.9.2026.11.01.16.37.11
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sun, 01 Nov 2026 16:37:12 -0800 (PST)
X-Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
stable@vger.kernel.org,
shaos <shawnq1@163.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Simon Horman <horms@kernel.org>,
Jiri Pirko <jiri@resnulli.us>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Victor Nogueira <victor@mojatatu.com>,
Tom Goff <thomas.goff@boeing.com>
X-Mailer: git-send-email 2.34.1
X-In-Reply-To: <SER-NSBD.v2.r0.20261101171325@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