aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-06-28 13:25:15 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-06-28 12:16:25 +0000
commit69d5a967f63450b170c5cf76716e302e86a9cae4 (patch)
treee645b5e10a4ef19fb1378cfb039146eb7c643cc2 /executor
parent7c9e8492e6c7882c495b29c53e078327c2a23de5 (diff)
executor: always return some coverage for test OS
This allows to enable test executor with coverage.
Diffstat (limited to 'executor')
-rw-r--r--executor/executor_test.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/executor/executor_test.h b/executor/executor_test.h
index a5eda15d2..c2802dd2a 100644
--- a/executor/executor_test.h
+++ b/executor/executor_test.h
@@ -27,11 +27,6 @@ static void os_init(int argc, char** argv, void* data, size_t data_size)
is_kernel_64_bit = sizeof(unsigned long) == 8;
}
-static intptr_t execute_syscall(const call_t* c, intptr_t a[kMaxArgs])
-{
- return c->call(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);
-}
-
#ifdef __clang__
#define notrace
#else
@@ -54,6 +49,16 @@ extern "C" notrace void __sanitizer_cov_trace_pc(void)
}
}
+static intptr_t execute_syscall(const call_t* c, intptr_t a[kMaxArgs])
+{
+ // Inject coverage PC even when built w/o coverage instrumentation.
+ // This allows to pass machine check with coverage enabled.
+ // pkg/fuzzer tests with coverage instrumentation shouldn't be distracted by the additional PC,
+ // and syz_inject_cover overwrites the whole array so will remote it.
+ __sanitizer_cov_trace_pc();
+ return c->call(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);
+}
+
static void cover_open(cover_t* cov, bool extra)
{
cov->mmap_alloc_size = kCoverSize * sizeof(unsigned long);