dvyukov / go-fuzz

Randomized testing for Go
Apache License 2.0
4.78k stars 279 forks source link

Custom mutator for libFuzzer mode #319

Open turbolent opened 3 years ago

turbolent commented 3 years ago

I've read about custom mutators in LLVM's libFuzzer. Would it be possible to add support for it to go-fuzz's libFuzzer mode?

Would that basically involve adding a LLVMFuzzerCustomMutator function just like LLVMFuzzerTestOneInput is implemented, here: https://github.com/dvyukov/go-fuzz/blob/2fedac326dda3656b72e89836bd5721bc34b2966/go-fuzz-build/main.go#L868 ?

dvyukov commented 3 years ago

Hi @turbolent,

Would it be possible to add support for it to go-fuzz's libFuzzer mode?

Adding new significant features to go-fuzz today makes little sense in the light of the fuzzing support in the standard library (you can find proposal and tracking issue in the Go issue tracker).

But if you want to do it locally, it should be possible.

Would that basically involve adding a LLVMFuzzerCustomMutator function just like LLVMFuzzerTestOneInput is implemented,

I guess so. Have you tried? Does it work?

personnumber3377 commented 3 weeks ago

@turbolent

Ok, so it has been quite a while and I got bored of waiting for someone else to do it, so I implemented this bullshit myself. I actually added support for python custom mutators, but I think this is close enough. I did a blog post here: https://personnumber3377.github.io/projects/implementing_python_mutators_for_go_fuzz.html which explains the hacky stuff which I had to do to get this to work. The fork of go-fuzz which has python custom mutators is here: https://github.com/personnumber3377/go-fuzz feel free to modify how you like.

Edit: Added another issue: https://github.com/dvyukov/go-fuzz/issues/359

wulie commented 3 weeks ago

这是来自QQ邮箱的假期自动回复邮件。您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。