🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #22544

Re: [PATCH net v4 3/3] selftests: tc-testing: act_gate: cover the new cycle time and interval limits

#22544
From: netdev-bot+sashiko
Date: Wed, 25 Nov 2026 14:15
179 lines
15045 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The four new negative tests in tools/testing/selftests/tc-
  testing/tc-tests/actions/gate.json (2c35, 92b8, 8265 and 5c47) re-run…
- [Medium] Tests 92b8 and 8265 in gate.json pass the decimal string
  9223372036854775808 (2^63) as base-time and cycle-time, and expect the…
- [Low] The boundary tests 7d1f and 9f10 in gate.json add a gate action
  with base-time and cycle-time 9223372036854775807 (KTIME_MAX).

--

selftests: tc-testing: act_gate: cover the new cycle time and interval limits

This adds seven tdc test cases for the gate action. They cover the new
KTIME_MAX bound on base-time and cycle-time and the 10 us minimum schedule
entry interval. The negative cases re-run the failing command and match the
error text that tc prints.

> diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/gate.json b/tools/testing/selftests/tc-testing/tc-tests/actions/gate.json
> index db645c22ad7be..1c910e07c41c9 100644
> --- a/tools/testing/selftests/tc-testing/tc-tests/actions/gate.json
> +++ b/tools/testing/selftests/tc-testing/tc-tests/actions/gate.json
> @@ -347,5 +347,194 @@

[ ... ]

> +    {
> +        "id": "2c35",
> +        "name": "Reject gate action with a schedule entry below the minimum interval",

[ ... ]

> +        "cmdUnderTest": "$TC action add action gate sched-entry close 9999ns index 100",
> +        "expExitCode": "255",
> +        "verifyCmd": "$TC action add action gate sched-entry close 9999ns index 100 2>&1",
> +        "matchPattern": "RTNETLINK answers: Invalid argument",

[Severity: Medium]
Will this pattern match when tc is built with libmnl?

On this path, fill_gate_entry() in net/sched/act_gate.c sets an extack
message before it fails:

    NL_SET_ERR_MSG_FMT(extack, "Entry interval must be at least %u ns",
                       GATE_MIN_INTERVAL_NSEC);
    return -EINVAL;

The extack pointer is passed down unchanged:

    tc_ctl_action()->tcf_action_add()->tcf_action_init()->
        tcf_action_init_1()->tcf_gate_init()

A tc linked against libmnl prints "Error: Entry interval must be at least
10000 ns." and does not print the "RTNETLINK answers: ..." line. The
matchPattern would then find zero matches, but matchCount requires one.

The same applies to 92b8, 8265 and 5c47. Those values fail the
NLA_POLICY_FULL_RANGE(NLA_U64, &gate_time_range) check in gate_policy
during nla_parse_nested() in tcf_gate_init(). That check sets the "integer
out of range" extack, so tc prints "Error: integer out of range."
instead.

tools/testing/selftests/net/bpf_offload.py already expects tc to print the
"Error: ..." form, and warns "libmnl missing?" when it is absent.

With a tc built without libmnl the patterns do match. But the strerror text
matches any -EINVAL or -ERANGE, so it can't show that the 10 us floor or
the KTIME_MAX bound caused the refusal.

The commit message says:

    tc does not pass the action path's extended acknowledgment back to the
    caller, so the negative cases re-run the failing command and match the
    kernel's own error text instead of relying on the exit code alone.

Is this accurate? The text matched here is iproute2's strerror output, and
the kernel does deliver the extack on this path.

Would it work better to match the kernel strings ("Entry interval must be
at least 10000 ns", "integer out of range"), or to use a regex that accepts
both output forms?

[ ... ]

> +    {
> +        "id": "92b8",
> +        "name": "Reject gate action with a base time above S64_MAX",

[ ... ]

> +        "cmdUnderTest": "$TC action add action gate base-time 9223372036854775808 sched-entry close 10000ns index 200",

[Severity: Medium]
Does 2^63 reach the kernel as 0x8000000000000000 on every architecture?

In iproute2, get_s64() fails with ERANGE for this string, so tc falls back
to get_time64(). That function parses the string with strtod() and assigns
the double to an __s64. Converting 2^63 to int64 is undefined in C.

On x86-64, cvttsd2si gives 0x8000000000000000, which is above KTIME_MAX,
so the kernel refuses it.

On arm64 (FCVTZS), and likewise on riscv, powerpc and s390, the conversion
saturates to 0x7fffffffffffffff, which is exactly KTIME_MAX.

The bound in gate_time_range in net/sched/act_gate.c is inclusive:

    static const struct netlink_range_validation gate_time_range = {
        .min = 0,
        .max = KTIME_MAX,
    };

Tests 7d1f and 9f10 rely on KTIME_MAX being accepted. On those
architectures, cmdUnderTest would exit 0 instead of 255. verifyCmd would
then fail with EEXIST, not with the out of range error.

The cycle-time value in 8265 has the same problem. 5c47 covers the
base-time bound deterministically with -1. 8265 is the only refusal test
for the cycle-time upper bound, so on non-x86 hosts that bound would go
untested.

The preceding commit, "net/sched: act_gate: bound the cycle time and start
time arithmetic", already notes that iproute2 rewrites out of range values
through strtod().

Could 92b8 and 8265 fail on a correct kernel on arm64?

[ ... ]

> +    {
> +        "id": "7d1f",
> +        "name": "Add gate action with the maximum base time",

[ ... ]

> +        "cmdUnderTest": "$TC action add action gate base-time 9223372036854775807 sched-entry close 10000ns index 201",
> +        "expExitCode": "0",
> +        "verifyCmd": "$TC action get action gate index 201",
> +        "matchPattern": "index 201",

[Severity: Low]
This isn't a bug, but should this check the stored base-time rather than
only the index? The same question applies to "index 301" in 9f10.

Other tests in this file check the read-back value, for example "base-time
200s" in 7189, "cycle-time 200s" in a721 and "base-time 400s" in 3719.

As written, 7d1f and 9f10 would still pass if the kernel clamped, zeroed or
replaced the value. For example, tcf_gate_init() replaces a cycle-time of
0 with the cycle derived from the entries.

The commit message says:

    An entry interval of exactly 10000 ns installs and reads back with the
    interval it was given, and so do a base time and a cycle time of exactly
    KTIME_MAX.

It also claims coverage of "both ends of the cycle time range". Only the
upper bound is tested. An explicit cycle-time 0, which the preceding commit
keeps valid as "derive from entries", is not covered.

Similarly, c873 matches "interval 10us". tc prints intervals with %.3g
scaling, so any stored interval from 10000 to about 10049 ns gives the
same text. The test can't confirm that exactly 10000 ns was stored.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/ACT-WEXM.v4.r0.20261124074514%40mojatatu.com
Technical Details
Message-ID: <179561611414.3135.147725315288144189@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371382-linux-kernel-netdev=dewy.ru
References: <ACT-WEXM.v4.r0.20261124074514-3@mojatatu.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371382-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v4 3/3] selftests: tc-testing: act_gate: cover the new cycle time and interval limits
Date: Wed, 25 Nov 2026 14:15:14 +0000
Organization: Usenet Network
Message-ID: <179561611414.3135.147725315288144189@kernel.org>
References: <ACT-WEXM.v4.r0.20261124074514-3@mojatatu.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="225081"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:l8aWuEz5MFKs4eAFVPgeDwdnu90= sha256:CQ2c2tewkJvk3T1jl6M/xXkIZ6ETAUhqT26QJT5gOg0= sha1:RNbiMvewrYs89x/eisAF9o6c/aw= sha256:S7WKer0BwF0BGPDGz3KTUGtYHDi5nP6I9tXahKlhC8o=
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 EEECF125E6B; Wed, 25 Nov 2026 17:15:42 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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 (2048-bit key) header.d=kernel.org
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 or6Gc43R6Vo7; Wed, 25 Nov 2026 17:15:39 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-371382-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id ED271125E6A; Wed, 25 Nov 2026 17:15:30 +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 B04983AE0F; Wed, 25 Nov 2026 14:15:16 +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=1795616116; b=TDgNdLcLKyroA6R1WADAG4mHiKR8e6cBplqm6B7vBeaWHuatHs2lkYL4on2NSJ8dVzVh Rh/SWxIpzNGFrgzXvZq6Ser9a+3kErVliQ5sfAFLl5gxZNAVcUQFRKPDCVEl8cRDJ9bSH JUYt5YJfvmnstn0iQbBEwsh4oJNJBwpY+96WcKTbJcNUempO1WAnXlp8lcdJz2N/914D0 U2EAsIKoK+z5NIqjcacaeEPLc9nMWphypAGDnLhtMr1KqWhb9+IZqUzQge0x0iA1XHiqC mPQX58wcX3kEcgy0mK7tIe6xX3JO3YGKa5slFT3WW+k2OK92q5bMBwrfOCQvVi/ZsUg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795616116; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=3zCBmA88hpRkhrtX5/EeZJChNGSTM3Tk4F9CZNL8GqQ=; b=Dg0GgCZ5TNNt9yvMcwyLuTMgKRsC4AuDFM6n9x5Cw75EXAQMoRhSZcdBp5WummfpvBEr ypyqOT+dptt6psHEQAkmPDWVWiVR+8rkI5c47DLZojVdgR/5knHv1uKgbYE7DNm/jOtF0 A1CNMo55YEALzvqKR7WYrmvCZBNUhjTXBi6PIGIh6YMOLK7kqyvOuIQX8M7MFX0LdHZ5J UasAHyKIoQ6grV8pTGL/dG2ePdOcQlg7BM/Zzo09UL8LJI+fbXAygB6OEzXMJinag1Srs s1NRm7xnQv6qWSC+eZfj7C2OxY9+EFhY4hxIabpkOsMT5k4RRvbviSrsVMuxwQK9ISA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BnwOttN4; 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 67F67606A336; Wed, 25 Nov 2026 14:15:16 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BnwOttN4
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795616115; b=rZh1igvc53Rnsu8SN3yFoaRJUb1+rNX/dtw18AjxSQ+0MwVGfOpT+DGQBouqlIFo+0s3 YmiqfyDkvRY9yZ3cnf0EKWj7QU4Bk52MMhu48feko0mrljjkRLwVNx7juhuHtAnDuqb94 DF23GQFIkX9BJhXVvKQ7p6+niDuHMny0RTb/HWVUT/d4zErAhN14UOxpYnF4CTNvDN1CB RpmLbDNlVJyacNxkVBmIXXXC1Lsem/Rj5gmmVI9f6S776irxIWGyYsi9VdHXQLkVxFqDx ElQUYIOMKCByxx/+mvITQbrKB1sdfcuDMEBTFOOfvE7o/8ShUeg1yVdHfeen8DSpS/A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795616115; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=3zCBmA88hpRkhrtX5/EeZJChNGSTM3Tk4F9CZNL8GqQ=; b=BCmZMdEK147L0Hq2RLWrqiHSiDmPn+FuOwo74XhQ6ZswW6/Tvvz3E/t1r0oFjMIOdVzd s+++rtTyI35H36c/rGLxk+ZA+1ijUBopuwbxqreilcYNuexgEAmv6aItSdvACU5XcMMB9 1Ou3iySBVMneU++pAibBz3Il9/Q+/54AErqGqFii1c8MG0r35q9D2KEv6T3/MTI2Jzkn2 phYeqTCTiMwVf0R7ddgJ25VOUscum86E5MhyZZYIGCKnCPr7C35JBR/Ksd+F8TtGmmer6 vNLwwVmOPBCjDYvN6BT0UYSXWyGhLefsnLA4/thlhGVOr/dTIuxfW5dOV3+00BSCjsg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BnwOttN4; arc=none smtp.remote-ip=100.103.45.18
X-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 88F89606A32D; Wed, 25 Nov 2026 14:15:15 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F87A1F000E1; Wed, 25 Nov 2026 14:15:14 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795616115; bh=3zCBmA88hpRkhrtX5/EeZJChNGSTM3Tk4F9CZNL8GqQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=BnwOttN4Y1xHMkRB80Oav20e8M36qjaLQeodvuoNcfME/G9Ggw4ecH47yxkljUFIo ymF/WW9b9ckd/16wOlh7zlUFQ13/Z1qgfmF47FMZUlJaqjg8PRDqQUBuJfigK/hdyz 67MvsMwRfuKcyCQE/HfhCZ4kxwpSpHU3l0qOeGfTNCIAk2Ks8AgNj8bzIHDTbjnpeL jTd0dsc7y/EGOE43ab5EoV0OO9BcTi/1IdVzYqzKG6ljE+km1Blv+iNeugkMFjy7Ui vwPtHHIKQyzUNWeY+C9GLlIOjJZ8znYucJrrtfJR6dozlbmlDBzKvuhSi0Q2+/xKYj JzvZ+/oYQMQTg==
X-Cc: netdev@vger.kernel.org, jiri@resnulli.us, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, alexei.starovoitov@gmail.com, victor@mojatatu.com, Po.Liu@nxp.com, stable@vger.kernel.org, syzbot+0054fed3dc9085390f51@syzkaller.appspotmail.com, shawnq1@163.com
X-In-Reply-To: <ACT-WEXM.v4.r0.20261124074514-3@mojatatu.com>
X-sashiko-severity: Medium
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