1
0
mirror of https://github.com/golang/go synced 2024-11-16 21:14:44 -07:00

runtime: mark string comparison hooks as no split

These functions can be inserted by the compiler into the code to be
instrumented. This may result in these functions having callers that
are nosplit. That is why they must be nosplit.

This is a followup for CL 410034 in order to fix #53190.

Change-Id: I03746208a2a302a581a1eaad6c9d0672bb1e949a
GitHub-Last-Rev: 6506d86f22
GitHub-Pull-Request: golang/go#53544
Reviewed-on: https://go-review.googlesource.com/c/go/+/413978
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
Khaled Yakdan 2022-06-25 05:17:45 +00:00 committed by Keith Randall
parent 3b594b9255
commit 1821639b57

View File

@ -92,6 +92,8 @@ func init() {
// 4. result: an integer representing the comparison result. 0 indicates // 4. result: an integer representing the comparison result. 0 indicates
// equality (comparison will ignored by libfuzzer), non-zero indicates a // equality (comparison will ignored by libfuzzer), non-zero indicates a
// difference (comparison will be taken into consideration). // difference (comparison will be taken into consideration).
//
//go:nosplit
func libfuzzerHookStrCmp(s1, s2 string, fakePC int) { func libfuzzerHookStrCmp(s1, s2 string, fakePC int) {
if s1 != s2 { if s1 != s2 {
libfuzzerCall4(&__sanitizer_weak_hook_strcmp, uintptr(fakePC), cstring(s1), cstring(s2), uintptr(1)) libfuzzerCall4(&__sanitizer_weak_hook_strcmp, uintptr(fakePC), cstring(s1), cstring(s2), uintptr(1))
@ -102,6 +104,8 @@ func libfuzzerHookStrCmp(s1, s2 string, fakePC int) {
// This function has now the same implementation as libfuzzerHookStrCmp because we lack better checks // This function has now the same implementation as libfuzzerHookStrCmp because we lack better checks
// for case-insensitive string equality in the runtime package. // for case-insensitive string equality in the runtime package.
//
//go:nosplit
func libfuzzerHookEqualFold(s1, s2 string, fakePC int) { func libfuzzerHookEqualFold(s1, s2 string, fakePC int) {
if s1 != s2 { if s1 != s2 {
libfuzzerCall4(&__sanitizer_weak_hook_strcmp, uintptr(fakePC), cstring(s1), cstring(s2), uintptr(1)) libfuzzerCall4(&__sanitizer_weak_hook_strcmp, uintptr(fakePC), cstring(s1), cstring(s2), uintptr(1))