CVSROOT:        /cvs
Module name:    src
Changes by:     chel...@cvs.openbsd.org 2020/08/09 13:15:47

Modified files:
        sys/kern       : kern_time.c 

Log message:
hardclock(9): fix race with setitimer(2) for ITIMER_VIRTUAL, ITIMER_PROF

The ITIMER_VIRTUAL and ITIMER_PROF per-process interval timers are
updated from hardclock(9).  If a timer for the parent process is
enabled the hardclock(9) thread calls itimerdecr() to update and
reload it as needed.

However, in itimerdecr(), after entering itimer_mtx, the thread needs
to double-check that the timer in question is still enabled.  While
the hardclock(9) thread is entering itimer_mtx a thread in
setitimer(2) can take the mutex and disable the timer.

If the timer is disabled, itimerdecr() should return 1 to indicate
that the timer has not expired and that no action needs to be taken.

ok kettenis@

Reply via email to