diff options
| author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2020-08-11 08:54:04 +0900 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-08-12 18:19:04 +0200 |
| commit | bc15f7dbbc1c6e2042a7115b3fdacc0ada8c35e7 (patch) | |
| tree | cbfe881391bf34d8cbbe7b6b08840ff6d83b29e0 /executor/executor_linux.h | |
| parent | 1bf9153625ea4fb8788b2181a94e891b84cb283b (diff) | |
executor/linux: dump mount information when failed to open kcov file
There are many "lost connection to test machine (5)" reports where the
testing terminated due to ENOENT upon open("/sys/kernel/debug/kcov").
Since some testcase might be unintendedly modifying mount information,
let's start from checking whether/how mount is broken.
This commit might be reverted after the cause is identified and fixed.
Diffstat (limited to 'executor/executor_linux.h')
| -rw-r--r-- | executor/executor_linux.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/executor/executor_linux.h b/executor/executor_linux.h index 98b89fc9a..e8105f65f 100644 --- a/executor/executor_linux.h +++ b/executor/executor_linux.h @@ -94,8 +94,30 @@ static intptr_t execute_syscall(const call_t* c, intptr_t a[kMaxArgs]) static void cover_open(cover_t* cov, bool extra) { int fd = open("/sys/kernel/debug/kcov", O_RDWR); - if (fd == -1) + if (fd == -1) { + const int err = errno; + if (chdir("/sys/")) + fprintf(stderr, "/sys/ does not exist.\n"); + else if (chdir("/sys/kernel/")) + fprintf(stderr, "/sys/kernel/ does not exist.\n"); + else if (chdir("/sys/kernel/debug/")) + fprintf(stderr, "/sys/kernel/debug/ does not exist.\n"); + fd = open("/proc/mounts", O_RDONLY); + if (fd == -1) { + fprintf(stderr, "open of /proc/mounts failed.\n"); + if (chdir("/proc/")) + fprintf(stderr, "/proc/ does not exist.\n"); + } else { + static char buffer[4096]; + int len; + fprintf(stderr, "Content of /proc/mounts\n"); + while ((len = read(fd, buffer, sizeof(buffer))) > 0) + fwrite(buffer, 1, len, stderr); + close(fd); + } + errno = err; 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); |
