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

go-fuzz: make CoverTab size tunable #267

Open
josharian opened this issue Sep 19, 2019 · 1 comment
Open

go-fuzz: make CoverTab size tunable #267

josharian opened this issue Sep 19, 2019 · 1 comment

Comments

@josharian
Copy link
Collaborator

In #249, @dvyukov wrote:

Re CoverTab, it always was supposed to be of tunable size. It's just that I did fixed 64K initially as the simplest option and then never had time/need to improve that.

This issue is to track/discuss this.

From previous experience changing CoverTab size manually to a different hard-coded value, here's the places that need updating:

  • Generate code that masks down a high-width counter at runtime. (As Dmitry wrote: CoverTab[LOCATION_HASH & GlobalSizeMask]++.) For folks who just want to tweak CoverTab manually, you can also just change func genCounter in go-fuzz-build to generate different width counters.
  • const CoverSize in go-fuzz-defs.
  • go-fuzz/compare_amd64.s assembly implementations for clearing the covertab. Probably easiest to just pass in log2(CoverSize). And require that CoverSize be a power of two. Look for the BTL instructions.

The other TODO here is to do a bit of performance tuning with higher values of CoverSize. My experience is that cranking up the size of covertab uncovers new performance pain points. I've fixed a few of these, but more remain.

cc @thepudds

@catenacyber
Copy link

The 64K value is also hardcoded for libFuzzer mode if I understand correctly https://github.com/dvyukov/go-fuzz/blob/ee722ec171a1c6df2eb8fc2e36923c4ee5780698/go-fuzz-build/main.go line 637 and next ones

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

No branches or pull requests

2 participants