Skip to content

Commit 1821639

Browse files
kyakdanrandall77
authored andcommitted
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: 6506d86 GitHub-Pull-Request: #53544 Reviewed-on: https://go-review.googlesource.com/c/go/+/413978 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Run-TryBot: Dmitri Shuralyov <[email protected]>
1 parent 3b594b9 commit 1821639

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/runtime/libfuzzer.go

+4
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)