aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/libfuzzer.go
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2022-12-21 16:35:57 -0500
committerCherry Mui <cherryyz@google.com>2022-12-23 01:12:02 +0000
commit1ba7341cb21d9edb2a04eb0b24b3af71899b35fc (patch)
tree6c1fbc80b376f6cc220d7a7cdc2b2c70f67644de /src/runtime/libfuzzer.go
parentc61d322d5f9e3fcffa4c523892af432dca030c12 (diff)
downloadgo-1ba7341cb21d9edb2a04eb0b24b3af71899b35fc.tar.xz
cmd/link, runtime: use a different section for Go libfuzzer counters
Currently in libfuzzer mode, we put our counters in section __sancov_cntrs. When linking with C/C++ code that also has fuzzer counters, apparently the C linker combines our counters and their counters and registers them together. But in the Go runtime we also have code to register our counters. So the Go counters ended up registered twice, causing problems. Since we already have code to register our counters, put them in a Go-specific section so it won't be combined with the C counters. Fixes #57449. Change-Id: If3d41735124e7e301572d4b7aecf7d057ac134c0 Reviewed-on: https://go-review.googlesource.com/c/go/+/459055 Reviewed-by: Nicolas Hillegeer <aktau@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime/libfuzzer.go')
-rw-r--r--src/runtime/libfuzzer.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/runtime/libfuzzer.go b/src/runtime/libfuzzer.go
index 013e7165b2..0ece035405 100644
--- a/src/runtime/libfuzzer.go
+++ b/src/runtime/libfuzzer.go
@@ -148,13 +148,8 @@ var __sanitizer_cov_trace_const_cmp8 byte
//go:cgo_import_static __sanitizer_cov_8bit_counters_init
var __sanitizer_cov_8bit_counters_init byte
-//go:linkname __start___sancov_cntrs __start___sancov_cntrs
-//go:cgo_import_static __start___sancov_cntrs
-var __start___sancov_cntrs byte
-
-//go:linkname __stop___sancov_cntrs __stop___sancov_cntrs
-//go:cgo_import_static __stop___sancov_cntrs
-var __stop___sancov_cntrs byte
+// start, stop markers of counters, set by the linker
+var __start___sancov_cntrs, __stop___sancov_cntrs byte
//go:linkname __sanitizer_cov_pcs_init __sanitizer_cov_pcs_init
//go:cgo_import_static __sanitizer_cov_pcs_init