Bug#1070474: time sync overflows on ARCH armhf(Debian 12, bookworm) with systemd-timesyncd.service

Perr Zhang strongbox8 at zoho.com
Mon May 27 02:04:00 BST 2024


 ---- On Sun, 26 May 2024 22:22:52 +0800  Luca Boccassi  wrote --- 
 > Control: tags -1 moreinfo
 > 
 > On Mon, 06 May 2024 09:22:14 +0800 Perr Zhang strongbox8 at zoho.com>
 > wrote:
 > > Package: systemd, systemd-timesyncd
 > > Version: 252.19-1~deb12u1, 252.22-1~deb12u1
 > > Arch: armhf
 > > Distribution: Debian 12, bookworm
 > > 
 > > Timestamp of rootfs overflows about once a week, with a core dump
 > file(/core) of systemd
 > > the kernel is compiled from upstream by myself, the rootfs is built
 > with debootstrap
 > > 
 > > root at Beetle-fox-Tbox:~# uname -a
 > > Linux Beetle-fox-Tbox 6.1.68 #1 SMP Wed Feb  7 13:15:39 CST 2024
 > armv7l GNU/Linux
 > > root at Beetle-fox-Tbox:~# stat /
 > >   File: /
 > >   Size: 4096          Blocks: 8          IO Block: 4096   directory
 > > Device: 8,118 Inode: 2           Links: 18
 > > Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/   
 > root)
 > > Access: 2024-05-06 01:02:34.504540112 +0000
 > > Modify: 2119-06-23 05:10:17.491093577 +0000
 > > Change: 2119-06-23 05:10:17.491093577 +0000
 > >  Birth: 2024-03-12 06:30:05.000000000 +0000
 > > root at Beetle-fox-Tbox:~# stat /core
 > >   File: /core
 > >   Size: 19771392      Blocks: 4784       IO Block: 4096   regular
 > file
 > > Device: 8,118 Inode: 12          Links: 1
 > > Access: (0600/-rw-------)  Uid: (    0/    root)   Gid: (    0/   
 > root)
 > > Access: 2024-05-06 01:03:09.107874379 +0000
 > > Modify: 2119-06-23 05:10:17.721082481 +0000
 > > Change: 2119-06-23 05:10:17.721082481 +0000
 > >  Birth: 2119-06-23 05:10:17.491093577 +0000
 > 
 > What is causing the rootfs timestamp to overflow?

I have patched the kernel to check which process has set system time with:

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 221c8c404973..69cfda0ef000 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -24,6 +24,7 @@
 #include <linux/compiler.h>
 #include <linux/audit.h>
 #include <linux/random.h>
+#include <linux/sched/signal.h>
 
 #include "tick-internal.h"
 #include "ntp_internal.h"
@@ -1315,7 +1316,12 @@ int do_settimeofday64(const struct timespec64 *ts)
 	struct timespec64 ts_delta, xt;
 	unsigned long flags;
 	int ret = 0;
+	time64_t sec_year2119 = mktime64(2119, 1, 1, 1, 1, 1);
 
+	if (ts->tv_sec >= sec_year2119) {
+		force_sig(SIGABRT);
+		return -EINVAL; // TODO: maybe we need some printk here
+	}
 	if (!timespec64_valid_settod(ts))
 		return -EINVAL;
 
I has tested for about one week, and hasn't catched the process's coredump yet

 > 
 > -- 
 > Kind regards,
 > Luca Boccassi
 > 



More information about the Pkg-systemd-maintainers mailing list