aboutsummaryrefslogtreecommitdiffstats
path: root/csource
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2017-05-17 18:05:28 +0200
committerAndrey Konovalov <andreyknvl@google.com>2017-06-12 19:48:23 +0200
commit1ab96df8855796901f133c1afab0f7384fc92eea (patch)
tree733527f49344852acbc2a106ce51d5654559a3ae /csource
parent7b43c5f9f723c6d593cb03065ea3371b86c350c7 (diff)
executor: call flush_tun for repeat repros
Diffstat (limited to 'csource')
-rw-r--r--csource/common.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/csource/common.go b/csource/common.go
index e1c1863ec..09eeac8a4 100644
--- a/csource/common.go
+++ b/csource/common.go
@@ -368,13 +368,6 @@ int read_tun(char* data, int size)
return rv;
}
-void flush_tun()
-{
- char data[SYZ_TUN_MAX_PACKET_SIZE];
- while (read_tun(&data[0], sizeof(data)) != -1)
- ;
-}
-
static uintptr_t syz_extract_tcp_res(uintptr_t a0, uintptr_t a1, uintptr_t a2)
{
@@ -425,6 +418,15 @@ static uintptr_t syz_extract_tcp_res(uintptr_t a0, uintptr_t a1, uintptr_t a2)
}
#endif
+#if defined(SYZ_TUN_ENABLE) && (defined(SYZ_EXECUTOR) || defined(SYZ_REPEAT))
+void flush_tun()
+{
+ char data[SYZ_TUN_MAX_PACKET_SIZE];
+ while (read_tun(&data[0], sizeof(data)) != -1)
+ ;
+}
+#endif
+
#ifdef __NR_syz_open_dev
static uintptr_t syz_open_dev(uintptr_t a0, uintptr_t a1, uintptr_t a2)
{
@@ -1825,6 +1827,9 @@ void loop()
setpgrp();
if (chdir(cwdbuf))
fail("failed to chdir");
+#if defined(SYZ_TUN_ENABLE)
+ flush_tun();
+#endif
test();
doexit(0);
}