aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-12-05 14:27:45 +0100
committerDmitry Vyukov <dvyukov@google.com>2017-12-05 20:08:06 +0100
commitc2c4cd4e57b36e5f8b1e1731a78bfc66147222f4 (patch)
treecb99cafc3a08847827170e5dc3d1a12c1ee0e295 /executor
parentd9c79f8842c6a8ed1e691a44c0e97f52f1bcb910 (diff)
executor: treat fail-nth errors as non-fatal
We see occasional ENOENT/EACCES errors returned. It seems that fuzzer somehow gets its hands to it.
Diffstat (limited to 'executor')
-rw-r--r--executor/common_linux.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h
index 13014e33e..aee1f65b9 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -946,11 +946,14 @@ static int inject_fault(int nth)
char buf[16];
fd = open("/proc/thread-self/fail-nth", O_RDWR);
+ // We treat errors here as temporal/non-critical because we see
+ // occasional ENOENT/EACCES errors returned. It seems that fuzzer
+ // somehow gets its hands to it.
if (fd == -1)
- fail("failed to open /proc/thread-self/fail-nth");
+ exitf("failed to open /proc/thread-self/fail-nth");
sprintf(buf, "%d", nth + 1);
if (write(fd, buf, strlen(buf)) != (ssize_t)strlen(buf))
- fail("failed to write /proc/thread-self/fail-nth");
+ exitf("failed to write /proc/thread-self/fail-nth");
return fd;
}
#endif
@@ -961,11 +964,11 @@ static int fault_injected(int fail_fd)
char buf[16];
int n = read(fail_fd, buf, sizeof(buf) - 1);
if (n <= 0)
- fail("failed to read /proc/thread-self/fail-nth");
+ exitf("failed to read /proc/thread-self/fail-nth");
int res = n == 2 && buf[0] == '0' && buf[1] == '\n';
buf[0] = '0';
if (write(fail_fd, buf, 1) != 1)
- fail("failed to write /proc/thread-self/fail-nth");
+ exitf("failed to write /proc/thread-self/fail-nth");
close(fail_fd);
return res;
}