posix-cpu-timers: Unbreak timer rearming
Closes: #919019 Closes: #919049
This commit is contained in:
parent
fe5142170f
commit
c2ac4cd321
|
@ -15,6 +15,7 @@ linux (4.19.13-2) UNRELEASED; urgency=medium
|
|||
[ Salvatore Bonaccorso ]
|
||||
* ipv6: Consider sk_bound_dev_if when binding a socket to an address
|
||||
(Closes: #918103)
|
||||
* posix-cpu-timers: Unbreak timer rearming (Closes: #919019, #919049)
|
||||
|
||||
[ Michal Simek ]
|
||||
* [arm64] Enable Xilinx ZynqMP SoC and drivers
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Fri, 11 Jan 2019 14:33:16 +0100
|
||||
Subject: posix-cpu-timers: Unbreak timer rearming
|
||||
Origin: https://lore.kernel.org/lkml/20190111133500.840117406@linutronix.de/
|
||||
Bug-Debian: https://bugs.debian.org/919019
|
||||
Bug-Debian: https://bugs.debian.org/919049
|
||||
|
||||
The recent commit which prevented a division by 0 issue in the alarm timer
|
||||
code broke posix CPU timers as an unwanted side effect.
|
||||
|
||||
The reason is that the common rearm code checks for timer->it_interval
|
||||
being 0 now. What went unnoticed is that the posix cpu timer setup does not
|
||||
initialize timer->it_interval as it stores the interval in CPU timer
|
||||
specific storage. The reason for the separate storage is historical as the
|
||||
posix CPU timers always had a 64bit nanoseconds representation internally
|
||||
while timer->it_interval is type ktime_t which used to be a modified
|
||||
timespec representation on 32bit machines.
|
||||
|
||||
Instead of reverting the offending commit and fixing the alarmtimer issue
|
||||
in the alarmtimer code, store the interval in timer->it_interval at CPU
|
||||
timer setup time so the common code check works. This also repairs the
|
||||
existing inconistency of the posix CPU timer code which kept a single shot
|
||||
timer armed despite of the interval being 0.
|
||||
|
||||
The separate storage can be removed in mainline, but that needs to be a
|
||||
separate commit as the current one has to be backported to stable kernels.
|
||||
|
||||
Fixes: 0e334db6bb4b ("posix-timers: Fix division by zero bug")
|
||||
Reported-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
Cc: stable@vger.kernel.org
|
||||
Cc: Peter Zijlstra <peterz@infradead.org>
|
||||
Cc: John Stultz <john.stultz@linaro.org>
|
||||
---
|
||||
kernel/time/posix-cpu-timers.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
|
||||
index 8f0644af40be..80f955210861 100644
|
||||
--- a/kernel/time/posix-cpu-timers.c
|
||||
+++ b/kernel/time/posix-cpu-timers.c
|
||||
@@ -685,6 +685,7 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
|
||||
* set up the signal and overrun bookkeeping.
|
||||
*/
|
||||
timer->it.cpu.incr = timespec64_to_ns(&new->it_interval);
|
||||
+ timer->it_interval = ns_to_ktime(timer->it.cpu.incr);
|
||||
|
||||
/*
|
||||
* This acts as a modification timestamp for the timer,
|
||||
--
|
||||
2.20.1
|
||||
|
|
@ -102,6 +102,7 @@ bugfix/all/kbuild-include-addtree-remove-quotes-before-matching-path.patch
|
|||
debian/revert-objtool-fix-config_stack_validation-y-warning.patch
|
||||
bugfix/all/smb3-fix-large-reads-on-encrypted-connections.patch
|
||||
bugfix/all/ipv6-Consider-sk_bound_dev_if-when-binding-a-socket-.patch
|
||||
bugfix/all/posix-cpu-timers-Unbreak-timer-rearming.patch
|
||||
|
||||
# Miscellaneous features
|
||||
|
||||
|
|
Loading…
Reference in New Issue