Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executor: use different remote kcov handles each time #4893

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

a-nogikh
Copy link
Collaborator

It serves two purposes:

  1. Ignore the remote coverage that was initiated by the already exited
    executor instances.
  2. Circumvent the KCOV bug that sometimes results in dangling remote
    kcov handles. The bug is fixed in [1], but it will take time for it
    to reach all the kernels we fuzz.

Fixes #4626.

[1] https://lore.kernel.org/all/[email protected]/

It serves two purposes:
1) Ignore the remote coverage that was initiated by the already exited
   executor instances.
2) Circumvent the KCOV bug that sometimes results in dangling remote
   kcov handles. The bug is fixed in [1], but it will take time for it
   to reach all the kernels we fuzz.

Fixes google#4626.

[1] https://lore.kernel.org/all/[email protected]/
@a-nogikh
Copy link
Collaborator Author

a-nogikh commented Jun 12, 2024

This PR breaks usb fuzzing, since, apparently, the kernel always routes the usb coverage via a kcov remote handle that equals the usb device's bus number (?): For example, each hub_event worker uses the USB bus number as the task instance id. (from the docs).

@xairy, do you remember whether/where we can control the bus numbers of the usb devices we create for fuzzing? Can these be arbitrary uint32 numbers? Or do we really not want it because we e.g. cannot reliably clean up such devices after each executor restart?

Copy link

codecov bot commented Jun 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.0%. Comparing base (f815599) to head (dc1bf5b).
Report is 279 commits behind head on master.

Additional details and impacted files

see 1 file with indirect coverage changes

@xairy
Copy link
Collaborator

xairy commented Jun 13, 2024

This PR breaks usb fuzzing, since, apparently, the kernel always routes the usb coverage via a kcov remote handle that equals the usb device's bus number (?): For example, each hub_event worker uses the USB bus number as the task instance id. (from the docs).

@xairy, do you remember whether/where we can control the bus numbers of the usb devices we create for fuzzing? Can these be arbitrary uint32 numbers? Or do we really not want it because we e.g. cannot reliably clean up such devices after each executor restart?

We do not control the USB bus numbers, the dummy_hcd module creates them sequentially starting from 1. We pass dummy_hcd.num=N (N == proc) to the kernel command-line to make dummy_hcd create a bus for each executor. And the kernel USB code uses fixed KCOV handles derived from the bus numbers (see kcov_remote_start_usb).

So yeah, this change will break USB coverage collection.

@a-nogikh
Copy link
Collaborator Author

Ah, that's a pity. Then there's no chance to work around the lost kcov handles bug until the fix reaches the mainline.

Thanks for sharing the details!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

executor: remote cover enable write trace failed (errno 17)
2 participants