diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-09-12 11:05:45 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-09-12 13:03:27 +0200 |
| commit | 306464056c8af8d00798b5ef9195950bd6502314 (patch) | |
| tree | 9e52e84e25780c79c56c9bb78b32b4ca4e7b66d2 /executor | |
| parent | cc8045ff1f9b4b54834e6e95bedbeeb18c9a7a00 (diff) | |
sys/test/test: add a hanging test
Ensure that we can handle hanging syscalls in all modes.
Diffstat (limited to 'executor')
| -rw-r--r-- | executor/common.h | 2 | ||||
| -rw-r--r-- | executor/common_test.h | 9 | ||||
| -rw-r--r-- | executor/executor.cc | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/executor/common.h b/executor/common.h index 7fd4b255e..81ddefd01 100644 --- a/executor/common.h +++ b/executor/common.h @@ -151,7 +151,7 @@ static void kill_and_wait(int pid, int* status) #if !GOOS_windows #if SYZ_EXECUTOR || SYZ_THREADED || SYZ_REPEAT && SYZ_EXECUTOR_USES_FORK_SERVER || \ - __NR_syz_usb_connect || __NR_syz_usb_connect_ath9k + __NR_syz_usb_connect || __NR_syz_usb_connect_ath9k || __NR_syz_sleep_ms static void sleep_ms(uint64 ms) { usleep(ms * 1000); diff --git a/executor/common_test.h b/executor/common_test.h index ebbff1517..9d9adc36f 100644 --- a/executor/common_test.h +++ b/executor/common_test.h @@ -36,6 +36,15 @@ static long syz_exit(volatile long status) } #endif +#if SYZ_EXECUTOR || __NR_syz_sleep_ms +// syz_sleep_ms(ms intptr) +static long syz_sleep_ms(volatile long ms) +{ + sleep_ms(ms); + return 0; +} +#endif + #if SYZ_EXECUTOR || __NR_syz_compare #include <errno.h> #include <string.h> diff --git a/executor/executor.cc b/executor/executor.cc index ca24ffd07..e63f9b224 100644 --- a/executor/executor.cc +++ b/executor/executor.cc @@ -950,7 +950,7 @@ void copyout_call_results(thread_t* th) void write_call_output(thread_t* th, bool finished) { uint32 reserrno = 999; - const bool blocked = th != last_scheduled; + const bool blocked = finished && th != last_scheduled; uint32 call_flags = call_flag_executed | (blocked ? call_flag_blocked : 0); if (finished) { reserrno = th->res != -1 ? 0 : th->reserrno; |
