🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #5216

[BUG] net: sched: em_meta accepts shifts outside the integer width

#5216
From: shaos
Date: Tue, 20 Oct 2026 00:34
34 lines
10238 bytes
Hello,

em_meta accepts a user-controlled shift exponent in tcf_meta_val and meta_int_apply_extras() applies it to an unsigned long without checking the range.  A shift of 64 on a 64-bit kernel reaches C undefined behavior in the network classifier.

HEAD commit:    fe2ec83746e501645709761605c2464a44fd2929
git tree:       upstream Linux checkout, local branch master
source version: Linux 7.3.0-rc4-70-gfe2ec83746e50
compiler:       gcc 11.4.0, GNU ld 2.38 (from the kernel build banner)

console output:
https://gist.githubusercontent.com/shaos26/4d0a6531f00fd3baeabe040993953402/raw/1677be670d3d39c0054b4ecd40c69b375630381c/console-output.txt
kernel config:
https://gist.githubusercontent.com/shaos26/4d0a6531f00fd3baeabe040993953402/raw/e47da1b0ca0ffe6d0ac3a988e2c30c7eb634ede3/kernel-config.txt
reproducer:
https://gist.githubusercontent.com/shaos26/4d0a6531f00fd3baeabe040993953402/raw/1f5f1944a0a8d87af969b58f80c4dfb10e50eca2/poc.c

Build and run the standalone PoC on a 64-bit kernel with UBSAN enabled.  The program creates its own user and network namespaces, installs the em_meta filter, and sends the triggering packet:

    gcc -O2 -Wall -Wextra -static -o em_meta_shift_poc poc.c
    ./em_meta_shift_poc pos
    ./em_meta_shift_poc ctrl
    ./em_meta_shift_poc nofilter

Two fresh boots with shift=64 reported UBSAN shift-out-of-bounds in meta_int_apply_extras(); shift=8 matched without a report, and a no-filter control was clean.  The observed effect is undefined behavior and a wrong classifier result; x86 masks the hardware shift count, and no memory corruption or privilege escalation is shown.

Impact and prerequisites:
The demonstrated result is kernel undefined behavior visible under UBSAN and incorrect packet classification.  UBSAN is needed for the diagnostic; the current evidence does not establish a production crash or a security boundary violation.

Validation: Two fresh boots reported UBSAN shift-out-of-bounds for shift 64.  Shift 8 and no-filter controls were clean; no memory corruption or privilege escalation was observed.

Thanks,

shaos
Technical Details
Message-ID: <20261020003453.1010097-1-shawnq1@163.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-348935-linux-kernel-netdev=dewy.ru

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-348935-linux-kernel-netdev=dewy.ru
From: shawnq1@163.com (shaos)
Newsgroups: linux.kernel.netdev
Subject: [BUG] net: sched: em_meta accepts shifts outside the integer width
Date: Tue, 20 Oct 2026 00:34:53 +0000
Organization: Usenet Network
Message-ID: <20261020003453.1010097-1-shawnq1@163.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3750536"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:miraG8d0xGCJd8s9aqDLNlbl0/M= sha256:xCqCMCl6OP4hyM6ve/dAStcZjuAmChkw2EqSGf8kAWA=
	sha1:vBeDwh8Xg8HcwzKDamu4HBvusxg= sha256:cfH9g0MQn8C/dvchuGe1LDEcx6QHSnqRW0dbrYh/E40=
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 200EB110B95; Tue, 20 Oct 2026 03:36:53 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.046
X-Spam-Status: No, score=-3.046 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, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, 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, UNPARSEABLE_RELAY=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=163.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 i1BkR9xjknxk;
	Tue, 20 Oct 2026 03:36:50 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-348935-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=163.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id DB955110B7D; Tue, 20 Oct 2026 03:36:41 +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 8982143EC5; Tue, 20 Oct 2026 00:35:17 +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=1792456517;
	b=Skmp++aTqggobmdh/8+O4tvpDDiWENwQzJENhDPuas7dlCZkMzn6XcJ7V+Usvfkrcr9b
	 MDqh19yivpPXKkQ702upX3d86J7dg7nK3RwkwfFr24m9rIygL6qNzJUKJc0N6o9A6bkLs
	 I+YwL6Uj2zPTIrCuRJOKGetn6jumjFHnKPXL8AhZQwUWSRPsvoi+2CuHcrWiKlBfQP24X
	 MYZlkM96j/ssOIn2jYuEsatuR0wFCcGGxBdk4ydup59Jmixt9ukeDunilAmKzd/Y+v6nQ
	 ZWOV+9rVBB1O9VST/dNzdwAOnQtjzTxy3yoMcdzQi99ikp0qkzuLkl+jlOq5B7m69Hg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792456517;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:From:To:
	 Cc:Subject:Date:Message-Id:X-Mailer:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Transfer-Encoding:X-CM-TRANSID:
	 X-Coremail-Antispam:X-CM-SenderInfo;
	bh=hITz8gs0faWLxZ/glASJObi4AjjcjXrRjtX1RaulOvA=;
	b=S/1HYFe0Xs5lFNql7WZqlvMxNFekbJ2m6o45GjXNUn1942o3AdxQU5eGksPqResaHdU4
	 20b7YdQlBxidn6btnf3hUK7MQVM34wqstf5HVKUUQhHYW+GDssNz+mVITDwhuTmCdgT7v
	 q50ZPNz8yEWPEZmGjgfiXcOQO1wkRk2l/fpELdpJ218ttkFkgLnbyTjD5rdfJhJBpYoN0
	 xIisXnC5wgpSXio40dly3pJVVTnD5E8b/Jg2qBj+d2YdoB7zryUournIwbPvKKD3Y0Jx+
	 WKdECPERQplWH2YKvMqjBgnHog3D8GPNeRhkjv7Gj4yuhdKdhVCR3149g54z8Ya1mXg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=csSyvirw;
	dmarc=pass header.from=163.com;
	spf=pass smtp.mailfrom=163.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 5CF34606A330;
	Tue, 20 Oct 2026 00:35:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=csSyvirw
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=117.135.210.5
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792456515;
	b=TkZzR2IlS+ulAKW7cBjCDalqVty4WPWRtthVKEP4rVW8nERBCR4aeqHBJ3YKbeUnv2ws
	 Kq5A1mMx57fb5imAfHFSdYsltiXt1+aeboaymkZ7vNQfF6BmjsDmvd3C0+5Ka+HLiBdW+
	 TDhDdQNpxqEyFkdoQa/KCwNZCS5hCgOD0v2JWZjKmsRJYQ3ysSSdxkrOTEKcf3ZLLC4XG
	 BC/3H7vCMRk/Vb38K1Lecoym3KAIU1D8VDFV/UTXYRxCIOU0FyRx4T080L8Qp+H2I1WdE
	 6D2EPqHLOQDMZTAPbQyndATj3sMBZp18aBuQT+XsSYiTu2aCDiraVnODwkKhOrJ+fhQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792456515;
	h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date:
	 Message-Id:X-Mailer:MIME-Version:Content-Transfer-Encoding:
	 X-CM-TRANSID:X-Coremail-Antispam:X-CM-SenderInfo;
	bh=hITz8gs0faWLxZ/glASJObi4AjjcjXrRjtX1RaulOvA=;
	b=SG9sTItkCBdonbUQm/zMhpICoSnCRRk8ePRCTjcIfzQTfkrcTJ9zPqDdQT593vu0nEku
	 am+Q/XAqMzSOmPguXzEqBfgX0PEzxzOFSgWacB50E4mOBJQefxiBGaLUldvD7y3N8MPSA
	 V6JxYE/qG9bqmdPdzjeVVqvVfdwT93Bs1v2ekPcFg1oByy+jj0Ltr6gvCgxXIGXry+9+m
	 ozgVPzDe7az7rSMrK9800+SGqKDNJiR24rDX7pQ6oTu7fI62PSfKN9N5+gUPKwggZE+W1
	 6irZTXtLtuD3j/a0CXEzIt9bOQNtNPn9ochrQM9aiuV6x3GbzUH8FOUIM/gc/T8y8TA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=163.com;
	spf=pass smtp.mailfrom=163.com;
	dkim=pass header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=csSyvirw;
	arc=none smtp.remote-ip=117.135.210.5
X-Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56E6F606A31A;
	Tue, 20 Oct 2026 00:35:13 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 56E6F606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;
	s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=hI
	Tz8gs0faWLxZ/glASJObi4AjjcjXrRjtX1RaulOvA=; b=csSyvirwUcN2OOYkK7
	KPshFZYZPY2PK1JLtGZL16iEnYDzx/k3nF/yUPbMMcxxExooNQGqT+xHJ83GeZgh
	4faz+PM8v+RBb0SLsCcvlCbKY73UCM4kR7+kC5FFN//gZsgX5l61hHfAFELsixM+
	C7KRd5HEuY/3I3SeoikhChIrc=
X-Received: from shaos.localdomain (unknown [])
	by gzsmtp4 (Coremail) with SMTP id PygvCgB3HZktt9Zq616PAw--.45303S2;
	Tue, 20 Oct 2026 08:34:53 +0800 (CST)
X-Cc: Jiri Pirko <jiri@resnulli.us>,
	netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.34.1
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
X-CM-TRANSID: PygvCgB3HZktt9Zq616PAw--.45303S2
X-Coremail-Antispam: 1Uf129KBjvJXoW7ury5Ww4DZFykArWDZr45Awb_yoW8tr1DpF
	yvk3W3JF9FkF4qqw4q9a1UX39Y9wsakw15G3WkC3W8urW5Kr1YkryFqFW5Wa47Wrn5G34Y
	vFs0q3s7W3yDAaUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
	9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j0OJ5UUUUU=
X-CM-SenderInfo: pvkd40jtr6il2tof0z/xtbC8Q1JV2rWty09hwAA3+