CVSROOT:        /cvs
Module name:    src
Changes by:     chel...@cvs.openbsd.org 2020/08/06 11:54:08

Modified files:
        sys/kern       : kern_timeout.c 

Log message:
timeout(9): fix miscellaneous remote kcov(4) bugs

Commit v1.77 introduced remote kcov support for timeouts.  We need to
tweak a few things to make our support more correct:

- Set to_process for barrier timeouts to the calling thread's parent
process.  Currently it is uninitialized, so during timeout_run() we
are passing stack garbage to kcov_remote_enter(9).

- Set to_process to NULL during timeout_set_flags(9).  If in the
future we forget to properly initialize to_process before reaching
timeout_run(), we'll pass NULL to kcov_remote_enter(9).

anton@ says this is harmless.  I assume it is also preferable to
passing stack garbage.

- Save a copy of to_process on the stack in timeout_run() before
calling to_func to ensure that we pass the same process pointer
to kcov_remote_leave(9) upon return.  The timeout may be freely
modified from to_func, so to_process may have changed when we
return.

Tested by anton@.

ok anton@

Reply via email to