aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2021-12-06 11:27:33 +0000
committerAleksandr Nogikh <wp32pw@gmail.com>2021-12-06 14:28:24 +0100
commitb18e90e04ac0c6a06518fc9469dc7d12d83db901 (patch)
tree1c423f9cef274f075471d6b5f34920b3b7e522a1 /executor
parent579a875477d8f31f2d49aeb00628628a8ce5f340 (diff)
executor: set fixed fd for the extra coverage kcov instance
Currently it is dup2'd to 0, which is quite likely to be closed by the fuzzer. Dup2 it to a safer fd instead.
Diffstat (limited to 'executor')
-rw-r--r--executor/executor.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/executor/executor.cc b/executor/executor.cc
index b11faa684..e4034310d 100644
--- a/executor/executor.cc
+++ b/executor/executor.cc
@@ -71,6 +71,7 @@ const int kPreMmapCoverThreads = 3; // the number of kcov instances to mmap duri
const int kInPipeFd = kMaxFd - 1; // remapped from stdin
const int kOutPipeFd = kMaxFd - 2; // remapped from stdout
const int kCoverFd = kOutPipeFd - kMaxThreads;
+const int kExtraCoverFd = kCoverFd - 1;
const int kMaxArgs = 9;
const int kCoverSize = 256 << 10;
const int kFailStatus = 67;
@@ -477,6 +478,7 @@ int main(int argc, char** argv)
thread_mmap_cover(&threads[i]);
}
}
+ extra_cov.fd = kExtraCoverFd;
cover_open(&extra_cov, true);
cover_mmap(&extra_cov);
cover_protect(&extra_cov);