From 3011de391e748b4807ba641400640ee577a1319f Mon Sep 17 00:00:00 2001 From: Alexander Potapenko Date: Thu, 29 Jan 2026 10:53:44 +0100 Subject: executor: introduce force_inline Turned out executor_fn_guest_addr() was not inlined when building the reproducers with -O0, so the guest code crashed. --- executor/common_kvm.h | 6 +++--- executor/common_kvm_syzos.h | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'executor') 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 -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)). -- cgit mrf-deployment