diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2024-08-14 14:02:24 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-08-14 13:36:33 +0000 |
| commit | bb77518be889b2f4dadcaf7b0260d76dd5babd18 (patch) | |
| tree | 0a2b67ba0bd37dd49ca34727824b8b372d5287a8 /executor/executor_linux.h | |
| parent | e6b88e204cdd134b36c39384a01169256fcb8c77 (diff) | |
executor: simplify mapping of kcov guard pages
Diffstat (limited to 'executor/executor_linux.h')
| -rw-r--r-- | executor/executor_linux.h | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/executor/executor_linux.h b/executor/executor_linux.h index ff8f3bc60..072831816 100644 --- a/executor/executor_linux.h +++ b/executor/executor_linux.h @@ -105,17 +105,9 @@ static void cover_mmap(cover_t* cov) fail("cover_t structure is corrupted"); // Allocate kcov buffer plus two guard pages surrounding it. char* mapped = (char*)mmap(NULL, cov->mmap_alloc_size + 2 * SYZ_PAGE_SIZE, - PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); + PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0); if (mapped == MAP_FAILED) exitf("failed to preallocate kcov buffer"); - // Protect the guard pages. - int res = mprotect(mapped, SYZ_PAGE_SIZE, PROT_NONE); - if (res == -1) - exitf("failed to protect kcov guard page"); - res = mprotect(mapped + SYZ_PAGE_SIZE + cov->mmap_alloc_size, - SYZ_PAGE_SIZE, PROT_NONE); - if (res == -1) - exitf("failed to protect kcov guard page"); // Now map the kcov buffer to the file, overwriting the existing mapping above. cov->data = (char*)mmap(mapped + SYZ_PAGE_SIZE, cov->mmap_alloc_size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, cov->fd, 0); |
