go/src/internal/fuzz
Khaled Yakdan c1d197a96e cmd/compile: support libFuzzer value profiling mode for integer compares
libFuzzer provides a special mode known as “value profiling” in which it
tracks the bit-wise progress made by the fuzzer in satisfying tracked
comparisons. Furthermore, libFuzzer uses the value of the return address
in its hooks to distinguish the progress for different comparisons.

The original implementation of the interception for integer comparisons
in Go simply called the libFuzzer hooks from a function written in Go
assembly. The libFuzzer hooks thus always see the same return address
(i.e., the address of the call instruction in the assembly snippet) and
thus can’t distinguish individual comparisons anymore. This drastically
reduces the usefulness of value profiling.

This is fixed by using an assembly trampoline that injects synthetic but
valid return addresses on the stack before calling the libFuzzer hook,
otherwise preserving the calling convention of the respective platform
(for starters, x86_64 Windows or Unix). These fake PCs are generated
deterministically based on the location of the compare instruction in
the IR representation.

Change-Id: Iea68057c83aea7f9dc226fba7128708e8637d07a
GitHub-Last-Rev: f9184baafd
GitHub-Pull-Request: golang/go#51321
Reviewed-on: https://go-review.googlesource.com/c/go/+/387336
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2022-05-23 16:21:22 +00:00
..
counters_supported.go
counters_unsupported.go cmd/go: consolidate fuzz-support checks 2021-10-28 20:43:02 +00:00
coverage.go internal/fuzz: minimization should not reduce coverage 2022-03-10 23:06:14 +00:00
encoding.go internal/fuzz: trim carriage return from version line 2022-05-20 23:05:38 +00:00
encoding_test.go internal/fuzz: trim carriage return from version line 2022-05-20 23:05:38 +00:00
fuzz.go internal/fuzz: change meaning of "total" in output 2022-02-04 22:34:05 +00:00
mem.go internal/fuzz: handle unrecoverable errors during minimization 2021-12-07 21:15:51 +00:00
minimize.go internal/fuzz: handle unrecoverable errors during minimization 2021-12-07 21:15:51 +00:00
minimize_test.go cmd/go: enable fuzz testing for FreeBSD 2022-01-12 19:47:40 +00:00
mutator.go all: gofmt -w -r 'interface{} -> any' src 2021-12-13 18:45:54 +00:00
mutator_test.go all: gofmt -w -r 'interface{} -> any' src 2021-12-13 18:45:54 +00:00
mutators_byteslice.go internal/fuzz: fix chunk swap mutator 2021-11-19 18:23:43 +00:00
mutators_byteslice_test.go internal/fuzz: fix chunk swap mutator 2021-11-19 18:23:43 +00:00
pcg.go
queue.go all: gofmt -w -r 'interface{} -> any' src 2021-12-13 18:45:54 +00:00
queue_test.go
sys_posix.go cmd/go: enable fuzz testing for FreeBSD 2022-01-12 19:47:40 +00:00
sys_unimplemented.go cmd/go: enable fuzz testing for FreeBSD 2022-01-12 19:47:40 +00:00
sys_windows.go all: fix spelling mistakes 2021-10-13 04:00:15 +00:00
trace.go cmd/compile: support libFuzzer value profiling mode for integer compares 2022-05-23 16:21:22 +00:00
worker.go internal/fuzz: minimization should not reduce coverage 2022-03-10 23:06:14 +00:00
worker_test.go all: gofmt -w -r 'interface{} -> any' src 2021-12-13 18:45:54 +00:00