From 69d5a967f63450b170c5cf76716e302e86a9cae4 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 28 Jun 2024 13:25:15 +0200 Subject: executor: always return some coverage for test OS This allows to enable test executor with coverage. --- executor/executor_test.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'executor/executor_test.h') 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); -- cgit mrf-deployment