From 1b84ed358f51f36c0dd1f69ce45a158f82b5f140 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 15 Dec 2020 19:21:25 +0100 Subject: executor: don't use coverage edges for gvisor gvisor coverage is not a trace, so producing edges won't work. --- executor/executor.cc | 8 +++----- executor/executor_bsd.h | 7 +------ executor/executor_linux.h | 14 +++++++++----- executor/nocover.h | 7 +------ 4 files changed, 14 insertions(+), 22 deletions(-) (limited to 'executor') diff --git a/executor/executor.cc b/executor/executor.cc index 3c00fd6a2..cbd3048f9 100644 --- a/executor/executor.cc +++ b/executor/executor.cc @@ -873,11 +873,9 @@ void write_coverage_signal(cover_t* cov, uint32* signal_count_pos, uint32* cover bool prev_filter = true; for (uint32 i = 0; i < cov->size; i++) { cover_data_t pc = cover_data[i]; - if (!cover_check(pc)) { - debug("got bad pc: 0x%llx\n", (uint64)pc); - doexit(0); - } - cover_data_t sig = pc ^ hash(prev_pc); + uint32 sig = pc; + if (use_cover_edges(pc)) + sig ^= hash(prev_pc); bool filter = coverage_filter(pc); // Ignore the edge only if both current and previous PCs are filtered out // to capture all incoming and outcoming edges into the interesting code. diff --git a/executor/executor_bsd.h b/executor/executor_bsd.h index 65d9fd925..fa31099fe 100644 --- a/executor/executor_bsd.h +++ b/executor/executor_bsd.h @@ -168,12 +168,7 @@ static void cover_collect(cover_t* cov) cov->size = *(uint64*)cov->data; } -static bool cover_check(uint32 pc) -{ - return true; -} - -static bool cover_check(uint64 pc) +static bool use_cover_edges(uint64 pc) { return true; } diff --git a/executor/executor_linux.h b/executor/executor_linux.h index 8c5a19ef7..9de1b1c40 100644 --- a/executor/executor_linux.h +++ b/executor/executor_linux.h @@ -168,19 +168,23 @@ static void cover_collect(cover_t* cov) cov->size = *(uint32*)cov->data; } -static bool cover_check(uint32 pc) +static bool use_cover_edges(uint32 pc) { return true; } -static bool cover_check(uint64 pc) +static bool use_cover_edges(uint64 pc) { #if defined(__i386__) || defined(__x86_64__) + if (is_gvisor) + return false; // gvisor coverage is not a trace, so producing edges won't work // Text/modules range for x86_64. - return is_gvisor || (pc >= 0xffffffff80000000ull && pc < 0xffffffffff000000ull); -#else - return true; + if (pc < 0xffffffff80000000ull || pc >= 0xffffffffff000000ull) { + debug("got bad pc: 0x%llx\n", pc); + doexit(0); + } #endif + return true; } static bool detect_kernel_bitness() diff --git a/executor/nocover.h b/executor/nocover.h index e23d69162..da0d0e2f7 100644 --- a/executor/nocover.h +++ b/executor/nocover.h @@ -26,12 +26,7 @@ static void cover_unprotect(cover_t* cov) { } -static bool cover_check(uint32 pc) -{ - return true; -} - -static bool cover_check(uint64 pc) +static bool use_cover_edges(uint64 pc) { return true; } -- cgit mrf-deployment