From e18aa5057febfc3f9f61c8755234e361528def0e Mon Sep 17 00:00:00 2001 From: Alexander Potapenko Date: Tue, 14 Oct 2025 13:20:39 +0200 Subject: executor: introduce __addrspace_guest Apply __addrspace_guest to every guest function and use a C++ template to statically validate that host functions are not passed to executor_fn_guest_addr(). This only works in Clang builds of syz-executor, because GCC does not support address spaces, and C reproducers cannot use templates. The static check allows us to drop the dynamic checks in DEFINE_GUEST_FN_TO_GPA_FN(). While at it, replace DEFINE_GUEST_FN_TO_GPA_FN() with explicit declarations of host_fn_guest_addr() and guest_fn_guest_addr(). --- executor/common_kvm_arm64_syzos.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'executor/common_kvm_arm64_syzos.h') diff --git a/executor/common_kvm_arm64_syzos.h b/executor/common_kvm_arm64_syzos.h index 2dd00a146..0a9e3391f 100644 --- a/executor/common_kvm_arm64_syzos.h +++ b/executor/common_kvm_arm64_syzos.h @@ -89,18 +89,18 @@ struct api_call_its_send_cmd { uint32 cpuid2; }; -static void guest_uexit(uint64 exit_code); -static void guest_execute_code(uint32* insns, uint64 size); -static void guest_handle_mrs(uint64 reg); -static void guest_handle_msr(uint64 reg, uint64 val); -static void guest_handle_smc(struct api_call_smccc* cmd); -static void guest_handle_hvc(struct api_call_smccc* cmd); -static void guest_handle_svc(struct api_call_smccc* cmd); -static void guest_handle_eret(uint64 unused); -static void guest_handle_irq_setup(struct api_call_irq_setup* cmd); -static void guest_handle_memwrite(struct api_call_memwrite* cmd); -static void guest_handle_its_setup(struct api_call_3* cmd); -static void guest_handle_its_send_cmd(struct api_call_its_send_cmd* cmd); +GUEST_CODE static void guest_uexit(uint64 exit_code); +GUEST_CODE static void guest_execute_code(uint32* insns, uint64 size); +GUEST_CODE static void guest_handle_mrs(uint64 reg); +GUEST_CODE static void guest_handle_msr(uint64 reg, uint64 val); +GUEST_CODE static void guest_handle_smc(struct api_call_smccc* cmd); +GUEST_CODE static void guest_handle_hvc(struct api_call_smccc* cmd); +GUEST_CODE static void guest_handle_svc(struct api_call_smccc* cmd); +GUEST_CODE static void guest_handle_eret(uint64 unused); +GUEST_CODE static void guest_handle_irq_setup(struct api_call_irq_setup* cmd); +GUEST_CODE static void guest_handle_memwrite(struct api_call_memwrite* cmd); +GUEST_CODE static void guest_handle_its_setup(struct api_call_3* cmd); +GUEST_CODE static void guest_handle_its_send_cmd(struct api_call_its_send_cmd* cmd); typedef enum { UEXIT_END = (uint64)-1, -- cgit mrf-deployment