From 6506d86f221d745de083fad862bba7ba04a80455 Mon Sep 17 00:00:00 2001 From: Khaled Yakdan Date: Sat, 25 Jun 2022 00:02:13 +0200 Subject: [PATCH] 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. --- src/runtime/libfuzzer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/runtime/libfuzzer.go b/src/runtime/libfuzzer.go index 02dcc18e7a3cb6..6bfaef823b97a4 100644 --- a/src/runtime/libfuzzer.go +++ b/src/runtime/libfuzzer.go @@ -92,6 +92,8 @@ func init() { // 4. result: an integer representing the comparison result. 0 indicates // equality (comparison will ignored by libfuzzer), non-zero indicates a // difference (comparison will be taken into consideration). +// +//go:nosplit func libfuzzerHookStrCmp(s1, s2 string, fakePC int) { if s1 != s2 { 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 // for case-insensitive string equality in the runtime package. +// +//go:nosplit func libfuzzerHookEqualFold(s1, s2 string, fakePC int) { if s1 != s2 { libfuzzerCall4(&__sanitizer_weak_hook_strcmp, uintptr(fakePC), cstring(s1), cstring(s2), uintptr(1))