aboutsummaryrefslogtreecommitdiffstats
path: root/executor/executor.cc
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2021-09-29 22:52:42 -0700
committerDmitry Vyukov <dvyukov@google.com>2021-09-30 14:32:29 +0200
commit0f01403dc7473fbc755ecd7178284237477c64d8 (patch)
tree08f13cd79817bcd74b298618b472871354dff703 /executor/executor.cc
parentbe530f6c7e0a2e1f66d03a5ad71d209302219d37 (diff)
executor: fail if the first argument isn't a known command
We have seen cases when a test program re-execed the current binary: 11:53:29 executing program 0: openat$zero(0xffffffffffffff9c, &(0x7f0000000040), 0x0, 0x0) r0 = openat(0xffffffffffffff9c, &(0x7f0000000080)='/proc/self/exe\x00', 0x0, 0x0) lseek(r0, 0x4000000000000000, 0x4) execveat(r0, &(0x7f0000000080)='\x00', 0x0, 0x0, 0x1000) In such cases, we have to be sure that executor will not print SYZFAIL log messages and will not exit with kFailStatus. Since a659b3f1, syzkaller reports bugs in all these cases. Fixes: a659b3f1dc88 ("pkg/report: detect executor failures") Signed-off-by: Andrei Vagin <avagin@google.com>
Diffstat (limited to 'executor/executor.cc')
-rw-r--r--executor/executor.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/executor/executor.cc b/executor/executor.cc
index 1aea79898..6e3214925 100644
--- a/executor/executor.cc
+++ b/executor/executor.cc
@@ -407,6 +407,11 @@ int main(int argc, char** argv)
if (argc == 2 && strcmp(argv[1], "test") == 0)
return run_tests();
+ if (argc < 2 || strcmp(argv[1], "exec") != 0) {
+ fprintf(stderr, "unknown command");
+ return 1;
+ }
+
start_time_ms = current_time_ms();
os_init(argc, argv, (char*)SYZ_DATA_OFFSET, SYZ_NUM_PAGES * SYZ_PAGE_SIZE);