aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-08-09 13:50:49 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-08-09 16:05:46 +0200
commit922e8e27343704155b81f50ddd3316ec04c9d299 (patch)
treeee5f2640775e336d923912c3249bac797dd33e05 /executor
parentacf31536e9e570b2a5ee11a7818c96e4d177c808 (diff)
executor: mount binfmt_mist
We forgot to mount binfmt_misc. Mount it. Add a test. Increase per-call timeout, otherwise last execve timesout. Fix csource waiting for call completion at the end of program.
Diffstat (limited to 'executor')
-rw-r--r--executor/common.h8
-rw-r--r--executor/common_linux.h7
-rw-r--r--executor/executor.cc3
3 files changed, 11 insertions, 7 deletions
diff --git a/executor/common.h b/executor/common.h
index 7255b7dc7..04358d1b1 100644
--- a/executor/common.h
+++ b/executor/common.h
@@ -418,7 +418,7 @@ static void loop()
#if SYZ_TRACE
printf("### start\n");
#endif
- int call, thread;
+ int i, call, thread;
#if SYZ_COLLIDE
int collide = 0;
again:
@@ -443,12 +443,12 @@ again:
if (collide && (call % 2) == 0)
break;
#endif
- event_timedwait(&th->done, 25);
- if (__atomic_load_n(&running, __ATOMIC_RELAXED))
- sleep_ms((call == [[NUM_CALLS]] - 1) ? 10 : 2);
+ event_timedwait(&th->done, 45);
break;
}
}
+ for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++)
+ sleep_ms(1);
#if SYZ_COLLIDE
if (!collide) {
collide = 1;
diff --git a/executor/common_linux.h b/executor/common_linux.h
index 49c33c108..9c1f5d776 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -1422,10 +1422,13 @@ static void setup_cgroups()
// but for now we bundle this with cgroups.
static void setup_binfmt_misc()
{
- if (!write_file("/proc/sys/fs/binfmt_misc/register", ":syz0:M:0:syz0::./file0:")) {
+ if (mount(0, "/proc/sys/fs/binfmt_misc", "binfmt_misc", 0, 0)) {
+ debug("mount(binfmt_misc) failed: %d\n", errno);
+ }
+ if (!write_file("/proc/sys/fs/binfmt_misc/register", ":syz0:M:0:\x01::./file0:")) {
debug("write(/proc/sys/fs/binfmt_misc/register, syz0) failed: %d\n", errno);
}
- if (!write_file("/proc/sys/fs/binfmt_misc/register", ":syz1:M:1:yz1::./file0:POC")) {
+ if (!write_file("/proc/sys/fs/binfmt_misc/register", ":syz1:M:1:\x02::./file0:POC")) {
debug("write(/proc/sys/fs/binfmt_misc/register, syz1) failed: %d\n", errno);
}
}
diff --git a/executor/executor.cc b/executor/executor.cc
index c918f8b43..1e6e9d255 100644
--- a/executor/executor.cc
+++ b/executor/executor.cc
@@ -646,7 +646,7 @@ retry:
} else if (flag_threaded) {
// Wait for call completion.
// Note: sys knows about this 25ms timeout when it generates timespec/timeval values.
- const uint64 timeout_ms = flag_debug ? 1000 : 25;
+ const uint64 timeout_ms = flag_debug ? 1000 : 45;
if (event_timedwait(&th->done, timeout_ms))
handle_completion(th);
// Check if any of previous calls have completed.
@@ -668,6 +668,7 @@ retry:
if (!colliding && !collide && running > 0) {
// Give unfinished syscalls some additional time.
+ last_scheduled = 0;
uint64 wait = 100;
uint64 wait_start = current_time_ms();
uint64 wait_end = wait_start + wait;