-
Notifications
You must be signed in to change notification settings - Fork 18k
internal/fuzz: odr-violation error #66966
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
Comments
MRE: module hello
go 1.22.2 main_test.go: package hello
import (
"testing"
"unicode/utf8"
)
func Reverse(s string) string {
b := []byte(s)
for i, j := 0, len(b)-1; i < len(b)/2; i, j = i+1, j-1 {
b[i], b[j] = b[j], b[i]
}
return string(b)
}
func FuzzReverse(f *testing.F) {
testcases := []string{"Hello, world", " ", "!12345"}
for _, tc := range testcases {
f.Add(tc) // Use f.Add to provide a seed corpus
}
f.Fuzz(func(t *testing.T, orig string) {
rev := Reverse(orig)
doubleRev := Reverse(rev)
if orig != doubleRev {
t.Errorf("Before: %q, after: %q", orig, doubleRev)
}
if utf8.ValidString(orig) && !utf8.ValidString(rev) {
t.Errorf("Reverse produced invalid UTF-8 string %q", rev)
}
})
}
|
Still crashes $ go version
go version go1.23.2 linux/amd64 $ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.3 LTS" package main
import (
"path"
"testing"
)
func FuzzPathClean(f *testing.F) {
f.Fuzz(func(t *testing.T, data string) {
res := path.Clean(data)
t.Log("in:", data)
t.Log("out:", res)
})
} $ go test -asan -fuzz=FuzzPathClean ./main_test.go
==199089==The following global variable is not properly aligned.
==199089==This may happen if another global with the same name
==199089==resides in another non-instrumented module.
==199089==Or the global comes from a C file built w/o -fno-common.
==199089==In either case this is likely an ODR violation bug,
==199089==but AddressSanitizer can not provide more details.
=================================================================
==199089==ERROR: AddressSanitizer: odr-violation (0x00000097588d):
[1] size=0 'internal/fuzz._ecounters' /usr/local/go/src/internal/fuzz/coverage.go:104:13
[2] size=0 'internal/fuzz._ecounters' /usr/local/go/src/internal/fuzz/coverage.go:104:13
These globals were registered at these points:
[1]:
#0 0x7f53f7a4b928 in __asan_register_globals ../../../../src/libsanitizer/asan/asan_globals.cpp:341
#1 0x477f4c (/tmp/go-build1051884221/b001/main.test+0x477f4c)
[2]:
#0 0x7f53f7a4b928 in __asan_register_globals ../../../../src/libsanitizer/asan/asan_globals.cpp:341
#1 0x477f4c (/tmp/go-build1051884221/b001/main.test+0x477f4c)
==199089==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0
SUMMARY: AddressSanitizer: odr-violation: global 'internal/fuzz._ecounters' at /usr/local/go/src/internal/fuzz/coverage.go:104:13
==199089==ABORTING
exit status 1
FAIL command-line-arguments 0.014s |
Looks like
Setting This would be nice if it worked, but I'm not sure it ever did. Marking for 1.24 is case someone knows an easy fix for it. |
Change https://go.dev/cl/622477 mentions this issue: |
Go version
go1.22.2 linux/amd64
Output of
go env
in your module/workspace:What did you do?
I ran this code on MacBook M3-chip with Docker Desktop and used latest official docker images (debian / alpine).
What did you see happen?
What did you expect to see?
I've tried to set
ASAN_OPTIONS=detect_odr_violation=0
without success:The text was updated successfully, but these errors were encountered: