aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2026-01-29 10:53:44 +0100
committerAlexander Potapenko <glider@google.com>2026-02-09 09:43:36 +0000
commit3011de391e748b4807ba641400640ee577a1319f (patch)
treeb848f93b9e781af51c48a1a80d8b32a0d77dfa4e /executor
parent64ff670b4316a5d851373786045cecbbfe0cf3fd (diff)
executor: introduce force_inline
Turned out executor_fn_guest_addr() was not inlined when building the reproducers with -O0, so the guest code crashed.
Diffstat (limited to 'executor')
-rw-r--r--executor/common_kvm.h6
-rw-r--r--executor/common_kvm_syzos.h3
2 files changed, 6 insertions, 3 deletions
diff --git a/executor/common_kvm.h b/executor/common_kvm.h
index b413d9370..80253fb19 100644
--- a/executor/common_kvm.h
+++ b/executor/common_kvm.h
@@ -15,7 +15,7 @@
extern char* __start_guest;
// executor_fn_guest_addr() is compiled into both the host and the guest code.
-static inline uintptr_t executor_fn_guest_addr(void* fn)
+static always_inline uintptr_t executor_fn_guest_addr(void* fn)
{
// Prevent the compiler from creating a .rodata constant for
// &__start_guest + SYZOS_ADDR_EXECUTOR_CODE.
@@ -28,7 +28,7 @@ static inline uintptr_t executor_fn_guest_addr(void* fn)
// In Clang-based C++ builds, use template magic to ensure that only guest functions can be passed
// to executor_fn_guest_addr().
template <typename R, typename... A>
-uintptr_t static inline executor_fn_guest_addr(__addrspace_guest R (*fn)(A...))
+uintptr_t static always_inline executor_fn_guest_addr(__addrspace_guest R (*fn)(A...))
{
return executor_fn_guest_addr((void*)fn);
}
@@ -64,4 +64,4 @@ static long syz_kvm_assert_syzos_kvm_exit(volatile long a0, volatile long a1)
}
#endif
-#endif // EXECUTOR_COMMON_KVM_H \ No newline at end of file
+#endif // EXECUTOR_COMMON_KVM_H
diff --git a/executor/common_kvm_syzos.h b/executor/common_kvm_syzos.h
index 923284efe..096ff2556 100644
--- a/executor/common_kvm_syzos.h
+++ b/executor/common_kvm_syzos.h
@@ -11,6 +11,9 @@
// (e.g. generate switch tables).
#define noinline __attribute__((noinline))
+// Force inlining as much as possible.
+#define always_inline __attribute__((always_inline)) inline
+
// __no_stack_protector disables -fstack-protector which may introduce unwanted global accesses.
// TODO(glider): once syz-env-old migrates to GCC>11 we can just use
// __attribute__((no_stack_protector)).