Skip to content

Commit 8cd9da8

Browse files
Frederic WeisbeckerKAGA-KOKO
authored andcommitted
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: 406dd42 ("posix-cpu-timers: Force next expiration recalc after itimer reset") Reported-by: Victor Stinner <[email protected]> Reported-by: Chris Hixon <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent e4e737b commit 8cd9da8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/time/posix-cpu-timers.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,8 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clkid,
14041404
}
14051405
}
14061406

1407-
*newval += now;
1407+
if (*newval)
1408+
*newval += now;
14081409
}
14091410

14101411
/*

0 commit comments

Comments
 (0)