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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: 
 <172338466622.1168419.14975326329561608062.tglx@xen13.tec.linutronix.de>
Date: Sun, 11 Aug 2024 15:58:06 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org
Subject: [GIT pull] timers/urgent for v6.11-rc3

Linus,

please pull the latest timers/urgent branch from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-2024-08-11

up to:  5916be8a53de: timekeeping: Fix bogus clock_was_set() invocation in do_adjtimex()


Updates for time keeping:

  - Fix a couple of issues in the NTP code where user supplied values are
    neither sanity checked nor clamped to the operating range. This results
    in integer overflows and eventualy NTP getting out of sync.

    According to the history the sanity checks had been removed in favor of
    clamping the values, but the clamping never worked correctly under all
    circumstances. The NTP people asked to not bring the sanity checks back
    as it might break existing applications.

    Make the clamping work correctly and add it where it's missing

  - If adjtimex() sets the clock it has to trigger the hrtimer subsystem so
    it can adjust and if the clock was set into the future expire timers if
    needed. The caller should provide a bitmask to tell hrtimers which
    clocks have been adjusted. adjtimex() uses not the proper constant and
    uses CLOCK_REALTIME instead, which is 0. So hrtimers adjusts only the
    clocks, but does not check for expired timers, which might make them
    expire really late. Use the proper bitmask constant instead.


Thanks,

	tglx

------------------>
Justin Stitt (2):
      ntp: Clamp maxerror and esterror to operating range
      ntp: Safeguard against time_constant overflow

Thomas Gleixner (1):
      timekeeping: Fix bogus clock_was_set() invocation in do_adjtimex()


 kernel/time/ntp.c         | 9 ++++-----
 kernel/time/timekeeping.c | 2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 406dccb79c2b..8d2dd214ec68 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -727,17 +727,16 @@ static inline void process_adjtimex_modes(const struct __kernel_timex *txc,
 	}
 
 	if (txc->modes & ADJ_MAXERROR)
-		time_maxerror = txc->maxerror;
+		time_maxerror = clamp(txc->maxerror, 0, NTP_PHASE_LIMIT);
 
 	if (txc->modes & ADJ_ESTERROR)
-		time_esterror = txc->esterror;
+		time_esterror = clamp(txc->esterror, 0, NTP_PHASE_LIMIT);
 
 	if (txc->modes & ADJ_TIMECONST) {
-		time_constant = txc->constant;
+		time_constant = clamp(txc->constant, 0, MAXTC);
 		if (!(time_status & STA_NANO))
 			time_constant += 4;
-		time_constant = min(time_constant, (long)MAXTC);
-		time_constant = max(time_constant, 0l);
+		time_constant = clamp(time_constant, 0, MAXTC);
 	}
 
 	if (txc->modes & ADJ_TAI &&
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 2fa87dcfeda9..5391e4167d60 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -2606,7 +2606,7 @@ int do_adjtimex(struct __kernel_timex *txc)
 		clock_set |= timekeeping_advance(TK_ADV_FREQ);
 
 	if (clock_set)
-		clock_was_set(CLOCK_REALTIME);
+		clock_was_set(CLOCK_SET_WALL);
 
 	ntp_notify_cmos_timer();
 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ