Article View: linux.kernel.netdev
Article #10331[PATCH net v3 1/4] net/sched: act_ife: encode configured zero metadata values
From: Jamal Hadi Salim
Date: Tue, 03 Nov 2026 11:50
Date: Tue, 03 Nov 2026 11:50
82 lines
14138 bytes
14138 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
Reviewed-by: Victor Nogueira <victor@mojatatu.com>
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.v3.r0.20261103064310-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-355543-linux-kernel-netdev=dewy.ruReferences:
<SER-NSBD.v3.r0.20261103064310@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-355543-linux-kernel-netdev=dewy.ru
From: jhs@mojatatu.com (Jamal Hadi Salim)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v3 1/4] net/sched: act_ife: encode configured zero metadata values
Date: Tue, 3 Nov 2026 06:50:29 -0500
Organization: Usenet Network
Message-ID: <SER-NSBD.v3.r0.20261103064310-1@mojatatu.com>
References: <SER-NSBD.v3.r0.20261103064310@mojatatu.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="3163431"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:bjpQHuAwTPkUuIipgvq6ogZdQ5Q= sha256:jGNjtWIAcOdk5/QbXmPw1KM2EGrSi2hi8eqOfBI+Kak=
sha1:Wfc1V5lXss4c9v4qrY8+Ek5vT8I= sha256:XvZtASwgQ2AyNkJuJp/W1Bx0XR2lM+HuXCvM6f1DtqE=
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 C72B2112870; Tue, 3 Nov 2026 15:18:48 +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 (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 ExP0jzSy52YP;
Tue, 3 Nov 2026 15:18:45 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-355543-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
by mail.dewy.ru (Postfix) with ESMTPS id 5BD1411286C; Tue, 3 Nov 2026 15:18:37 +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 06967606368; Tue, 3 Nov 2026 11:51:34 +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=1793706640;
b=5iOVZadzTOzXSvH61KOG9AcvJEghvLddk9iodyKFLwkXQHR2T4E1O8yHUARvlSDTgIEY
5b7jmfAgxLIIWAQpCQRET5w/Qz0ge8fKn7RVC1wosYgSw38pE9yEke4JfBq+bGLNHF3yL
FMD9K1FgrMwgkfcz98gcpbsX3Cx3cvokOvyTPrl4LP+DLZeJMfCCvnvNUqLPy0akGKdks
YSqL8Di+7rq/NLR4qq52guyx34/qrvjmDrcrnPtqO65wvemI/b+wsbevKv2ao7SSttVzh
CsTDZMEASSVjr9+o/akKrjI73b+FC9kyrzT7Qc5wntAQl4jKffkV7J2eE2c2APfGUoA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793706640;
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=EtG9dhFzpk5oF89fAnaxqWyJNRJtWaVCv5iEyMJHtao=;
b=YH6AsNlUtkClTf1ZcGmPCLNiJfYiInfhecRcYQp4NAa/WLs4XNYlqJNVfBLRolUTsr1y
vjxQ6abhgIk2Jnh4NEaedBjmJOD+oGxKPAAm6o92PgVxGIMvp53A4vAvJGMYcXnfd7Ojj
eQ6hD5QxAwFPYt7GlzPW13nrLMqSGvYT42cN3waMFck4XuiiH+ijLHz6gwpRsmpEC57Hd
T0wXYgqEfydQZo0u2b1xMZ2dI5LPf2mZjdHv4s20lUNfCXijvk0fifp3iOICfTPQF6BIQ
i1yASrF5SrtF9xpNG3//Qlzr0VI4cgeFKSq2CfkTGmUwZHNlH4RZDK3Qvu2s+5awhZA==
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=ZhKq0YTO;
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 BABC76082BC2;
Tue, 3 Nov 2026 11:50:40 +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=ZhKq0YTO
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.178
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793706639;
b=y+R4fA31nFabszXtghzaHdqX+d6EMZILC0spLF1VHoumnTlJjsxqkoRM9Z44HW27vLcV
wbMcsmxLvifqM1XUmAXI7Q/UXSQKHFDESEsMtQPe4kCi4snoj2qRA5FFWx5c0uCY5Ddpv
LovZUZO6xTx28kgtKEOPyepKdo06yQrik4WIsa9xO/oqq2eNFSxqEZnIvXGNrx/Mt6XbC
pmIbcT+J5rKb70RKtw0b1Xx7zuGs9EjFUQtHilShgtLmlmnBD/tAkqi73FfRONb5MbpJZ
PEeTv9Bhmc/kv6nqS2/FJyGrNXCZCeJ4N825zvp118Ni/V0UyCsm++ecMz52a9KHzmA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793706639;
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=EtG9dhFzpk5oF89fAnaxqWyJNRJtWaVCv5iEyMJHtao=;
b=1hR6LC1OeUlsqpmuPPCr7UPWO0ZdK2Lu4ymhP97DVl1zfB0y1cr6ZkhKWBQEt2byA811
Wug9/t4G7YYKl72LP2YvC5mZbAzfGr+J7BIeOABP9wT1z/8xEKhSL7SV22F5reQ7bbQ62
SIamdNYREkbCX73tisKumBusb+EjjjiX+55yW4+P99CIH93q7eCohTQA8KSEv2yIT/ppR
lwifB9Jv3RXiGiwmbskwGtrOPPRFRK9B1pILXB8vBGouDc4pM4kTSoLSnppbK+KFfrxKd
Tg9lXsWEt0XsoY3/DiLjyDd79L5i4viyE6Qd+0mj55lPrUoj7vNxUlM23iL/bFtwb1w==
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=ZhKq0YTO;
arc=none smtp.remote-ip=209.85.128.178
X-Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178])
(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 87A28606EEAD
for <netdev@vger.kernel.org>; Tue, 3 Nov 2026 11:50:39 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 87A28606EEAD
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-yw1-f178.google.com with SMTP id 00721157ae682-8b0e21048f8so33789917b3.0
for <netdev@vger.kernel.org>; Tue, 03 Nov 2026 03:50:39 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=mojatatu.com; s=google; t=1793706638; x=1794311438; 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=EtG9dhFzpk5oF89fAnaxqWyJNRJtWaVCv5iEyMJHtao=;
b=ZhKq0YTOYst5OXIjfIseOpJStVSCeld+b/HsVmXwh+rBqD+6+31JgkfoIbgHnHeAWI
8cqUuI1rTyQzjxie2xAf1JZSHnzJBxwzd4P6nJtlXhwS/7MkvTDFdQIrufIqnxZUbinQ
4qA+jq9YwSRtIpGT++FYdSkViv78oNbb2UvXs=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793706638; x=1794311438;
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=EtG9dhFzpk5oF89fAnaxqWyJNRJtWaVCv5iEyMJHtao=;
b=y+co73IZkyPim+trwQ+l8Sq9PJu352Ll/rMv24LqBWuX0bwCa7GZ82FguzxGhUTLtT
JgeXmaWNPfInOV7BYQjYkAK6lwCOSokaUHfwD10RUDVPG2r8V1h21bNSdUIn1i6/yC3W
B6YCwukR84AzA3JoiP34sDueoPLDGe5GmidKn0PAFZ/TTCU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:573:b2c with SMTP id 00721157ae682-8b305730e42mr197407b3.23.1793706638338;
Tue, 03 Nov 2026 03:50:38 -0800 (PST)
X-Received: from mbili.tail33bf8.ts.net ([64.203.83.2])
by smtp.gmail.com with ESMTPSA id 00721157ae682-8b2b704d699sm70016857b3.5.2026.11.03.03.50.36
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 03 Nov 2026 03:50:37 -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.v3.r0.20261103064310@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