From ddd15652dd877da565bb911246956e358196d666 Mon Sep 17 00:00:00 2001 From: Ivan T. Ivanov Date: Apr 06 2023 09:04:34 +0000 Subject: Merge branch 'users/fweisbecker/SLE12-SP5/for-next' into SLE12-SP5 --- diff --git a/patches.suse/ntp-Limit-TAI-UTC-offset.patch b/patches.suse/ntp-Limit-TAI-UTC-offset.patch new file mode 100644 index 0000000..d604d19 --- /dev/null +++ b/patches.suse/ntp-Limit-TAI-UTC-offset.patch @@ -0,0 +1,56 @@ +From d897a4ab11dc8a9fda50d2eccc081a96a6385998 Mon Sep 17 00:00:00 2001 +From: Miroslav Lichvar +Date: Tue, 18 Jun 2019 17:47:13 +0200 +Subject: [PATCH] ntp: Limit TAI-UTC offset +Git-commit: d897a4ab11dc8a9fda50d2eccc081a96a6385998 +Patch-mainline: v5.3-rc1 +References: git-fixes + +Don't allow the TAI-UTC offset of the system clock to be set by adjtimex() +to a value larger than 100000 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 seconds to be inserted at the maximum rate +currently supported by the kernel (once per day) for the next ~270 years, +however unlikely it is that someone can survive a catastrophic event which +slowed down the rotation of the Earth so much. + +Reported-by: Weikang shi +Signed-off-by: Miroslav Lichvar +Signed-off-by: Thomas Gleixner +Cc: John Stultz +Cc: Prarit Bhargava +Cc: Richard Cochran +Cc: Stephen Boyd +Link: https://lkml.kernel.org/r/20190618154713.20929-1-mlichvar@redhat.com +Signed-off-by: Frederic Weisbecker +--- + kernel/time/ntp.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c +index 8de4f789dc1b..65eb796610dc 100644 +--- a/kernel/time/ntp.c ++++ b/kernel/time/ntp.c +@@ -43,6 +43,7 @@ static u64 tick_length_base; + #define MAX_TICKADJ 500LL /* usecs */ + #define MAX_TICKADJ_SCALED \ + (((MAX_TICKADJ * NSEC_PER_USEC) << NTP_SCALE_SHIFT) / NTP_INTERVAL_FREQ) ++#define MAX_TAI_OFFSET 100000 + + /* + * phase-lock loop variables +@@ -691,7 +692,8 @@ static inline void process_adjtimex_modes(const struct __kernel_timex *txc, + time_constant = max(time_constant, 0l); + } + +- if (txc->modes & ADJ_TAI && txc->constant >= 0) ++ if (txc->modes & ADJ_TAI && ++ txc->constant >= 0 && txc->constant <= MAX_TAI_OFFSET) + *time_tai = txc->constant; + + if (txc->modes & ADJ_OFFSET) +-- +2.34.1 + diff --git a/patches.suse/timekeeping-Prevent-32bit-truncation-in-scale64_chec.patch b/patches.suse/timekeeping-Prevent-32bit-truncation-in-scale64_chec.patch new file mode 100644 index 0000000..1fc4140 --- /dev/null +++ b/patches.suse/timekeeping-Prevent-32bit-truncation-in-scale64_chec.patch @@ -0,0 +1,43 @@ +From 4cbbc3a0eeed675449b1a4d080008927121f3da3 Mon Sep 17 00:00:00 2001 +From: Wen Yang +Date: Mon, 20 Jan 2020 18:05:23 +0800 +Subject: [PATCH] timekeeping: Prevent 32bit truncation in + scale64_check_overflow() +Git-commit: 4cbbc3a0eeed675449b1a4d080008927121f3da3 +Patch-mainline: v5.7-rc1 +References: git-fixes + +While unlikely the divisor in scale64_check_overflow() could be >= 32bit in +scale64_check_overflow(). do_div() truncates the divisor to 32bit at least +on 32bit platforms. + +Use div64_u64() instead to avoid the truncation to 32-bit. + +[ tglx: Massaged changelog ] + +Signed-off-by: Wen Yang +Signed-off-by: Thomas Gleixner +Link: https://lkml.kernel.org/r/20200120100523.45656-1-wenyang@linux.alibaba.com +Signed-off-by: Frederic Weisbecker +--- + kernel/time/timekeeping.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c +index ca69290bee2a..4fc2af4367a7 100644 +--- a/kernel/time/timekeeping.c ++++ b/kernel/time/timekeeping.c +@@ -1005,9 +1005,8 @@ static int scale64_check_overflow(u64 mult, u64 div, u64 *base) + ((int)sizeof(u64)*8 - fls64(mult) < fls64(rem))) + return -EOVERFLOW; + tmp *= mult; +- rem *= mult; + +- do_div(rem, div); ++ rem = div64_u64(rem * mult, div); + *base = tmp + rem; + return 0; + } +-- +2.34.1 + diff --git a/series.conf b/series.conf index 1caf188..a6857ac 100644 --- a/series.conf +++ b/series.conf @@ -50820,6 +50820,7 @@ patches.suse/rslib-Fix-decoding-of-shortened-codes.patch patches.suse/rslib-Fix-handling-of-of-caller-provided-syndrome.patch patches.suse/irqchip-gic-v2m-Add-support-for-Amazon-Graviton-vari.patch + patches.suse/ntp-Limit-TAI-UTC-offset.patch patches.suse/msft-hv-1893-clocksource-drivers-Make-Hyper-V-clocksource-ISA-agn.patch patches.suse/msft-hv-1894-clocksource-drivers-Continue-making-Hyper-V-clocksou.patch patches.suse/x86-cpufeatures-Carve-out-CQM-features-retrieval.patch @@ -55702,6 +55703,7 @@ patches.suse/sched-fair-fix-reordering-of-enqueue-dequeue_task_fair.patch patches.suse/sched-fair-fix-enqueue_task_fair-warning.patch patches.suse/irqchip-bcm2835-Quiesce-IRQs-left-enabled-by-bootloa.patch + patches.suse/timekeeping-Prevent-32bit-truncation-in-scale64_chec.patch patches.suse/fbdev-g364fb-Fix-build-failure.patch patches.suse/firmware-arm_sdei-fix-double-lock-on-hibernate-with-.patch patches.suse/firmware-arm_sdei-fix-possible-double-lock-on-hibern.patch