From 661fd7b9882caba55e3fbc1c95fd4602ebfe580d Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 15 May 2018 09:45:50 +0200 Subject: [PATCH] executor: revert protection of kcov region Turns out it's protection of kcov region that causes coverage drop. Revert it and re-enable coverage filtering. --- executor/executor_linux.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/executor/executor_linux.cc b/executor/executor_linux.cc index a6d264fd..4b88946d 100644 --- a/executor/executor_linux.cc +++ b/executor/executor_linux.cc @@ -144,13 +144,11 @@ void cover_open() if (ioctl(th->cover_fd, kcov_init_trace, kCoverSize)) fail("cover init trace write failed"); size_t mmap_alloc_size = kCoverSize * (is_kernel_64_bit ? 8 : 4); - th->cover_data = (char*)mmap(NULL, mmap_alloc_size, PROT_READ, MAP_SHARED, th->cover_fd, 0); + th->cover_data = (char*)mmap(NULL, mmap_alloc_size, + PROT_READ | PROT_WRITE, MAP_SHARED, th->cover_fd, 0); th->cover_end = th->cover_data + mmap_alloc_size; if (th->cover_data == MAP_FAILED) fail("cover mmap failed"); - // We only write to the first page, so protect the rest from fuzzer. - if (mprotect(th->cover_data, SYZ_PAGE_SIZE, PROT_READ | PROT_WRITE)) - fail("cover mprotect failed"); } } @@ -199,9 +197,7 @@ bool cover_check(uint64 pc) { #if defined(__i386__) || defined(__x86_64__) // Text/modules range for x86_64. - // This causes very significant drop in corpus size. Needs additional debugging. - // return pc >= 0xffffffff80000000ull && pc < 0xffffffffff000000ull; - return true; + return pc >= 0xffffffff80000000ull && pc < 0xffffffffff000000ull; #else return true; #endif