RE: [PATCH] ntp: use memset and offsetof init

2021-02-08 Thread David Laight
From: Thomas Gleixner > Sent: 05 February 2021 17:34 > > On Wed, Jan 20 2021 at 10:51, Yejune Deng wrote: > > In pps_fill_timex(), use memset and offsetof instead of '= 0'. > > > > Signed-off-by: Yejune Deng > > --- > > kernel/time/ntp.c | 13 + > > 1 file changed, 5 insertions(+),

Re: [PATCH] ntp: Use freezable workqueue for RTC synchronization

2021-02-05 Thread Rafael J. Wysocki
On Tue, Jan 26, 2021 at 6:48 AM Geert Uytterhoeven wrote: > > The bug fixed by commit e3fab2f3de081e98 ("ntp: Fix RTC synchronization > on 32-bit platforms") revealed an underlying issue: RTC synchronization > may happen anytime, even while the system is partially suspended

Re: [PATCH] ntp: use memset and offsetof init

2021-02-05 Thread Thomas Gleixner
On Wed, Jan 20 2021 at 10:51, Yejune Deng wrote: > In pps_fill_timex(), use memset and offsetof instead of '= 0'. > > Signed-off-by: Yejune Deng > --- > kernel/time/ntp.c | 13 + > 1 file changed, 5 insertions(+), 8 deletions(-) > > diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c

[tip: timers/urgent] ntp: Use freezable workqueue for RTC synchronization

2021-02-05 Thread tip-bot2 for Geert Uytterhoeven
Committer: Thomas Gleixner CommitterDate: Fri, 05 Feb 2021 18:03:13 +01:00 ntp: Use freezable workqueue for RTC synchronization The bug fixed by commit e3fab2f3de081e98 ("ntp: Fix RTC synchronization on 32-bit platforms") revealed an underlying issue: RTC synchronization may happ

[PATCH] ntp: Use freezable workqueue for RTC synchronization

2021-01-25 Thread Geert Uytterhoeven
The bug fixed by commit e3fab2f3de081e98 ("ntp: Fix RTC synchronization on 32-bit platforms") revealed an underlying issue: RTC synchronization may happen anytime, even while the system is partially suspended. On systems where the RTC is connected to an I2C bus, the I2C bus controller m

[kbuild] Re: [PATCH] ntp: use memset and offsetof init

2021-01-20 Thread Dan Carpenter
Hi Yejune, url: https://github.com/0day-ci/linux/commits/Yejune-Deng/ntp-use-memset-and-offsetof-init/20210120-110830 base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 3cabca87b329cbcbdf295be0094adbd72c7b1f67 config: i386-randconfig-m021-20210120 (attached as .config

[PATCH] ntp: use memset and offsetof init

2021-01-19 Thread Yejune Deng
In pps_fill_timex(), use memset and offsetof instead of '= 0'. Signed-off-by: Yejune Deng --- kernel/time/ntp.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 87389b9e21ab..3416c0381104 100644 --- a/kernel/time/ntp.c

[tip: timers/urgent] ntp: Fix RTC synchronization on 32-bit platforms

2021-01-12 Thread tip-bot2 for Geert Uytterhoeven
Committer: Thomas Gleixner CommitterDate: Tue, 12 Jan 2021 21:13:01 +01:00 ntp: Fix RTC synchronization on 32-bit platforms Due to an integer overflow, RTC synchronization now happens every 2s instead of the intended 11 minutes. Fix this by forcing 64-bit arithmetic for the sync period

Re: [PATCH] ntp: Fix RTC synchronization on 32-bit platforms

2021-01-11 Thread Geert Uytterhoeven
On Mon, Jan 11, 2021 at 11:40 AM Geert Uytterhoeven wrote: > Due to an integer overflow, RTC synchronization now happens every 2s > instead of the intended 11 minutes. Fix this by forcing 64-bit > arithmetic for the sync period calculation. > > Fixes: c9e6189fb03123a7 (&qu

Re: [patch 5/8] ntp: Make the RTC synchronization more reliable

2021-01-11 Thread Geert Uytterhoeven
Hi Thomas, On Mon, Jan 11, 2021 at 11:12 AM Thomas Gleixner wrote: > On Tue, Dec 29 2020 at 20:41, Geert Uytterhoeven wrote: > >> Reported-by: Miroslav Lichvar > >> Signed-off-by: Thomas Gleixner > > > > Thanks for your patch, which is now commit c9e6189

[PATCH] ntp: Fix RTC synchronization on 32-bit platforms

2021-01-11 Thread Geert Uytterhoeven
Due to an integer overflow, RTC synchronization now happens every 2s instead of the intended 11 minutes. Fix this by forcing 64-bit arithmetic for the sync period calculation. Fixes: c9e6189fb03123a7 ("ntp: Make the RTC synchronization more reliable") Signed-off-by: Geert Uy

Re: [patch 5/8] ntp: Make the RTC synchronization more reliable

2021-01-11 Thread Thomas Gleixner
On Tue, Dec 29 2020 at 20:41, Geert Uytterhoeven wrote: > Hi Thomas, >> Reported-by: Miroslav Lichvar >> Signed-off-by: Thomas Gleixner > > Thanks for your patch, which is now commit c9e6189fb03123a7 ("ntp: Make > the RTC synchronization more reliable").

Re: [patch 5/8] ntp: Make the RTC synchronization more reliable

2020-12-29 Thread Geert Uytterhoeven
Hi Thomas, On Sun, Dec 6, 2020 at 11:10 PM Thomas Gleixner wrote: > Miroslav reported that the periodic RTC synchronization in the NTP code > fails more often than not to hit the specified update window. > > The reason is that the code uses delayed_work to schedule the update w

[tip: timers/core] ntp: Fix prototype in the !CONFIG_GENERIC_CMOS_UPDATE case

2020-12-13 Thread tip-bot2 for Ingo Molnar
Committer: Ingo Molnar CommitterDate: Sun, 13 Dec 2020 10:16:31 +01:00 ntp: Fix prototype in the !CONFIG_GENERIC_CMOS_UPDATE case In the !CONFIG_GENERIC_CMOS_UPDATE case the update_persistent_clock64() function gets defined as a stub in ntp.c - make the prototype in conditional

[tip: timers/core] ntp: Fix build error

2020-12-12 Thread tip-bot2 for Ingo Molnar
Committer: Ingo Molnar CommitterDate: Sat, 12 Dec 2020 18:35:12 +01:00 ntp: Fix build error Signed-off-by: Ingo Molnar --- include/linux/timekeeping.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 7f7e4a3..929d3f3 100644

[tip: timers/core] ntp: Make the RTC sync offset less obscure

2020-12-11 Thread tip-bot2 for Thomas Gleixner
Committer: Thomas Gleixner CommitterDate: Fri, 11 Dec 2020 10:40:53 +01:00 ntp: Make the RTC sync offset less obscure The current RTC set_offset_nsec value is not really intuitive to understand. tsched twrite(t2.tv_sec - 1) t2 (seconds increment) The offset is calculated from

[tip: timers/core] ntp: Consolidate the RTC update implementation

2020-12-11 Thread tip-bot2 for Thomas Gleixner
Committer: Thomas Gleixner CommitterDate: Fri, 11 Dec 2020 10:40:53 +01:00 ntp: Consolidate the RTC update implementation The code for the legacy RTC and the RTC class based update are pretty much the same. Consolidate the common parts into one function and just invoke the actual setter functions

[tip: timers/core] ntp: Make the RTC synchronization more reliable

2020-12-11 Thread tip-bot2 for Thomas Gleixner
Committer: Thomas Gleixner CommitterDate: Fri, 11 Dec 2020 10:40:52 +01:00 ntp: Make the RTC synchronization more reliable Miroslav reported that the periodic RTC synchronization in the NTP code fails more often than not to hit the specified update window. The reason is that the code uses

[tip: timers/core] ntp, rtc: Move rtc_set_ntp_time() to ntp code

2020-12-11 Thread tip-bot2 for Thomas Gleixner
Committer: Thomas Gleixner CommitterDate: Fri, 11 Dec 2020 10:40:52 +01:00 ntp, rtc: Move rtc_set_ntp_time() to ntp code rtc_set_ntp_time() is not really RTC functionality as the code is just a user of RTC. Move it into the NTP code which allows further cleanups. Requested-by: Alexandre Belloni

Re: [patch 8/8] ntp: Consolidate the RTC update implementation

2020-12-11 Thread Thomas Gleixner
On Mon, Dec 07 2020 at 17:05, Jason Gunthorpe wrote: > On Sun, Dec 06, 2020 at 10:46:21PM +0100, Thomas Gleixner wrote: >> static void sync_hw_clock(struct work_struct *work) >> { >> +static unsigned long offset_nsec = NSEC_PER_SEC / 2; > > A comment here explaining this is the default:

Re: [patch 0/8] ntp/rtc: Fixes and cleanups

2020-12-09 Thread Thomas Gleixner
t; > 3) Reduce the default transport time >> > >> > 4) Switch the NTP periodic sync code to a hrtimer/work combo >> > >> > 5) Move rtc_set_npt_time() to the ntp code >> > 6) Make the update offset more intuitive >> > 7) Simpl

Re: [patch 0/8] ntp/rtc: Fixes and cleanups

2020-12-08 Thread Alexandre Belloni
> > it. Of course there are better methods to do that and it can be > > completely done in user space. > > > > Unfortunately it's not that simple as this would be a user visible > > change, so making it at least halfways correct. > > > >

Re: [patch 6/8] ntp, rtc: Move rtc_set_ntp_time() to ntp code

2020-12-08 Thread Alexandre Belloni
On 07/12/2020 16:59:52-0400, Jason Gunthorpe wrote: > On Sun, Dec 06, 2020 at 10:46:19PM +0100, Thomas Gleixner wrote: > > rtc_set_ntp_time() is not really RTC functionality as the code is just a > > user of RTC. Move it into the NTP code which allows further cleanups. >

Re: [patch 0/8] ntp/rtc: Fixes and cleanups

2020-12-08 Thread Thomas Gleixner
rtunately it's not that simple as this would be a user visible > change, so making it at least halfways correct. > > 3) Alexandre requested to move that code into the NTP code as this is not > really RTC functionality and just usage of the RTC API. > > 4) The up

Re: [patch 8/8] ntp: Consolidate the RTC update implementation

2020-12-07 Thread Jason Gunthorpe
On Sun, Dec 06, 2020 at 10:46:21PM +0100, Thomas Gleixner wrote: > /* > * If we have an externally synchronized Linux clock, then update RTC clock > * accordingly every ~11 minutes. Generally RTCs can only store second > @@ -686,6 +621,10 @@ static bool sync_cmos_clock(void) > */ > static

Re: [patch 6/8] ntp, rtc: Move rtc_set_ntp_time() to ntp code

2020-12-07 Thread Jason Gunthorpe
On Sun, Dec 06, 2020 at 10:46:19PM +0100, Thomas Gleixner wrote: > rtc_set_ntp_time() is not really RTC functionality as the code is just a > user of RTC. Move it into the NTP code which allows further cleanups. > > Requested-by: Alexandre Belloni > Signed-off-by:

Re: [patch 5/8] ntp: Make the RTC synchronization more reliable

2020-12-07 Thread Jason Gunthorpe
On Sun, Dec 06, 2020 at 10:46:18PM +0100, Thomas Gleixner wrote: > Miroslav reported that the periodic RTC synchronization in the NTP code > fails more often than not to hit the specified update window. > > The reason is that the code uses delayed_work to schedule the update w

Re: [patch 5/8] ntp: Make the RTC synchronization more reliable

2020-12-07 Thread Miroslav Lichvar
On Sun, Dec 06, 2020 at 10:46:18PM +0100, Thomas Gleixner wrote: > Switch it to an hrtimer instead which schedules the actual update work. The > hrtimer will expire precisely (max 1 jiffie delay when high resolution > timers are not available). The actual scheduling delay of the work is the > same

[patch 5/8] ntp: Make the RTC synchronization more reliable

2020-12-06 Thread Thomas Gleixner
Miroslav reported that the periodic RTC synchronization in the NTP code fails more often than not to hit the specified update window. The reason is that the code uses delayed_work to schedule the update which needs to be in thread context as the underlying RTC might be connected via a slow bus

[patch 7/8] ntp: Make the RTC sync offset less obscure

2020-12-06 Thread Thomas Gleixner
.tv_nsec = set_offset_nsec}; *to_set = timespec64_add(*now, delay); @@ -557,11 +568,11 @@ static inline bool rtc_tv_nsec_ok(long s /* * rtc_set_ntp_time - Save NTP synchronized time to the RTC */ -static int rtc_set_ntp_time(struct timespec64 now, unsign

[patch 8/8] ntp: Consolidate the RTC update implementation

2020-12-06 Thread Thomas Gleixner
+int __weak update_persistent_clock64(struct timespec64 now64) +{ + return -ENODEV; +} +#else +static inline int update_persistent_clock64(struct timespec64 now64) +{ + return -ENODEV; +} +#endif + #ifdef CONFIG_RTC_SYSTOHC -/* - * rtc_set_ntp_time - Save NTP synchronized time

[patch 6/8] ntp, rtc: Move rtc_set_ntp_time() to ntp code

2020-12-06 Thread Thomas Gleixner
rtc_set_ntp_time() is not really RTC functionality as the code is just a user of RTC. Move it into the NTP code which allows further cleanups. Requested-by: Alexandre Belloni Signed-off-by: Thomas Gleixner --- drivers/rtc/Makefile |1 drivers/rtc/systohc.c | 61

[patch 0/8] ntp/rtc: Fixes and cleanups

2020-12-06 Thread Thomas Gleixner
that code into the NTP code as this is not really RTC functionality and just usage of the RTC API. 4) The update offset itself was questioned, but the time between the write and the next seconds increment in the RTC is fundamentaly a hardware property. The transport time, which

NTP adjustments to CLOCK_MONATONIC

2020-08-27 Thread David Laight
was massive - I have to force a difference of around 8000ns/10ms to see similar behaviour. The only explanation I can guess at is that it was subject to NTP's maximum slew rate of 0.5ms/sec (1/2000) while NTP was aligning CLOCK_REALTIME. While the NTP adjustments for clock frequency drift aren't

Re: ntp audit spew.

2019-09-24 Thread Paul Moore
ld=2453141035832 new=2372389610455 [49926.567273] audit: type=1333 > > > audit(1569253317.638:225): op=freq old=-2413071187316 new=-2403561671476 > > > > > > This gets emitted every time ntp makes an adjustment, which is apparently > > > very frequent on some host

ntp audit spew.

2019-09-23 Thread Dave Jones
=2372389610455 [49926.567273] audit: type=1333 audit(1569253317.638:225): op=freq old=-2413071187316 new=-2403561671476 This gets emitted every time ntp makes an adjustment, which is apparently very frequent on some hosts. Audit isn't even enabled on these machines. # auditctl -l No rules # auditctl -s

[PATCH 3.16 090/132] ntp: Allow TAI-UTC offset to be set to zero

2019-09-20 Thread Ben Hutchings
3.16.74-rc1 review patch. If anyone has any objections, please let me know. -- From: Miroslav Lichvar commit fdc6bae940ee9eb869e493990540098b8c0fd6ab upstream. The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. It is typically set by NTP/PTP

[PATCH 4.9 047/223] ntp: Limit TAI-UTC offset

2019-08-02 Thread Greg Kroah-Hartman
[ Upstream commit d897a4ab11dc8a9fda50d2eccc081a96a6385998 ] Don't allow the TAI-UTC offset of the system clock to be set by adjtimex() to a value larger than 10 seconds. This prevents an overflow in the conversion to int, prevents the CLOCK_TAI clock from getting too far ahead of the

[PATCH 4.4 037/158] ntp: Limit TAI-UTC offset

2019-08-02 Thread Greg Kroah-Hartman
[ Upstream commit d897a4ab11dc8a9fda50d2eccc081a96a6385998 ] Don't allow the TAI-UTC offset of the system clock to be set by adjtimex() to a value larger than 10 seconds. This prevents an overflow in the conversion to int, prevents the CLOCK_TAI clock from getting too far ahead of the

[PATCH 4.14 064/293] ntp: Limit TAI-UTC offset

2019-07-29 Thread Greg Kroah-Hartman
[ Upstream commit d897a4ab11dc8a9fda50d2eccc081a96a6385998 ] Don't allow the TAI-UTC offset of the system clock to be set by adjtimex() to a value larger than 10 seconds. This prevents an overflow in the conversion to int, prevents the CLOCK_TAI clock from getting too far ahead of the

[PATCH 4.19 096/271] ntp: Limit TAI-UTC offset

2019-07-24 Thread Greg Kroah-Hartman
[ Upstream commit d897a4ab11dc8a9fda50d2eccc081a96a6385998 ] Don't allow the TAI-UTC offset of the system clock to be set by adjtimex() to a value larger than 10 seconds. This prevents an overflow in the conversion to int, prevents the CLOCK_TAI clock from getting too far ahead of the

[PATCH 5.1 130/371] ntp: Limit TAI-UTC offset

2019-07-24 Thread Greg Kroah-Hartman
[ Upstream commit d897a4ab11dc8a9fda50d2eccc081a96a6385998 ] Don't allow the TAI-UTC offset of the system clock to be set by adjtimex() to a value larger than 10 seconds. This prevents an overflow in the conversion to int, prevents the CLOCK_TAI clock from getting too far ahead of the

[PATCH 5.2 143/413] ntp: Limit TAI-UTC offset

2019-07-24 Thread Greg Kroah-Hartman
[ Upstream commit d897a4ab11dc8a9fda50d2eccc081a96a6385998 ] Don't allow the TAI-UTC offset of the system clock to be set by adjtimex() to a value larger than 10 seconds. This prevents an overflow in the conversion to int, prevents the CLOCK_TAI clock from getting too far ahead of the

[PATCH AUTOSEL 4.4 36/53] ntp: Limit TAI-UTC offset

2019-07-15 Thread Sasha Levin
From: Miroslav Lichvar [ Upstream commit d897a4ab11dc8a9fda50d2eccc081a96a6385998 ] Don't allow the TAI-UTC offset of the system clock to be set by adjtimex() to a value larger than 10 seconds. This prevents an overflow in the conversion to int, prevents the CLOCK_TAI clock from getting

[PATCH AUTOSEL 4.9 46/73] ntp: Limit TAI-UTC offset

2019-07-15 Thread Sasha Levin
From: Miroslav Lichvar [ Upstream commit d897a4ab11dc8a9fda50d2eccc081a96a6385998 ] Don't allow the TAI-UTC offset of the system clock to be set by adjtimex() to a value larger than 10 seconds. This prevents an overflow in the conversion to int, prevents the CLOCK_TAI clock from getting

[PATCH AUTOSEL 4.14 063/105] ntp: Limit TAI-UTC offset

2019-07-15 Thread Sasha Levin
From: Miroslav Lichvar [ Upstream commit d897a4ab11dc8a9fda50d2eccc081a96a6385998 ] Don't allow the TAI-UTC offset of the system clock to be set by adjtimex() to a value larger than 10 seconds. This prevents an overflow in the conversion to int, prevents the CLOCK_TAI clock from getting

[PATCH AUTOSEL 4.19 094/158] ntp: Limit TAI-UTC offset

2019-07-15 Thread Sasha Levin
From: Miroslav Lichvar [ Upstream commit d897a4ab11dc8a9fda50d2eccc081a96a6385998 ] Don't allow the TAI-UTC offset of the system clock to be set by adjtimex() to a value larger than 10 seconds. This prevents an overflow in the conversion to int, prevents the CLOCK_TAI clock from getting

[PATCH AUTOSEL 5.1 128/219] ntp: Limit TAI-UTC offset

2019-07-15 Thread Sasha Levin
From: Miroslav Lichvar [ Upstream commit d897a4ab11dc8a9fda50d2eccc081a96a6385998 ] Don't allow the TAI-UTC offset of the system clock to be set by adjtimex() to a value larger than 10 seconds. This prevents an overflow in the conversion to int, prevents the CLOCK_TAI clock from getting

[PATCH AUTOSEL 5.2 146/249] ntp: Limit TAI-UTC offset

2019-07-15 Thread Sasha Levin
From: Miroslav Lichvar [ Upstream commit d897a4ab11dc8a9fda50d2eccc081a96a6385998 ] Don't allow the TAI-UTC offset of the system clock to be set by adjtimex() to a value larger than 10 seconds. This prevents an overflow in the conversion to int, prevents the CLOCK_TAI clock from getting

[tip:timers/core] ntp: Limit TAI-UTC offset

2019-06-22 Thread tip-bot for Miroslav Lichvar
Commit-ID: d897a4ab11dc8a9fda50d2eccc081a96a6385998 Gitweb: https://git.kernel.org/tip/d897a4ab11dc8a9fda50d2eccc081a96a6385998 Author: Miroslav Lichvar AuthorDate: Tue, 18 Jun 2019 17:47:13 +0200 Committer: Thomas Gleixner CommitDate: Sat, 22 Jun 2019 11:28:53 +0200 ntp: Limit TAI

[PATCH 4.9 020/117] ntp: Allow TAI-UTC offset to be set to zero

2019-06-20 Thread Greg Kroah-Hartman
[ Upstream commit fdc6bae940ee9eb869e493990540098b8c0fd6ab ] The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. It is typically set by NTP/PTP implementations and it is automatically updated by the kernel on leap seconds. The initial value is zero (which applications may

[PATCH 4.4 12/84] ntp: Allow TAI-UTC offset to be set to zero

2019-06-20 Thread Greg Kroah-Hartman
[ Upstream commit fdc6bae940ee9eb869e493990540098b8c0fd6ab ] The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. It is typically set by NTP/PTP implementations and it is automatically updated by the kernel on leap seconds. The initial value is zero (which applications may

[PATCH] ntp: Limit TAI-UTC offset

2019-06-18 Thread Miroslav Lichvar
Don't allow the TAI-UTC offset of the system clock to be set by adjtimex() to a value larger than 10 seconds. This prevents an overflow in the conversion to int, prevents the CLOCK_TAI clock from getting too far ahead of the CLOCK_REALTIME clock, and it is still large enough to allow leap

Re: [PATCH] time: fix a assignment error in ntp module

2019-06-17 Thread Thomas Gleixner
Miroslav, On Mon, 17 Jun 2019, Miroslav Lichvar wrote: > On Mon, Jun 17, 2019 at 02:14:57PM +0200, Thomas Gleixner wrote: > > On Mon, 17 Jun 2019, 维康石 wrote: > > > Yes,the >UINT_MAX value can be passed by > > > syscall adjtimex->do_adjtimex->__do_adjtimex->process_adjtimex_modes by > > > the >

Re: [PATCH] time: fix a assignment error in ntp module

2019-06-17 Thread Miroslav Lichvar
On Mon, Jun 17, 2019 at 02:14:57PM +0200, Thomas Gleixner wrote: > On Mon, 17 Jun 2019, 维康石 wrote: > > Yes,the >UINT_MAX value can be passed by > > syscall adjtimex->do_adjtimex->__do_adjtimex->process_adjtimex_modes by the > > proper arugments. > > So there is clearly some sanity check missing,

Re: [PATCH] time: fix a assignment error in ntp module

2019-06-17 Thread Thomas Gleixner
On Mon, 17 Jun 2019, 维康石 wrote: A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? A: No. Q: Should I include quotations after my reply?

Re: [PATCH] time: fix a assignment error in ntp module

2019-06-17 Thread Thomas Gleixner
On Mon, 22 Apr 2019, Weikang shi wrote: > From: swkhack > > It is meanless to check a 64bit(txc->constant) value is postive > when the value has to be assigned to a 32 bit variable(*time_tai). > So I make a temp type conversion before the compare. What? Casting it to int makes it more

[PATCH 4.14 25/81] ntp: Allow TAI-UTC offset to be set to zero

2019-06-13 Thread Greg Kroah-Hartman
[ Upstream commit fdc6bae940ee9eb869e493990540098b8c0fd6ab ] The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. It is typically set by NTP/PTP implementations and it is automatically updated by the kernel on leap seconds. The initial value is zero (which applications may

[PATCH 4.19 032/118] ntp: Allow TAI-UTC offset to be set to zero

2019-06-13 Thread Greg Kroah-Hartman
[ Upstream commit fdc6bae940ee9eb869e493990540098b8c0fd6ab ] The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. It is typically set by NTP/PTP implementations and it is automatically updated by the kernel on leap seconds. The initial value is zero (which applications may

[PATCH 5.1 041/155] ntp: Allow TAI-UTC offset to be set to zero

2019-06-13 Thread Greg Kroah-Hartman
[ Upstream commit fdc6bae940ee9eb869e493990540098b8c0fd6ab ] The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. It is typically set by NTP/PTP implementations and it is automatically updated by the kernel on leap seconds. The initial value is zero (which applications may

[PATCH AUTOSEL 5.1 042/186] ntp: Allow TAI-UTC offset to be set to zero

2019-06-01 Thread Sasha Levin
From: Miroslav Lichvar [ Upstream commit fdc6bae940ee9eb869e493990540098b8c0fd6ab ] The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. It is typically set by NTP/PTP implementations and it is automatically updated by the kernel on leap seconds. The initial value is zero

[PATCH AUTOSEL 5.0 039/173] ntp: Allow TAI-UTC offset to be set to zero

2019-06-01 Thread Sasha Levin
From: Miroslav Lichvar [ Upstream commit fdc6bae940ee9eb869e493990540098b8c0fd6ab ] The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. It is typically set by NTP/PTP implementations and it is automatically updated by the kernel on leap seconds. The initial value is zero

[PATCH AUTOSEL 4.14 26/99] ntp: Allow TAI-UTC offset to be set to zero

2019-06-01 Thread Sasha Levin
From: Miroslav Lichvar [ Upstream commit fdc6bae940ee9eb869e493990540098b8c0fd6ab ] The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. It is typically set by NTP/PTP implementations and it is automatically updated by the kernel on leap seconds. The initial value is zero

[PATCH AUTOSEL 4.9 21/74] ntp: Allow TAI-UTC offset to be set to zero

2019-06-01 Thread Sasha Levin
From: Miroslav Lichvar [ Upstream commit fdc6bae940ee9eb869e493990540098b8c0fd6ab ] The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. It is typically set by NTP/PTP implementations and it is automatically updated by the kernel on leap seconds. The initial value is zero

[PATCH AUTOSEL 4.4 13/56] ntp: Allow TAI-UTC offset to be set to zero

2019-06-01 Thread Sasha Levin
From: Miroslav Lichvar [ Upstream commit fdc6bae940ee9eb869e493990540098b8c0fd6ab ] The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. It is typically set by NTP/PTP implementations and it is automatically updated by the kernel on leap seconds. The initial value is zero

[PATCH AUTOSEL 4.19 033/141] ntp: Allow TAI-UTC offset to be set to zero

2019-06-01 Thread Sasha Levin
From: Miroslav Lichvar [ Upstream commit fdc6bae940ee9eb869e493990540098b8c0fd6ab ] The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. It is typically set by NTP/PTP implementations and it is automatically updated by the kernel on leap seconds. The initial value is zero

[tip:timers/urgent] ntp: Allow TAI-UTC offset to be set to zero

2019-05-09 Thread tip-bot for Miroslav Lichvar
Commit-ID: fdc6bae940ee9eb869e493990540098b8c0fd6ab Gitweb: https://git.kernel.org/tip/fdc6bae940ee9eb869e493990540098b8c0fd6ab Author: Miroslav Lichvar AuthorDate: Wed, 17 Apr 2019 10:48:33 +0200 Committer: Thomas Gleixner CommitDate: Thu, 9 May 2019 10:46:58 +0200 ntp: Allow TAI-UTC

Re: [PATCH] time: fix a assignment error in ntp module

2019-04-24 Thread Thomas Gleixner
On Mon, 22 Apr 2019, Weikang shi wrote: > From: swkhack > > It is meanless to check a 64bit(txc->constant) value is postive > when the value has to be assigned to a 32 bit variable(*time_tai). > So I make a temp type conversion before the compare. Errm no. This is missing a proper range check

[PATCH] time: fix a assignment error in ntp module

2019-04-22 Thread Weikang shi
From: swkhack It is meanless to check a 64bit(txc->constant) value is postive when the value has to be assigned to a 32 bit variable(*time_tai). So I make a temp type conversion before the compare. Signed-off-by: swkhack --- kernel/time/ntp.c | 2 +- 1 file changed, 1 insertion(+), 1

Re: [PATCH] ntp: Allow TAI-UTC offset to be set to zero

2019-04-18 Thread Ondrej Mosnacek
Change the ADJ_TAI check to accept zero as a valid TAI-UTC offset in > > > > order to allow setting it back to the initial value. > > > > > Thanks for sending the patch! Maybe you (or the committer) could > > > consider adding: > > > > > > Fixes

Re: [PATCH] ntp: Allow TAI-UTC offset to be set to zero

2019-04-18 Thread Thomas Gleixner
t; order to allow setting it back to the initial value. > > > Thanks for sending the patch! Maybe you (or the committer) could > > consider adding: > > > > Fixes: 153b5d054ac2 ("ntp: support for TAI") > > To me the change looks more like an extension of the A

Re: [PATCH] ntp: Allow TAI-UTC offset to be set to zero

2019-04-18 Thread Miroslav Lichvar
e patch! Maybe you (or the committer) could > consider adding: > > Fixes: 153b5d054ac2 ("ntp: support for TAI") To me the change looks more like an extension of the API, rather than a bug fix, so I'd leave that up to the committer. -- Miroslav Lichvar

Re: [PATCH] ntp: Allow TAI-UTC offset to be set to zero

2019-04-17 Thread Ondrej Mosnacek
On Wed, Apr 17, 2019 at 10:48 AM Miroslav Lichvar wrote: > The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. > It is typically set by NTP/PTP implementations and it is automatically > updated by the kernel on leap seconds. The initial value is zero (which > appl

[PATCH] ntp: Allow TAI-UTC offset to be set to zero

2019-04-17 Thread Miroslav Lichvar
The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. It is typically set by NTP/PTP implementations and it is automatically updated by the kernel on leap seconds. The initial value is zero (which applications may interpret as unknown), but this value cannot be set by adjtimex

Re: [PATCH ghak10 v7 2/2] ntp: Audit NTP parameters adjustment

2019-04-10 Thread Thomas Gleixner
On Tue, 9 Apr 2019, Ondrej Mosnacek wrote: > diff --git a/include/linux/audit.h b/include/linux/audit.h > index 2c62c046..1c372ad7ebe9 100644 > --- a/include/linux/audit.h > +++ b/include/linux/audit.h > @@ -86,6 +86,26 @@ struct audit_field { > u32 op; > };

Re: [RFC PATCH ghak10 v6 2/2] ntp: Audit NTP parameters adjustment

2019-04-02 Thread Thomas Gleixner
es a few unnecessary writes into memory under > CONFIG_AUDIT=n, but if that is an issue I can boost the abstraction or > just add some #ifdefs to avoid that. No ifdefs please. Aside of that, why do you need all those details of the ntp internals in the first place? The changelog does not give me an answer to that. Thanks, tglx

Re: [RFC PATCH ghak10 v6 2/2] ntp: Audit NTP parameters adjustment

2019-04-01 Thread Ondrej Mosnacek
On Thu, Mar 28, 2019 at 1:02 AM Thomas Gleixner wrote: > On Thu, 7 Mar 2019, Ondrej Mosnacek wrote: > > > Emit an audit record every time selected NTP parameters are modified > > from userspace (via adjtimex(2) or clock_adjtime(2)). > > > > Such events wil

Re: [RFC PATCH ghak10 v6 2/2] ntp: Audit NTP parameters adjustment

2019-03-08 Thread Steve Grubb
On Thursday, March 7, 2019 7:32:54 AM EST Ondrej Mosnacek wrote: > Emit an audit record every time selected NTP parameters are modified > from userspace (via adjtimex(2) or clock_adjtime(2)). > > Such events will now generate records of type AUDIT_TIME_ADJNTPVAL > containing the f

[RFC PATCH ghak10 v6 2/2] ntp: Audit NTP parameters adjustment

2019-03-07 Thread Ondrej Mosnacek
Emit an audit record every time selected NTP parameters are modified from userspace (via adjtimex(2) or clock_adjtime(2)). Such events will now generate records of type AUDIT_TIME_ADJNTPVAL containing the following fields: - op -- which value was adjusted: - offset -- corresponding

Re: [RFC PATCH] ntp: Avoid undefined behaviour in second_overflow()

2019-03-06 Thread Richard Cochran
On Wed, Mar 06, 2019 at 02:37:21PM +0100, Arnd Bergmann wrote: > > There is also y2070 (many RTCs), y2100 (some other RTCs, especially > those that assume it's a leap year), and y2106. That's okay, Arnd. When the time comes you can come out of retirement and cash in, doing Y2.07, Y2.1, and

Re: [RFC PATCH] ntp: Avoid undefined behaviour in second_overflow()

2019-03-06 Thread Arnd Bergmann
On Wed, Mar 6, 2019 at 1:29 PM Thomas Gleixner wrote: > On Wed, 6 Mar 2019, Miroslav Lichvar wrote: > > On Tue, Mar 05, 2019 at 05:42:25PM -0800, John Stultz wrote: > So once Arnd is done with y2038, we'll ask him to look into y2262 :) There is also y2070 (many RTCs), y2100 (some other RTCs,

Re: [RFC PATCH] ntp: Avoid undefined behaviour in second_overflow()

2019-03-06 Thread Thomas Gleixner
On Wed, 6 Mar 2019, Miroslav Lichvar wrote: > On Tue, Mar 05, 2019 at 05:42:25PM -0800, John Stultz wrote: > > > --- a/kernel/time/ntp.c > > > +++ b/kernel/time/ntp.c > > > @@ -677,6 +677,8 @@ static inline void process_adjtimex_modes(const > > > struct timex *txc, s32 *time_tai > > > > > >

Re: [RFC PATCH] ntp: Avoid undefined behaviour in second_overflow()

2019-03-06 Thread Miroslav Lichvar
On Tue, Mar 05, 2019 at 05:42:25PM -0800, John Stultz wrote: > > --- a/kernel/time/ntp.c > > +++ b/kernel/time/ntp.c > > @@ -677,6 +677,8 @@ static inline void process_adjtimex_modes(const struct > > timex *txc, s32 *time_tai > > > > if (txc->modes & ADJ_MAXERROR) > >

Re: [RFC PATCH] ntp: Avoid undefined behaviour in second_overflow()

2019-03-05 Thread John Stultz
On Tue, Mar 5, 2019 at 5:29 PM Xiongfeng Wang wrote: > > When I ran Syzkaller testsuite, I got the following call trace. > > UBSAN: Undefined behaviour in kernel/time/ntp.c:457:16 > signed integer overflow: >

[RFC PATCH] ntp: Avoid undefined behaviour in second_overflow()

2019-03-05 Thread Xiongfeng Wang
When I ran Syzkaller testsuite, I got the following call trace. UBSAN: Undefined behaviour in kernel/time/ntp.c:457:16 signed integer overflow: 9223372036854775807 + 500 cannot be represented in type 'long int' CPU: 3

[tip:timers/core] ntp: Remove duplicated include

2018-12-18 Thread tip-bot for YueHaibing
Commit-ID: 07daef8b41e0d9e7802a448f6766504e7641a234 Gitweb: https://git.kernel.org/tip/07daef8b41e0d9e7802a448f6766504e7641a234 Author: YueHaibing AuthorDate: Sun, 9 Dec 2018 14:22:25 +0800 Committer: Thomas Gleixner CommitDate: Tue, 18 Dec 2018 12:59:33 +0100 ntp: Remove duplicated

[PATCH -next] ntp: remove duplicated include from ntp.c

2018-12-08 Thread YueHaibing
Remove duplicated include. Signed-off-by: YueHaibing --- kernel/time/ntp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index c5e0cba..bc3a3c3 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -17,7 +17,6 @@ #include #include #include

[Fwd: 11 minute NTP hw clock update racy?]

2018-08-28 Thread Joakim Tjernlund
No luck on linuxppc-dev, trying LKML ... Forwarded Message From: Joakim Tjernlund To: linuxppc-dev linuxppc-dev Subject: 11 minute NTP hw clock update racy? Date: Mon, 27 Aug 2018 10:01:12 +0200 We see corrupt HW clock time every now and then(really hard to reproduce) Our RTC

[Fwd: 11 minute NTP hw clock update racy?]

2018-08-28 Thread Joakim Tjernlund
No luck on linuxppc-dev, trying LKML ... Forwarded Message From: Joakim Tjernlund To: linuxppc-dev linuxppc-dev Subject: 11 minute NTP hw clock update racy? Date: Mon, 27 Aug 2018 10:01:12 +0200 We see corrupt HW clock time every now and then(really hard to reproduce) Our RTC

[PATCH RT 14/22] Revert "rt,ntp: Move call to schedule_delayed_work() to helper thread"

2018-08-06 Thread Julia Cartwright
From: Sebastian Andrzej Siewior 4.9.115-rt94-rc1 stable review patch. If you have any objection to the inclusion of this patch, let me know. --- 8< --- 8< --- 8< --- I've been looking at this in v3.10-RT where it got in. The patch description says |The ntp code for notify_c

[PATCH RT 14/22] Revert "rt,ntp: Move call to schedule_delayed_work() to helper thread"

2018-08-06 Thread Julia Cartwright
From: Sebastian Andrzej Siewior 4.9.115-rt94-rc1 stable review patch. If you have any objection to the inclusion of this patch, let me know. --- 8< --- 8< --- 8< --- I've been looking at this in v3.10-RT where it got in. The patch description says |The ntp code for notify_c

[PATCH 3/5] timekeeping/ntp: Constify some function arguments

2018-07-19 Thread John Stultz
(void) /* * Propagate a new txc->status value into the NTP state: */ -static inline void process_adj_status(struct timex *txc) +static inline void process_adj_status(const struct timex *txc) { if ((time_status & STA_PLL) && !(txc->status & STA_PLL)) {

[PATCH 2/5] ntp: Use kstrtos64 for s64 variable

2018-07-19 Thread John Stultz
From: Ondrej Mosnacek ...instead of kstrtol with a dirty cast. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Miroslav Lichvar Cc: Richard Cochran Cc: Prarit Bhargava Cc: Stephen Boyd Signed-off-by: Ondrej Mosnacek Signed-off-by: John Stultz --- kernel/time/ntp.c | 5 ++--- 1 file changed, 2

[PATCH 3/5] timekeeping/ntp: Constify some function arguments

2018-07-19 Thread John Stultz
(void) /* * Propagate a new txc->status value into the NTP state: */ -static inline void process_adj_status(struct timex *txc) +static inline void process_adj_status(const struct timex *txc) { if ((time_status & STA_PLL) && !(txc->status & STA_PLL)) {

[PATCH 2/5] ntp: Use kstrtos64 for s64 variable

2018-07-19 Thread John Stultz
From: Ondrej Mosnacek ...instead of kstrtol with a dirty cast. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Miroslav Lichvar Cc: Richard Cochran Cc: Prarit Bhargava Cc: Stephen Boyd Signed-off-by: Ondrej Mosnacek Signed-off-by: John Stultz --- kernel/time/ntp.c | 5 ++--- 1 file changed, 2

[PATCH 1/5] ntp: Remove redundant arguments

2018-07-19 Thread John Stultz
) /* * Propagate a new txc->status value into the NTP state: */ -static inline void process_adj_status(struct timex *txc, struct timespec64 *ts) +static inline void process_adj_status(struct timex *txc) { if ((time_status & STA_PLL) && !(txc->status & STA_PLL)) {

[PATCH 1/5] ntp: Remove redundant arguments

2018-07-19 Thread John Stultz
) /* * Propagate a new txc->status value into the NTP state: */ -static inline void process_adj_status(struct timex *txc, struct timespec64 *ts) +static inline void process_adj_status(struct timex *txc) { if ((time_status & STA_PLL) && !(txc->status & STA_PLL)) {

Re: [PATCH 1/3] ntp: Remove redundant arguments

2018-07-13 Thread John Stultz
On Fri, Jul 13, 2018 at 5:06 AM, Ondrej Mosnacek wrote: > The 'ts' argument of process_adj_status() and process_adjtimex_modes() > is unused and can be safely removed. > > Signed-off-by: Ondrej Mosnacek Thanks for sending this set along. I'll queue them up for closer review and testing. thanks

Re: [PATCH 1/3] ntp: Remove redundant arguments

2018-07-13 Thread John Stultz
On Fri, Jul 13, 2018 at 5:06 AM, Ondrej Mosnacek wrote: > The 'ts' argument of process_adj_status() and process_adjtimex_modes() > is unused and can be safely removed. > > Signed-off-by: Ondrej Mosnacek Thanks for sending this set along. I'll queue them up for closer review and testing. thanks

[PATCH 2/3] ntp: Use kstrtos64 for s64 variable

2018-07-13 Thread Ondrej Mosnacek
...instead of kstrtol with a dirty cast. Signed-off-by: Ondrej Mosnacek --- kernel/time/ntp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 25031ffb5d25..6c764addef3e 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@

  1   2   3   4   5   6   7   8   9   10   >