]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: adjust comments on why fuzzing instrumentation is disabled
authorJay Conrod <jayconrod@google.com>
Tue, 21 Sep 2021 20:54:58 +0000 (13:54 -0700)
committerJay Conrod <jayconrod@google.com>
Fri, 24 Sep 2021 17:23:19 +0000 (17:23 +0000)
For #48504
Related #14565

Change-Id: Ibe43c75224525c4b80dbb66a1b6e0d688e47e2e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/351314
Trust: Jay Conrod <jayconrod@google.com>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
src/cmd/go/internal/work/init.go
src/cmd/go/testdata/script/test_fuzz_cache.txt
src/cmd/go/testdata/script/test_fuzz_seed_corpus.txt
src/internal/fuzz/counters_unsupported.go

index 2a605e73ee1f86136444928faa6f732814b361d1..34d2e1cbe1b70ff13bf48d0a6c27e6782147be80 100644 (file)
@@ -60,9 +60,23 @@ func BuildInit() {
        }
 }
 
+// FuzzInstrumentFlags returns compiler flags that enable fuzzing instrumation
+// on supported platforms. On unsupported platforms, FuzzInstrumentFlags returns
+// nil.
 func FuzzInstrumentFlags() []string {
-       if cfg.Goarch != "amd64" && cfg.Goarch != "arm64" {
-               // Instrumentation is only supported on 64-bit architectures.
+       // TODO: expand the set of supported platforms, with testing.
+       // Nothing about the instrumentation is OS specific, but only amd64 and arm64
+       // are supported in the runtime. See src/runtime/libfuzzer*.
+       //
+       // Keep in sync with build constraints in internal/fuzz/counters_{un,}supported.go
+       switch cfg.Goos {
+       case "darwin", "freebsd", "linux", "windows":
+       default:
+               return nil
+       }
+       switch cfg.Goarch {
+       case "amd64", "arm64":
+       default:
                return nil
        }
        return []string{"-d=libfuzzer"}
index 8bcf2be61e36d11c5caf3b4d1668be750211a9e0..a3fcca887e0bebdc69df08a5933edbb8e41d082a 100644 (file)
@@ -1,8 +1,9 @@
 # TODO(jayconrod): support shared memory on more platforms.
 [!darwin] [!linux] [!windows] skip
 
-# TODO(#48504): fix and re-enable.
-[linux] [386] skip
+# Instrumentation not supported on other archs.
+# See #14565.
+[!amd64] [!arm64] skip
 
 [short] skip
 env GOCACHE=$WORK/cache
index f810ad48d92ff8119aa7b5394a3b1396902b7186..a66d0554b69a8c8c8d1577baa4ae2cc646d5f108 100644 (file)
@@ -1,8 +1,9 @@
 # TODO(jayconrod): support shared memory on more platforms.
 [!darwin] [!linux] [!windows] skip
 
-# TODO(#48504): fix and re-enable.
-[linux] [386] skip
+# Instrumentation not supported on other archs.
+# See #14565.
+[!amd64] [!arm64] skip
 
 [short] skip
 env GOCACHE=$WORK/cache
index 743ef45a6603790cdcad33ed30218d745ae7704a..9595cb93f7b83bc647eb1522e60ba3ae8df2e5b4 100644 (file)
@@ -7,7 +7,9 @@
 package fuzz
 
 // TODO(#48504): re-enable on platforms where instrumentation works.
-// This was disabled due to an init failure on aix_ppc64.
+// In theory, we shouldn't need this file at all: if the binary was built
+// without coverage, then _counters and _ecounters should have the same address.
+// However, this caused an init failure on aix/ppc64, so it's disabled here.
 
 // coverage returns a []byte containing unique 8-bit counters for each edge of
 // the instrumented source code. This coverage data will only be generated if