Commit 8cd9da85 authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Thomas Gleixner

posix-cpu-timers: Prevent spuriously armed 0-value itimer

Resetting/stopping an itimer eventually leads to it being reprogrammed
with an actual "0" value. As a result the itimer expires on the next
tick, triggering an unexpected signal.

To fix this, make sure that
struct signal_struct::it[CPUCLOCK_PROF/VIRT]::expires is set to 0 when
setitimer() passes a 0 it_value, indicating that the timer must stop.

Fixes: 406dd42b ("posix-cpu-timers: Force next expiration recalc after itimer reset")
Reported-by: default avatarVictor Stinner <vstinner@redhat.com>
Reported-by: default avatarChris Hixon <linux-kernel-bugs@hixontech.com>
Signed-off-by: default avatarFrederic Weisbecker <frederic@kernel.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210913145332.232023-1-frederic@kernel.org
parent e4e737bb
......@@ -1404,7 +1404,8 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clkid,
}
}
*newval += now;
if (*newval)
*newval += now;
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment