aboutsummaryrefslogtreecommitdiffstats
path: root/executor/executor_linux.h
diff options
context:
space:
mode:
Diffstat (limited to 'executor/executor_linux.h')
-rw-r--r--executor/executor_linux.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/executor/executor_linux.h b/executor/executor_linux.h
index 1cdb2dc46..2eab98560 100644
--- a/executor/executor_linux.h
+++ b/executor/executor_linux.h
@@ -40,9 +40,12 @@ static long execute_syscall(const call_t* c, long a[kMaxArgs])
static void cover_open(cover_t* cov)
{
- cov->fd = open("/sys/kernel/debug/kcov", O_RDWR);
- if (cov->fd == -1)
+ int fd = open("/sys/kernel/debug/kcov", O_RDWR);
+ if (fd == -1)
fail("open of /sys/kernel/debug/kcov failed");
+ if (dup2(fd, cov->fd) < 0)
+ fail("filed to dup2(%d, %d) cover fd", fd, cov->fd);
+ close(fd);
const int kcov_init_trace = is_kernel_64_bit ? KCOV_INIT_TRACE64 : KCOV_INIT_TRACE32;
if (ioctl(cov->fd, kcov_init_trace, kCoverSize))
fail("cover init trace write failed");