aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-10-16 13:57:37 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-10-16 14:21:54 +0200
commitc2337c94bffa1e752c0523c3c7d46522d317e238 (patch)
treeac45636efd0c4e2f7cb72df5c9f47e4aac1acc4f /executor
parent85b1f93f8dbbc767c564e494a6353aa3517d5d49 (diff)
executor: fix akaros nonfailing mode
Diffstat (limited to 'executor')
-rw-r--r--executor/common_akaros.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/executor/common_akaros.h b/executor/common_akaros.h
index d37e05176..1cccfbc96 100644
--- a/executor/common_akaros.h
+++ b/executor/common_akaros.h
@@ -18,6 +18,7 @@
#include <time.h>
#endif
#if defined(SYZ_EXECUTOR) || defined(SYZ_HANDLE_SEGV)
+#include <parlib/parlib.h>
#include <setjmp.h>
#include <signal.h>
#endif
@@ -37,6 +38,11 @@
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)
{
// Generated programs can contain bad (unmapped/protected) addresses,
@@ -49,10 +55,10 @@ static void segv_handler(int sig, siginfo_t* info, void* ctx)
const uintptr_t prog_start = 1 << 20;
const uintptr_t prog_end = 100 << 20;
if (__atomic_load_n(&skip_segv, __ATOMIC_RELAXED) && (addr < prog_start || addr > prog_end)) {
- // Note: this does not work fully. This skips only over the first SIGSEGV in a thread.
- // See: https://groups.google.com/forum/#!msg/akaros/d8_uwjAfPic/KAF0WwisBAAJ
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);