From: shaos <shawnq1@163.com>
To: jhs@mojatatu.com
Cc: Jiri Pirko <jiri@resnulli.us>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [BUG] net: sched: cls_flow perturb period wraps when scaled
Date: Tue, 20 Oct 2026 00:34:40 +0000 [thread overview]
Message-ID: <20261020003440.1009437-1-shawnq1@163.com> (raw)
Hello,
cls_flow multiplies the user-provided TCA_FLOW_PERTURB seconds by HZ in 32-bit arithmetic without a range check, both when creating and changing a filter. Large values wrap to a very short perturb timer or to zero, changing the filter's timing behavior.
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/e00f090da98036578d357a8ca70b6e3d/raw/fa14843487b13fb553ca73b2b16ed3db507c1439/console-output.txt
kernel config:
https://gist.githubusercontent.com/shaos26/e00f090da98036578d357a8ca70b6e3d/raw/6e1af5fc2bf4af2bafb39e23f087c47e62ea3ff4/kernel-config.txt
reproducer:
https://gist.githubusercontent.com/shaos26/e00f090da98036578d357a8ca70b6e3d/raw/2cac1c5dd9e3ba3a9bdd55e803f3cd72088b9bbf/poc.c
Build and run the PoC on the target kernel. It creates a private user and network namespace; the first command exercises a value that wraps to zero at HZ=100, the second exercises a nonzero wrap, and the third asks SFQ to reject the same oversized period:
gcc -static -O2 -Wall -Wextra -o cls_flow_poc poc.c
./cls_flow_poc --hz 100 --userns 42949673 1
./cls_flow_poc --hz 100 --userns 42949674 2
./cls_flow_poc --hz 100 --userns --sfq 42949673 3
With HZ=100, setting 42949673 seconds dumped as 0 and 42949674 dumped as 1; 1073741824 disabled the timer. The boundary value 42949672 remained unchanged. Three fresh boots reproduced the matrix, and the SFQ implementation rejected the same overflowing range.
Impact and prerequisites:
This is a network-classifier timing and resource-control defect. It requires CAP_NET_ADMIN in the target netns or an unprivileged user namespace. The evidence shows unexpectedly frequent or disabled perturbation, not memory corruption or privilege escalation.
Validation: Three fresh boots reproduced the wraparound matrix, including the uid 1000 user-namespace run. SFQ rejected the same overflowing range.
Thanks,
shaos
reply other threads:[~2026-10-20 0:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261020003440.1009437-1-shawnq1@163.com \
--to=shawnq1@163.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox