From: Phil Sutter <phil@nwl.cc>
To: Ren Wei <enjou1224z@gmail.com>
Cc: netfilter-devel@vger.kernel.org, pablo@netfilter.org,
fw@strlen.de, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, horms@kernel.org, yuantan098@gmail.com,
dstsmallbird@foxmail.com, chzhengyang2023@lzu.edu.cn
Subject: Re: [PATCH nf 1/1] netfilter: xt_time: reject pre-epoch calendar matching
Date: Fri, 3 Jul 2026 11:00:25 +0200 [thread overview]
Message-ID: <akd6KZo1lwQ719d0@orbyte.nwl.cc> (raw)
In-Reply-To: <779d223ad31c493cbfc3c483293e435dca89cf90.1782879547.git.chzhengyang2023@lzu.edu.cn>
On Fri, Jul 03, 2026 at 03:32:43PM +0800, Ren Wei wrote:
> From: Zhengyang Chen <chzhengyang2023@lzu.edu.cn>
>
> When XT_TIME_CONTIGUOUS handles a cross-day daytime range, packets in
> the post-midnight part of the range are matched against the previous
> calendar day by subtracting SECONDS_PER_DAY from stamp.
>
> On the first day after the epoch, this backdating can make the signed
> time64_t stamp negative. localtime_2() and localtime_3() then feed the
> value into unsigned division helpers and derive wrapped calendar fields.
> In particular, monthday can become larger than the valid 1..31 range,
> leading time_mt() to evaluate an out-of-range
> 1U << current_time.monthday shift.
>
> The date_start/date_stop ABI is unsigned and cannot represent pre-epoch
> calendar dates. If contiguous matching backdates stamp before the epoch,
> only rules without weekday and monthday constraints can still be
> evaluated safely; reject calendar-constrained rules before converting
> the timestamp to calendar fields.
>
> Fixes: 54eb3df3a7d0 ("netfilter: xt_time: add support to ignore day transition")
> Cc: stable@vger.kernel.org
> Reported-by: Yuan Tan <yuantan098@gmail.com>
> Reported-by: Xin Liu <dstsmallbird@foxmail.com>
> Assisted-by: Codex:gpt-5.4
> Signed-off-by: Zhengyang Chen <chzhengyang2023@lzu.edu.cn>
> Reviewed-by: Ren Wei <enjou1224z@gmail.com>
Reviewed-by: Phil Sutter <phil@nwl.cc>
next prev parent reply other threads:[~2026-07-03 9:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1782879547.git.chzhengyang2023@lzu.edu.cn>
2026-07-03 7:32 ` [PATCH nf 1/1] netfilter: xt_time: reject pre-epoch calendar matching Ren Wei
2026-07-03 9:00 ` Phil Sutter [this message]
2026-07-03 10:08 ` Florian Westphal
2026-07-03 10:15 ` Phil Sutter
2026-07-03 10:29 ` Florian Westphal
2026-07-03 11:03 ` Phil Sutter
2026-07-03 11:07 ` Pablo Neira Ayuso
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=akd6KZo1lwQ719d0@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=chzhengyang2023@lzu.edu.cn \
--cc=davem@davemloft.net \
--cc=dstsmallbird@foxmail.com \
--cc=edumazet@google.com \
--cc=enjou1224z@gmail.com \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=yuantan098@gmail.com \
/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