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.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.h')
| -rw-r--r-- | executor/common.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/executor/common.h b/executor/common.h index 5f33d3bf5..10e5b960b 100644 --- a/executor/common.h +++ b/executor/common.h @@ -483,6 +483,9 @@ again: } for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) sleep_ms(1); +#if SYZ_HAVE_CLOSE_FDS + close_fds(); +#endif #if SYZ_COLLIDE if (!collide) { collide = 1; @@ -571,8 +574,8 @@ static void loop(void) close(kOutPipeFd); #endif execute_one(); -#if SYZ_HAVE_RESET_TEST - reset_test(); +#if SYZ_HAVE_CLOSE_FDS && !SYZ_THREADED + close_fds(); #endif doexit(0); #endif @@ -659,6 +662,9 @@ void loop(void) #endif { /*SYSCALLS*/ +#if SYZ_HAVE_CLOSE_FDS && !SYZ_THREADED && !SYZ_REPEAT + close_fds(); +#endif } #endif @@ -690,6 +696,10 @@ int main(void) use_temporary_dir(); #endif /*SANDBOX_FUNC*/ +#if SYZ_HAVE_CLOSE_FDS && !SYZ_THREADED && !SYZ_REPEAT && !SYZ_SANDBOX_NONE && \ + !SYZ_SANDBOX_SETUID && !SYZ_SANDBOX_NAMESPACE && !SYZ_SANDBOX_ANDROID_UNTRUSTED_APP + close_fds(); +#endif #if SYZ_PROCS } } |
