-
Notifications
You must be signed in to change notification settings - Fork 279
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 does not work with cgo #101
Comments
Thanks for the report!
This should fix fuzzing for now. |
That fixed it!
Thanks for the information. |
Good! You may also consider that the package is not changed after marshal/unmarshal roundtrip as: f := new(Frame)
if err := f.UnmarshalBinary(data); err != nil {
return 0
}
if data1, err := f.MarshalBinary(); err != nil {
panic(err)
}
f1 := new(Frame)
if err := f1.UnmarshalBinary(data1); err != nil {
return 0
}
if !reflect.DeepEqual(f, f1) {
panic("bad")
} If reflect.DeepEqual won't work for you, there is also github.com/dvyukov/go-fuzz/examples/fuzz.Equal which is slightly more relaxed version of DeepEqual. Also if UnmarshalBinary fails, then you don't invoke UnmarshalFCS. If these are different formats, then I would just write two separate tests with different workdir's (so that they have different input corpus). |
Thanks for the advice! I haven't gone too in-depth yet with my testing, but it is certainly something I'd like to investigate in the future. |
The problem is that go/types does not support cgo well. |
This is still not fixed. |
It's seems like of your package is cgo you're better off using afl or libfuzzer to fuzz the C library directly. |
@q6r Does exporting CGO_ENABLED=0 help in your case? |
I'm fuzzing something that requires cgo. There are other better options for
|
@q6r you can also consider libfuzzer (http://llvm.org/docs/LibFuzzer.html) which is way faster than AFL. |
I have a program that requires cgo and I was wondering if there is any (planned) progress on this issue? |
@obscuren do you want to test native code? can you stub native code in tests? |
@dvyukov I guess I'm just looking for the easy way out ;-) I'll see if I can stub them away |
That upstream bug was fixed. |
Hey, any updates regarding cgo support in go-fuzz? |
I'm also interested, I want to fuzz my go implementation against a C implementation |
One workaround is to get the cgo/C results by executing another binary, or making an RPC call. It’s ugly, but it does work—go-fuzz has found a bunch of compiler bugs that way. |
For future reference, I ended up using libfuzzer directly, example with msan: $ CC=clang go build -buildmode c-archive -msan -gcflags "all=-d=libfuzzer" -tags gofuzz,gofuzz_libfuzzer,libfuzzer -trimpath -o fuzz.a
$ clang -fsanitize=fuzzer,memory fuzz.a -o fuzz |
Hello, I previously used
go-fuzz
with Go 1.4.2, but now that I'm on 1.5.1, it no longer seems to work. In addition, when switching back to 1.4.2, it doesn't seem to work anymore either.I just nuked my
$GOPATH
and reinstalled from scratch, just to see what would happen. It still doesn't seem to work. Any ideas?Thanks for your time.
The text was updated successfully, but these errors were encountered: