summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorMartynas Venckus <martynas@cvs.openbsd.org>2009-10-16 19:29:42 +0000
committerMartynas Venckus <martynas@cvs.openbsd.org>2009-10-16 19:29:42 +0000
commita38b6d1ee33d3d05cd53bd8d096b35cb9717780c (patch)
treedd7b51b789d2607b9f6fba905aa333f6e9594bc0 /sys/kern
parent82ef850f99092b1525898e58d876917eead56d37 (diff)
cancel the timeout upon disabling profiling / virtual timer; so
that the timeout doesn't happen if setitimer is called between the profiling / virtual timer expires and the timeout is scheduled. firefox triggered this Profiling timer expired problem when in uthread execve signal was being delivered after timer has already been disabled; as reported on ports@ recently. special thanks to kettenis@, kurt@, guenther@. agreed by kettenis@, tedu@. ok guenther@. reminded & ok fgs@. tested by ian@.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_time.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index cbf0c4e27f5..82a805cffd8 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_time.c,v 1.66 2009/06/05 15:17:02 ckuethe Exp $ */
+/* $OpenBSD: kern_time.c,v 1.67 2009/10/16 19:29:41 martynas Exp $ */
/* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */
/*
@@ -638,6 +638,10 @@ sys_setitimer(struct proc *p, void *v, register_t *retval)
itimerround(&aitv.it_interval);
s = splclock();
p->p_stats->p_timer[SCARG(uap, which)] = aitv;
+ if (SCARG(uap, which) == ITIMER_VIRTUAL)
+ timeout_del(&p->p_stats->p_virt_to);
+ if (SCARG(uap, which) == ITIMER_PROF)
+ timeout_del(&p->p_stats->p_prof_to);
splx(s);
}