Skip to content

Commit 3294aa2

Browse files
committed
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.
1 parent 6b6c64b commit 3294aa2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/runtime/libfuzzer.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ func init() {
9292
// 4. result: an integer representing the comparison result. 0 indicates
9393
// equality (comparison will ignored by libfuzzer), non-zero indicates a
9494
// difference (comparison will be taken into consideration).
95+
//
96+
//go:nosplit
9597
func libfuzzerHookStrCmp(s1, s2 string, fakePC int) {
9698
if s1 != s2 {
9799
libfuzzerCall4(&__sanitizer_weak_hook_strcmp, uintptr(fakePC), cstring(s1), cstring(s2), uintptr(1))
@@ -102,6 +104,8 @@ func libfuzzerHookStrCmp(s1, s2 string, fakePC int) {
102104

103105
// This function has now the same implementation as libfuzzerHookStrCmp because we lack better checks
104106
// for case-insensitive string equality in the runtime package.
107+
//
108+
//go:nosplit
105109
func libfuzzerHookEqualFold(s1, s2 string, fakePC int) {
106110
if s1 != s2 {
107111
libfuzzerCall4(&__sanitizer_weak_hook_strcmp, uintptr(fakePC), cstring(s1), cstring(s2), uintptr(1))

0 commit comments

Comments
 (0)