On Wed, 16 Nov 2022 at 03:28, Joey Jiao <
joey....@gmail.com> wrote:
>
> Hi,
> I have some doubts on remote kcov.
>
> So, assume syscall thread A created local kthread B.
> kcov_handle is passed from A to B, and kcov_remote_start/kcov_remote_end are put inside thread B function.
>
> Is it possible that A completes execution while B is still not scheduled? In this case, remote coverage won't be collected back, right?
Hi Joey,
It depends on how you use kcov in the process. I assume you are asking
about the syz-executor use of kcov.
The scenario you described should work. The thread that scheduled work
may finish the syscall and may even exit, remote coverage should still
be collected. In syz-executor we use a separate "remote" kcov object
to collect remote coverage and that object lives for the duration of
the process. The kcov_handle identifies that separate remote kcov
object, so what happens with the thread that issued the syscall does
not matter.
> Another doubt is:
> If A creates kthread B, and B creates kthread C. Is it possible to collect coverage for both B and C with the same kcov_handle?
Yes, this should work as well.
Multiple remote regions can add coverage to the same remote kcov object.