diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2024-06-10 11:10:13 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-06-10 13:40:53 +0000 |
| commit | 348a48c80275445af03c893a955f29c3db0eb62d (patch) | |
| tree | 684f1916ed97e05318def490da5f04735a4b4a49 /executor | |
| parent | a4ba0f374d48bd31c2248532dc96ec11ba192b77 (diff) | |
executor: use close_range if available
Close_range is faster.
Diffstat (limited to 'executor')
| -rw-r--r-- | executor/common_linux.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h index 6b1826c65..f7f64a5c6 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -4818,6 +4818,7 @@ static void setup_test() #endif #if SYZ_EXECUTOR || SYZ_CLOSE_FDS +#include <sys/syscall.h> #define SYZ_HAVE_CLOSE_FDS 1 static void close_fds() { @@ -4825,6 +4826,10 @@ static void close_fds() if (!flag_close_fds) return; #endif +#ifdef SYS_close_range + if (!syscall(SYS_close_range, 3, MAX_FDS, 0)) + 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 |
