diff options
| author | Andrey Konovalov <andreyknvl@google.com> | 2019-04-05 18:44:53 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-04-09 10:53:11 +0200 |
| commit | 5c51045d28eb1ad9465a51487d436133ce7b98d2 (patch) | |
| tree | ff89db14c5b528bbf0901eaffad8f6a930149340 /executor/common_linux.h | |
| parent | e619f52452849cfe06939fbb73a9efbbbd57ffd6 (diff) | |
all: add optional close_fds feature to reproducers
Instead of always closing open fds (number 3 to 30) after each program,
add an options called EnableCloseFds. It can be passed to syz-execprog,
syz-prog2c and syz-stress via the -enable and -disable flags. Set the
default value to true. Also minimize C repros over it, except for when
repeat is enabled.
Diffstat (limited to 'executor/common_linux.h')
| -rw-r--r-- | executor/common_linux.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h index b84955577..0fd7a1582 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -2612,12 +2612,20 @@ static void setup_test() flush_tun(); #endif } +#endif -#define SYZ_HAVE_RESET_TEST 1 -static void reset_test() +#if SYZ_EXECUTOR || SYZ_ENABLE_CLOSE_FDS +#define SYZ_HAVE_CLOSE_FDS 1 +static void close_fds() { +#if SYZ_EXECUTOR + if (!flag_enable_close_fds) + return; +#endif // Keeping a 9p transport pipe open will hang the proccess dead, // so close all opened file descriptors. + // Also close all USB emulation descriptors to trigger exit from USB + // event loop to collect coverage. int fd; for (fd = 3; fd < 30; fd++) close(fd); |
