Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795619652; b=1kV+Vf1ypDeixupxjAJHWCWwmL4oMjDLly8vB7buYYTUvIkhtWd7t5P1Qo0e6DN/A0jg 4XX7GvFvmyP98e18HrhwHs5fYsTBK5hkWG9Gi82Qrhlg2zaJqM94Bs22pM+Lh6U0mGTDp QNDJH8mYSabPJS0WHJqHze5wVfGG8AH5jNe9CWm+v4b8hf/YsKsRYfHKRTHwVXR0kaxVN UDdGdgpfZpiZoRtAd/UI5kmpfsoPEGwFOVuwA9SvRofx+S8vDBrB0nllJiCwnYn7XYvuF /WEYrfwry2tdxptB3hiq9wxfr7mXlQJav9kzMxn9p30cOlShSw0gpL+pV/0dUMlX9bg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795619652; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=sJ0VkIa3vuOpmMpTBNn7iPjl98vZPoGIhRf+leiSLnY=; b=X9tXtu8zlSLkrZSnW7ZGGk1cfu+aXj+o8u3ezGn4EOxMXEffcBUpyUCAw+uJjjYIWtVk eVIUXxXZ33h4e+5aiCMyCPOm8BG1WeVB+B22BftxwKLa4zyOzso8t2xNLj7J+eiyOuhPs fRQ3HYUgzcVZRW2mgoQxXwWPdrVACPOUoFklDfV+fGIPsg2F6ZuyyKPcmZmd5vgodGxdz tWBYSnH679z8t1N5T6ij4QeHBUmlL9oBtkTKo8H4FdkF21MTrmrl07/Bgp0Q54KQBfybL MP7Y/0ZaPX/E9PThQNp80WuXpdgIE/GL2oTg/QGkzsu1NRzJ188G8mPywhMm9zyreWg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="aK/bS2MQ"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C312606A327; Wed, 25 Nov 2026 15:14:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=aK/bS2MQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5832A1F000CF; Wed, 25 Nov 2026 15:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795619651; bh=sJ0VkIa3vuOpmMpTBNn7iPjl98vZPoGIhRf+leiSLnY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aK/bS2MQWPqjLlrAitMuDbr7uR+AjLKrE33wPfauwKlqqdGiBhn+hSDw9kdxSDN4l RXp5ci8nRiP1gPoqnOwYhDF4bVp3me3d0i7n6A+XorK536HuYHj6gYCUWg/m0OV6bR jUBtZSXOp2EFyGfOi0CIfyUQIAzRSUmeGzn+SXos= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, shaos , Victor Nogueira , Jamal Hadi Salim , Simon Horman , Jakub Kicinski Subject: [PATCH 7.3 0666/1005] net/sched: act_ife: encode configured zero metadata values Date: Wed, 25 Nov 2026 15:33:24 +0100 Message-ID: <20261125143837.349977805@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261125143821.729802100@linuxfoundation.org> References: <20261125143821.729802100@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jamal Hadi Salim commit 7d02c07c738bf5c4b9a7d7ef498fbf465c446853 upstream. Reported by shaos 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 Link: https://lore.kernel.org/netdev/20261022144739.61342-1-shawnq1@163.com/ Cc: stable@vger.kernel.org Reviewed-by: Victor Nogueira Signed-off-by: Jamal Hadi Salim Reviewed-by: Simon Horman Link: https://patch.msgid.link/SER-NSBD.v3.r0.20261103064310-1@mojatatu.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/sched/act_ife.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/net/sched/act_ife.c +++ b/net/sched/act_ife.c @@ -50,8 +50,7 @@ int ife_encode_meta_u16(u16 metaval, voi 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, voi edata = *(u32 *)mi->metaval; else if (metaval) edata = metaval; - - if (!edata) /* will not encode */ + else return 0; edata = htonl(edata);