From c2337c94bffa1e752c0523c3c7d46522d317e238 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 16 Oct 2017 13:57:37 +0200 Subject: executor: fix akaros nonfailing mode --- pkg/csource/akaros_common.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'pkg/csource') diff --git a/pkg/csource/akaros_common.go b/pkg/csource/akaros_common.go index 74e7e310b..669020aa8 100644 --- a/pkg/csource/akaros_common.go +++ b/pkg/csource/akaros_common.go @@ -19,6 +19,7 @@ var commonHeaderAkaros = ` #include #endif #if defined(SYZ_EXECUTOR) || defined(SYZ_HANDLE_SEGV) +#include #include #include #endif @@ -194,6 +195,11 @@ static uint16_t csum_inet_digest(struct csum_inet* csum) static __thread int skip_segv; static __thread jmp_buf segv_env; +static void recover() +{ + _longjmp(segv_env, 1); +} + static void segv_handler(int sig, siginfo_t* info, void* ctx) { uintptr_t addr = (uintptr_t)info->si_addr; @@ -201,7 +207,9 @@ static void segv_handler(int sig, siginfo_t* info, void* ctx) const uintptr_t prog_end = 100 << 20; if (__atomic_load_n(&skip_segv, __ATOMIC_RELAXED) && (addr < prog_start || addr > prog_end)) { debug("SIGSEGV on %p, skipping\n", addr); - siglongjmp(segv_env, 1); + struct user_context* uctx = (struct user_context*)ctx; + uctx->tf.hw_tf.tf_rip = (long)(void*)recover; + return; } debug("SIGSEGV on %p, exiting\n", addr); doexit(sig); -- cgit mrf-deployment