lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANDhNCqY5TzY5qWLrZMJYrmwW3XUStvrut2Dd8pc9T+LMaibpg@mail.gmail.com>
Date: Thu, 26 Jun 2025 22:00:47 -0700
From: John Stultz <jstultz@...gle.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>, netdev@...r.kernel.org, 
	Richard Cochran <richardcochran@...il.com>, Christopher Hall <christopher.s.hall@...el.com>, 
	Frederic Weisbecker <frederic@...nel.org>, Anna-Maria Behnsen <anna-maria@...utronix.de>, 
	Miroslav Lichvar <mlichvar@...hat.com>, Werner Abt <werner.abt@...nberg-usa.com>, 
	David Woodhouse <dwmw2@...radead.org>, Stephen Boyd <sboyd@...nel.org>, 
	Thomas Weißschuh <thomas.weissschuh@...utronix.de>, 
	Kurt Kanzenbach <kurt@...utronix.de>, Nam Cao <namcao@...utronix.de>, 
	Antoine Tenart <atenart@...nel.org>
Subject: Re: [patch V3 08/11] timekeeping: Prepare do_adtimex() for auxiliary clocks

On Wed, Jun 25, 2025 at 11:38 AM Thomas Gleixner <tglx@...utronix.de> wrote:
>
> Exclude ADJ_TAI, leap seconds and PPS functionality as they make no sense
> in the context of auxiliary clocks and provide a time stamp based on the
> actual clock.
>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> ---
>  kernel/time/timekeeping.c |   39 ++++++++++++++++++++++++++++++++++++---
>  1 file changed, 36 insertions(+), 3 deletions(-)
> ---
>
> --- a/kernel/time/timekeeping.c
> +++ b/kernel/time/timekeeping.c
> @@ -2562,6 +2573,21 @@ static int timekeeping_validate_timex(co
>                         return -EINVAL;
>         }
>
> +       if (!aux_clock)
> +               return 0;
> +
> +       /* Auxiliary clocks are similar to TAI and do not have leap seconds */
> +       if (txc->status & (STA_INS | STA_DEL))
> +               return -EINVAL;
> +
> +       /* No TAI offset setting */
> +       if (txc->modes & ADJ_TAI)
> +               return -EINVAL;
> +
> +       /* No PPS support either */
> +       if (txc->status & (STA_PPSFREQ | STA_PPSTIME))
> +               return -EINVAL;
> +

Just a taste issue, but I think it would be more clear if these checks
were nested under the
  if (aux_clock) {
      ...
  }

As otherwise if you read-over and miss the !aux_clock early return it
seems like you're erroring out on normally valid cases.

But it's a minor thing.


> @@ -2592,15 +2618,22 @@ static int __do_adjtimex(struct tk_data
>         struct timekeeper *tks = &tkd->shadow_timekeeper;
>         struct timespec64 ts;
>         s32 orig_tai, tai;
> +       bool aux_clock;
>         int ret;
>
> +       aux_clock = IS_ENABLED(CONFIG_POSIX_AUX_CLOCKS) && tkd->timekeeper.id != TIMEKEEPER_CORE;
> +

Again, the is_core_timekeeper() check would be helpful here (or
alternatively is_aux_timekeeper())

Otherwise:
Acked-by: John Stultz <jstultz@...gle.com>

thanks
-john

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ