aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common.h
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-11-27 17:23:09 +0100
committerDmitry Vyukov <dvyukov@google.com>2024-12-11 15:22:17 +0000
commit299ee674e6c124a35f1cf258df4f0f3c6e1db1f3 (patch)
tree416b515e959a1d0a64a9516b1524a062ae63ba7d /executor/common.h
parentff949d2512c5ac33d0407d26d80f1df77b2de0e7 (diff)
executor: query globs in the test program context
We query globs for 2 reasons: 1. Expand glob types in syscall descriptions. 2. Dynamic file probing for automatic descriptions generation. In both of these contexts are are interested in files that will be present during test program execution (rather than normal unsandboxed execution). For example, some files may not be accessible to test programs after pivot root. On the other hand, we create and link some additional files for the test program that don't normally exist. Add a new request type for querying of globs that are executed in the test program context.
Diffstat (limited to 'executor/common.h')
-rw-r--r--executor/common.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/executor/common.h b/executor/common.h
index 123723e5a..7425a8bff 100644
--- a/executor/common.h
+++ b/executor/common.h
@@ -705,9 +705,21 @@ static void loop(void)
last_executed = now;
}
// TODO: adjust timeout for progs with syz_usb_connect call.
- if ((now - start < program_timeout_ms) &&
- (now - start < min_timeout_ms || now - last_executed < inactive_timeout_ms))
+ // If the max program timeout is exceeded, kill unconditionally.
+ if (now - start > program_timeout_ms)
+ goto kill_test;
+ // If the request type is not a normal test program (currently, glob expansion request),
+ // then wait for the full timeout (these requests don't update number of completed calls
+ // + they are more important and we don't want timing flakes).
+ if (request_type != rpc::RequestType::Program)
continue;
+ // Always wait at least the min timeout for each program.
+ if (now - start < min_timeout_ms)
+ continue;
+ // If it keeps completing syscalls, then don't kill it.
+ if (now - last_executed < inactive_timeout_ms)
+ continue;
+ kill_test:
#else
if (current_time_ms() - start < /*{{{PROGRAM_TIMEOUT_MS}}}*/)
continue;