go/src/internal
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
..
abi internal/abi: define riscv64 register ABI constants 2022-03-26 01:27:54 +00:00
buildcfg buildcfg: disable regabiwrappers along with regabiargs 2022-05-13 18:21:52 +00:00
bytealg internal/bytealg: support basic byte operation on loong64 2022-05-17 19:55:37 +00:00
cfg cmd/go: set go.work path using GOWORK, and remove -workfile flag 2022-02-16 15:58:47 +00:00
cpu internal/{cpu, goarch}: add constant definition for loong64 2022-05-17 19:48:21 +00:00
diff all: gofmt main repo 2022-05-19 15:49:05 +00:00
fmtsort all: gofmt main repo 2022-04-11 16:34:30 +00:00
fuzz cmd/compile: support libFuzzer value profiling mode for integer compares 2022-05-23 16:21:22 +00:00
goarch internal/{cpu, goarch}: add constant definition for loong64 2022-05-17 19:48:21 +00:00
godebug net/netip: add new IP address package 2021-11-02 01:28:01 +00:00
goexperiment internal/goexperiment: add GOEXPERIMENT=boringcrypto 2022-04-04 21:06:49 +00:00
goos all: separate doc comment from //go: directives 2022-04-05 17:54:15 +00:00
goroot all: use os/exec instead of internal/execabs 2022-05-02 17:49:12 +00:00
goversion internal/goversion: update Version to 1.19 2022-02-28 22:24:58 +00:00
intern all: separate doc comment from //go: directives 2022-04-05 17:54:15 +00:00
itoa all: add internal/itoa package 2021-03-14 17:56:50 +00:00
lazyregexp
lazytemplate all: gofmt -w -r 'interface{} -> any' src 2021-12-13 18:45:54 +00:00
nettrace all: gofmt main repo 2022-04-11 16:34:30 +00:00
obscuretestdata all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTemp 2020-12-09 19:12:23 +00:00
oserror
pkgbits internal/pkgbits: better documentation 2022-05-20 19:01:40 +00:00
poll internal/poll, net, syscall: use accept4 on solaris 2022-05-03 14:38:32 +00:00
profile all: gofmt main repo 2022-04-11 16:34:30 +00:00
race all: go fmt std cmd (but revert vendor) 2021-02-20 03:54:50 +00:00
reflectlite cmd/compile: set LocalPkg.Path to -p flag 2022-05-16 18:19:47 +00:00
singleflight all: gofmt -w -r 'interface{} -> any' src 2021-12-13 18:45:54 +00:00
syscall internal/syscall/unix: loong64 use generic syscall 2022-05-17 19:57:24 +00:00
sysinfo testing: print cpu type as label for benchmarks 2020-10-20 21:30:18 +00:00
testenv all: replace `` and '' with “ (U+201C) and ” (U+201D) in doc comments 2022-04-05 17:52:29 +00:00
testlog cmd/go, testing, os: fail test that calls os.Exit(0) 2020-08-27 23:19:15 +00:00
trace runtime: add CPU samples to execution trace 2022-05-03 20:49:46 +00:00
txtar all: gofmt main repo 2022-04-11 16:34:30 +00:00
unsafeheader all: gofmt -w -r 'interface{} -> any' src 2021-12-13 18:45:54 +00:00
xcoff internal/xcoff: fix wrong bit masking comparisons 2020-03-09 18:07:53 +00:00