diff options
author | Matthew Dempsky <mdempsky@google.com> | 2019-10-28 15:30:35 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2019-11-05 00:00:43 +0000 |
commit | ea0b4e7c7db8c5d376e77fd3e6741d94685073ac (patch) | |
tree | 8afdc5178caea495179b453a704b6207d3dc1ad0 /src/runtime/libfuzzer_arm64.s | |
parent | e341e93c519ef22ed4759fd0b4643a30321b9222 (diff) | |
download | go-ea0b4e7c7db8c5d376e77fd3e6741d94685073ac.tar.gz go-ea0b4e7c7db8c5d376e77fd3e6741d94685073ac.zip |
cmd/compile, runtime: add comparison tracing for libFuzzer
This CL extends cmd/compile's experimental libFuzzer support with
calls to __sanitizer_cov_trace_{,const_}cmp{1,2,4,8}. This allows much
more efficient fuzzing of comparisons.
Only supports amd64 and arm64 for now.
Updates #14565.
Change-Id: Ibf82a8d9658f2bc50d955bdb1ae26723a3f0584d
Reviewed-on: https://go-review.googlesource.com/c/go/+/203887
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/libfuzzer_arm64.s')
-rw-r--r-- | src/runtime/libfuzzer_arm64.s | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/runtime/libfuzzer_arm64.s b/src/runtime/libfuzzer_arm64.s new file mode 100644 index 0000000000..121673e092 --- /dev/null +++ b/src/runtime/libfuzzer_arm64.s @@ -0,0 +1,31 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build libfuzzer + +#include "go_asm.h" +#include "textflag.h" + +// Based on race_arm64.s; see commentary there. + +// func runtime·libfuzzerCall(fn, arg0, arg1 uintptr) +// Calls C function fn from libFuzzer and passes 2 arguments to it. +TEXT runtime·libfuzzerCall(SB), NOSPLIT, $0-24 + MOVD fn+0(FP), R9 + MOVD arg0+8(FP), R0 + MOVD arg1+16(FP), R1 + + MOVD g_m(g), R10 + + // Switch to g0 stack. + MOVD RSP, R19 // callee-saved, preserved across the CALL + MOVD m_g0(R10), R11 + CMP R11, g + BEQ call // already on g0 + MOVD (g_sched+gobuf_sp)(R11), R12 + MOVD R12, RSP +call: + BL R9 + MOVD R19, RSP + RET |