🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #8727

[PATCH net 1/3] net/sched: act_ife: encode configured zero metadata values

#8727
From: Jamal Hadi Salim
Date: Thu, 29 Oct 2026 23:27
81 lines
14034 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.r0.20261029191634-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-353516-linux-kernel-netdev=dewy.ru
References: <SER-NSBD.v1.r0.20261029191634@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-353516-linux-kernel-netdev=dewy.ru
From: jhs@mojatatu.com (Jamal Hadi Salim)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 1/3] net/sched: act_ife: encode configured zero metadata values
Date: Thu, 29 Oct 2026 19:27:37 -0400
Organization: Usenet Network
Message-ID: <SER-NSBD.v1.r0.20261029191634-1@mojatatu.com>
References: <SER-NSBD.v1.r0.20261029191634@mojatatu.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2121663"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:lhVTPzIOsqqg1tIz5IFM1dZVkqU= sha256:Tif5J5ezb4rJzzytLESgqhUVkQDb9pSxsvsVIl1DWb8=
	sha1:VA2DAuDfgibKtYLUUTGkVwKydL0= sha256:wLAuqInbG1muP4Hx4SqVBSJpKh3jYnRgm97Ph0VIt6I=
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 DECEE125C7D; Fri, 30 Oct 2026 02:30:35 +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 hO8PExvbmSRi;
	Fri, 30 Oct 2026 02:30:32 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-353516-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 96F12125C7C; Fri, 30 Oct 2026 02:30:24 +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 4F1542B3B0; Thu, 29 Oct 2026 23:27:52 +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=1793316472;
	b=Q1oV02afZhmlzwL5OU/FVS0i2zREy6iUivXWezrUah1ZXUvt28esztxsqvqgxXsOvTU1
	 f1/EsFmpKpp7U6/GnGBbCq/fWCQ79Q0lHTMN/lKaeShNGWTX8yxPSrTb57pbMBr5NVxRM
	 gOmaNy8lsn4Hu4DixJ6Wi2fzOP0PLoDM4i82EL+1IibbKel0IJTWXbmjb3E2exibTT523
	 IF+jeui+TZPIvUvhvNmMaXpzA1lPH5SjdjUuB8ZvALgRXfq4mCuZyCvE7YvZtoHoLes98
	 ayVQTD8wPXU4dhNbNtpcgHUlF4M0Rl9Kg0LPhKsvdKVgdIxgW6iSEOXkX+xACqNafbA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793316472;
	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=E0DgWZiW7nqqrqltC1fYYgdhEhGqvpoN+onS7S8r8sGIetClZB1R5LqcoPqnV94/E4i4
	 BfDxhuL1cVe+qVNNgx4t4o3yYxLJcKdw/NYAT4SXpbGZIKAGW6jVCx81QTQ6c1GrgdP3q
	 LGWSFHoKuGkxZz8rP64OHPSHgqn7Nt5uvuhm65OzXAnysZK2kdQ2neuFqOQJBrwaM/cIV
	 gO/gaSO1SiMLWHS8g9Sr0mpIChxv/gRK8DpTBfHvS61qkrVusnUynaf3dOm9aVS2VRhRF
	 zL2awjrPR/b9lbdyASaavRrlKoNBYGN1V6fkrzDvEB68oD0gBNSJCnkL49znt7AdOdA==
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=Kzyg0Hlj;
	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 26193606A33B;
	Thu, 29 Oct 2026 23:27:52 +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=Kzyg0Hlj
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.54
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793316466;
	b=Hhy0x6hXyG77PZCNgzyU3k6zzDhfCY2o1KGi0PnHJJDGDuE+l79LN9rKq5s/z5UeDwUw
	 4f+cWLBCGIandq0ue3brT73p/GcRBOKD0TvUSqeYBnTqATXR8ziQc1i5qAYxsDd9O85YX
	 Nf5JEfg9jvf7u9oKhjdeFT0ytAT+fp46qwg1A/yPD+aNc4JyIcZJogEzAR+WyeCk6D9Wa
	 Toh4+opUltuCZOWHDFGGBreRI/CeI1F9EIVogphDE1VqYsyRt9jNzRjwu1a63NDy22sre
	 iY7PEWWWxGxl0JKO28uzVNjXPBPaYmHSdzU+CGT99AU2g+fv2ZXyFGfIPlcdkAwAu9w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793316466;
	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=nSO9qlLHAdqSUc+W+oYvdL1OUYzk2dkX2l3mV8o3P2BKfpYTLCiQaF3efZKJ1WW2v0D7
	 yseLDQRGvqBi4zBxxbseX4way+CcpKLD9hUyrYjOS7s0Sa9kd/a+axiYOXTDU/XIrqhcI
	 FNSyJWR+tlMUvJU+c8dNH0dKl+vQrER+S18dRgkopEZg4W5wTgQyFIfR1rcnbUedHvLYe
	 /TifCbjIITAaRpgn4JSJMgl6dUT+nzo3caWIBUXydfK1zEpih16Oc+NQ60FqnE7VXKW8X
	 HecdTP7rxkXhvSsbePZTvfuzvX0D1Z7YnqdXAKfPO3ghD8K4PPlYyogNvx/Ja28oIMw==
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=Kzyg0Hlj;
	arc=none smtp.remote-ip=209.85.219.54
X-Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54])
	(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 D12F7606A326
	for <netdev@vger.kernel.org>; Thu, 29 Oct 2026 23:27:45 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D12F7606A326
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-f54.google.com with SMTP id 6a1803df08f44-917aca1aee5so1676386d6.2
        for <netdev@vger.kernel.org>; Thu, 29 Oct 2026 16:27:45 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=mojatatu.com; s=google; t=1793316465; x=1793921265; 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=Kzyg0Hlj8a8YIkwjP2dUbAFX5M3Ac/IbvOLgmVwBCdqwuxZ6KnSmsGVFIBoxh5Y6hI
         4zFXRfLIifkYMaBU8iyR4lWBpbn11/hrkZ9WssTBJ/fPLDpfHO1GT8kIjAV72/7n2Jfz
         va8YZm1ynVIu4go6+DccVlJwrolgS5nKI/I4E=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793316465; x=1793921265;
        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=hgiT6GC+qcnz67DXQvnFvQ5prhV+KMXSPMgvDLZLTupGCeOH2I1QLjVmijIY1N0CT9
         eR7yne45moZrcglRy0HuFb5reFeX6zpPVR68poBgF1aCe/shE2rufBZhvdMscM9vYDJ5
         lAkuxEfQtlfRXlBAiIPeSKMCJf4oyn9Idn9l1Cws8HyLHHY5ixjcqHDjIPoC/1YG/QE9
         jhFYJmlqT0Io05rZaBOtX5IzO2scBYQkML17gnbnA5pzvOtVLQ0B0wf3zn4xhh25RQ7S
         wvyzyRRtV3dC07vJexVrPdOw/e4swo/PoAiq+6Vcrmln+IzaPN47X63zka9QfBV1p+3x
         eT1w==
X-Gm-Message-State: AFq9FYLrRDNTJCtRLn7cog6lOC8UA6S0YK6MIjtPJuPdrCCmGENF2YD1
	UpoSgay+si63YowI+g0rOfOQ39inw/5J/sUH4OBOhJviPqS7lgqJeyxMGIhnKWn7OWljXyNlYOu
	eoSQ=
X-Gm-Gg: AYBFou2vQaWOUKrGaK59Vcn5g6RMoPBjrZpdujqcSernC/+l4zl7bMZtFjNeVBoASfc
	HYAJfuA+JIVZ4axP2KYT27ZrNug0hB6Q0t+w20jzgO2j6CYNoupR6WTTfNAreFoqwm3aKyiH9+b
	p36SD1PVqH4gSgxDg1MZfU7dp+BzCHYTDIC+PHQTKQ80jCDzRx1yKPeSYPfUzeIBhBFQoKJd4T1
	8vj2JlvSVkd+h7BXhf5VSGG2SIknuoM8bNCHZRCJfsGLvXmsv/zsDEcg5muF9SMbEE/Usnxrqlk
	VeF4bBBwl2g5lAZrWsqfslWLopea4Yh4sLrGM3C7udWeiNKT9KgqdtK2ZBn17Ijb3Hzo3jon1zX
	RGRu3oOqwHrt8qSFcbACT8mFjzvJ4zTzc0d7/66RmL8+j6sS+1HqSguGW14yJfvufwHQjIlTVHn
	pQ0bZ+VmMTh3fc4CsNDCSwC/yf49fb9JUHynEA6H4DO2DQwT6ywNYH4m7j5txayFbI4tdpZSfRM
	DC9YPuH05rpxO/9SCNcFqZTTEJ1z3X5kta3BXQLwLlQO+HmLe0FH59r2LNEYpFY+Sxm1BZOWJAY
	wKSrApa6bNWvsuXJQnWMguW0UMJgc753DIsZVY6rKchLdW1+OchbHdIjC33h3kqqmjqjByG7Vpc
	=
X-Received: by 2002:a05:620a:3190:b0:939:761c:4f59 with SMTP id af79cd13be357-944216f2a8dmr128857985a.16.1793316464807;
        Thu, 29 Oct 2026 16:27:44 -0700 (PDT)
X-Received: from mbili.waya ([64.203.83.2])
        by smtp.gmail.com with ESMTPSA id af79cd13be357-94424243823sm5384385a.21.2026.10.29.16.27.43
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 29 Oct 2026 16:27:44 -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.r0.20261029191634@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