mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Wang Yan" <wangyan01@kylinos.cn>,
	"John Stultz" <jstultz@google.com>,
	"Thomas Gleixner" <tglx@kernel.org>
Cc: "Stephen Boyd" <sboyd@kernel.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] time: Fix off-by-one in compat settimeofday() usec validation
Date: Mon, 22 Jun 2026 13:01:03 +0200	[thread overview]
Message-ID: <81e1fa9a-af45-4e4a-8f94-51eb33aaf4ac@app.fastmail.com> (raw)
In-Reply-To: <20260622103348.120255-1-wangyan01@kylinos.cn>

On Mon, Jun 22, 2026, at 12:33, Wang Yan wrote:
> The compat version of settimeofday() uses '>' instead of '>=' when
> validating tv_usec against USEC_PER_SEC, allowing the value 1000000
> to pass the check. After the subsequent conversion to nanoseconds
> (tv_nsec *= NSEC_PER_USEC), this results in tv_nsec == NSEC_PER_SEC,
> which violates the timespec invariant that tv_nsec must be strictly
> less than NSEC_PER_SEC.
>
> The native settimeofday() was already fixed in commit ce4abda5e126
> ("time: Fix off-by-one in settimeofday() usec validation"), but the
> compat counterpart was missed.
>
> Fix it by using '>=' to reject tv_usec values outside the valid
> range [0, USEC_PER_SEC - 1].
>
> Fixes: 5e0fb1b57bea ("y2038: time: avoid timespec usage in settimeofday()")
> Signed-off-by: Wang Yan <wangyan01@kylinos.cn>

Acked-by: Arnd Bergmann <arnd@arndb.de>

probably also

Cc: stable@vger.kernel.org

  reply	other threads:[~2026-06-22 11:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-22 10:33 Wang Yan
2026-06-22 11:01 ` Arnd Bergmann [this message]
2026-06-22 11:23 ` [tip: timers/urgent] " tip-bot2 for Wang Yan

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=81e1fa9a-af45-4e4a-8f94-51eb33aaf4ac@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tglx@kernel.org \
    --cc=wangyan01@kylinos.cn \
    /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

all inboxes | Powered by JetHome®